{"_id":"@aofl/resource-enumerate","_rev":"167-351634353c88e5d85ba396939881b9cd","name":"@aofl/resource-enumerate","dist-tags":{"dev":"1.0.0-beta.29-dev.1","next":"2.1.0-alpha.9","next-alpha":"3.0.0-alpha.11","beta":"3.5.0-beta.22","alpha":"4.0.0-alpha.45","latest":"3.14.1"},"versions":{"1.0.0":{"name":"@aofl/resource-enumerate","version":"1.0.0","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"}],"dist":{"shasum":"fb89b5be9f6a0c5a2223d468d07c022b663bfa91","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0.tgz","integrity":"sha512-YDPgwwMuZUpeqf6UyDdNbgtFqoGnERDo0bhGFeTDUJ46L/MduaZF3h9gQ2Rsy7GpK7Naf7wCMlr6giqu5DPeCA==","signatures":[{"sig":"MEYCIQCChMaRRGQgfCtqzfemFFW411GB/J8HnTGhglHKSl3p9wIhAPxIgfFgLKeuUQ9MyWZzrNLvdQDneqZ5pqhIEOBSgmXa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0","@aofl/server-environment":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate-1.0.0.tgz_1516927965064_0.6167010851204395","host":"s3://npm-registry-packages"}},"1.0.0-beta.2":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.2","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.2","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"e8ba8d7f346294e81146b59c50255856bc1786e6","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.2.tgz","fileCount":4,"integrity":"sha512-wWB0knOzlxmvrV+sYgk56ra9HXNUP0hkmn150+aJ5bkTn4enRjB54/0jVWZbOzKkHPkRK7LbxrUOfvD51d7UeQ==","signatures":[{"sig":"MEUCIBUnft63qZxq4Gt2V/xOoX7X+F1aAZoFA+H9bIuqAbnaAiEA1yXWhTLGM1QdQO/rUiBC+WJYx8smqAmQX7QxpFl645k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3441},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0","@aofl/server-environment":"^1.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.2_1518739906922_0.1078954356505526","host":"s3://npm-registry-packages"}},"1.0.0-beta.3":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.3","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.3","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"c67f4656a6e5d28f1266f6e03ffff10d2276ffb5","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.3.tgz","fileCount":4,"integrity":"sha512-jTjaAQS3MDaBi7wj1sCFUrEEARtFeNnE7WhF6ZqOyYEprrZtNc+i6Jw42QgEiJi04JKHdLI3QiU1z1C1ghwJ6g==","signatures":[{"sig":"MEQCIEnKOYLGut11TbOke0VgDgOaItIskGsbVVkT40RSS2tgAiBTHUPy5iRZDA0o6Aw53l4bPS6orC8RTdBKW2akltk9iA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3455},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.5.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0-beta.3","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.3_1520644719796_0.8756362021313482","host":"s3://npm-registry-packages"}},"1.0.0-beta.4":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.4","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.4","maintainers":[{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"},{"name":"sergolius","email":"sergolius@gmail.com"}],"dist":{"shasum":"60ef94a223a330ae564edec54da87f55299c6fa0","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.4.tgz","fileCount":4,"integrity":"sha512-FI72/EIuKHOXGmvXAo7N+i1ANT5NoDzBcP03AS+l0JJo5ac6ic7yFd9Qs3r96EsVJw9kgKQwpmqu6nJCytW/Vg==","signatures":[{"sig":"MEQCIBonsBvvkKc+ShCoFoLcMVtE1DhdIOQOK48W3BLM3hKhAiBjJkJ4R8IZCVNQyAUCzg3WMCADxk2tCsX31EsM9FugVA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3455},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.7.1","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0-beta.4","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.4_1521405545433_0.9990983882016928","host":"s3://npm-registry-packages"}},"1.0.0-beta.5":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.5","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"7baa6994c1d3402fab90166c2ab3a33710ebcf93","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.5.tgz","fileCount":4,"integrity":"sha512-mDq2fr+rhhr2qZmqe1DRHEFXt+XnpRIs1mhJTwp4wHu0TbPebgc6RHe1ADw1xffqh+xmHAtJIwYj+tFCpVfnLQ==","signatures":[{"sig":"MEQCIFmDkn10lhHO2elFbz64T1chV/O+vogXHvgUuVG3KyIrAiBi1CCUO+DOaTTn4PugGvRBmPLe1/d3Lnq34DT1h3yjFw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3518},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0-beta.4","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.5_1522287077211_0.7221236868681746","host":"s3://npm-registry-packages"}},"1.0.0-beta.6":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.6","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.6","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"898df920265b241f51d30ae7a7c7cd827eb0ef71","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.6.tgz","fileCount":4,"integrity":"sha512-r7FY6lkmx+RIErqBQk5pRrlWDuytKr43SRclC/puqLJs0gJUjUX2foYFVkZJViEmh2UmxXA/cx/lnBji0IWFbw==","signatures":[{"sig":"MEYCIQDLc+fWNix9O2VYRsF/T+hTSYpNqcZZ7nAwjWYPHpVJbQIhALYcYfbPpGktVefbsde2jlI0aE3Iz8eqDf5aDf5C+zsG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3518},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0-beta.7","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.6_1523057718720_0.18092978427587814","host":"s3://npm-registry-packages"}},"1.0.0-beta.7":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.7","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.7","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"6ff4299a3cf6ffed91be1b1d1c008cb32e8eab37","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.7.tgz","fileCount":4,"integrity":"sha512-fTEWeaSBnIImHOAnZlU91dUVTlzGZoRmg6XWC9SGwidwXtM8+XXXkY4jYJpN4e6xzkwjiq3tE0B+JTJ9g2pWSA==","signatures":[{"sig":"MEUCIQCvLp0aX9v4T5306UIh0GrUoLdvyKHpwqq814erpx8qkgIgY9et7k2JkaEfsVsRIzidGoR8Dx4C3LPLxMFrJEXO6qo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3698},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/cache-manager":"^1.0.0-beta.7","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.7_1523467221989_0.050022071375112054","host":"s3://npm-registry-packages"}},"1.0.0-beta.8":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.8","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.8","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"a1ea64e11dc5dd3cb5780eebb1e0dbad986fa694","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.8.tgz","fileCount":4,"integrity":"sha512-/D69R4y4vMHHP8TOaXINXUM669/iB8HBZ6VZ82MuOrGxUOr+igQomk6fT5783Zswte+BrXyx+ltfUwHUoyeGNw==","signatures":[{"sig":"MEUCIQDXiEnzxNEUdqiX8bbxi/cASkjKDRiwazS0/7Sn0J7DtAIgaQkMwGUjqqa8QOuqC/jUeWdbw3Le2ttCkMAKN42zsXg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4063,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa0W1GCRA9TVsSAnZWagAA4NwP/inHRvazP8+vUJaxvXun\nFkzlB1uluZNqzzV/lRhw19vu0RkZdncTPVTZfYVi8gnCbmXFljDlqA1L1Smf\nH04hSShxEGQr92yAEJzBCpNAAt8R7X5bdKL6hiiPWk3ZiOalOTkHwZTcshYC\nBtk2W+DzbJFhmTFeZW5F1e1+gHufrc1Ob6SeQuT+gMkByfKRtHXx6SXx/thv\nJVDcvRyDuVOz2aoQaUsDQhX8VTNsj/JGY0ETFzK/M9j158dX6ffFOMPgjbWL\neXgQyBg6msYx5z7WzrtbbB2pz7y8iQ2weCTttthPcpiwfw3O+geVZrTrSdZF\nVKE/HqkxHMr6dX9lHtHiccUM4I2U/IASE6S7El/TrYezg9yRd3LddbjL6N4V\nbT44PT/2ueCjOd0Nr45EYRmr/FDmwW8womiERGY91Wi6Wodpj33/df92/o4f\nmg4JJvcfDJxHEVNEFxQAToIRjvIHiuLVRLKxfcD6SqluFHvmua0pMpdMq3mW\nFbfJrJ+wF3Tsi4aNN9DrT9emO1bz2ZAZIamYaQcamwQ4EvJzdJbypBpAfRSu\nFX3adnQIT8sFIInRMtjOjFhqzfpBrpLWyWVVWzdLpADmPvoVeVt0sISqEYjF\nr2X34TQXxEA/mDnW/HS5w/vOzsTCMqoVp3QcL/9T7jSsH4YrSxDNhBALpmaO\nJqme\r\n=wQbz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.1","@aofl/cache-manager":"^1.0.0-beta.7","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.8_1523674438040_0.3854426183972848","host":"s3://npm-registry-packages"}},"1.0.0-beta.9":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.9","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"a3df5e896f178488e32ea90e30846575c483f4cd","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.9.tgz","fileCount":4,"integrity":"sha512-UF0/DdKG7n6nQ8IxGQZAHhJI/AlVZp3DIkcXfN16qmhBssrL8j+wdm3Ze+1WyoAwBupCa8fvfkC0m5qboNT77A==","signatures":[{"sig":"MEUCIGkuwxNraE/PxmX2jNf9LJum5huVh/AIMvXqXgnwt5szAiEA9F1OYGjCEP2Riw4capk2XSa2ftIkc6dw95bHhIfwFUg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa0W3JCRA9TVsSAnZWagAA7bMP/3Eij9HiGIioSw/GLsA0\nYsSMygA2UzWwedCxIkgv0qyijhSBWFBzGXdPRkmRaxR2BLfgWOVKI15tLGxz\nzPe793F6RVcilN/boB5SRZgO9xYHy89hJUdDmdjbqQXIi6x8y+ME0E2fGhri\nggv9nR5ARIRiVLEkxZAfQ+0fSp5RvVnhlT7n193DsaGa8uccraZl45DcbsIk\njSUxrQaAQmXoH6i6LN0RDhlInF2mCBkRSC6fSWksrE7vQ+mt5oeMRpzzuOK4\n33phkqXyLN+OHyeNaWPn6NizcuFxMAxan+P70dS2Y4nOiuV3p34z9Twm4abs\nDfLy3RvSmm5VFKy1NHTv8j4GiMbA/1oo3RnTP2ii9+ICztO0klPgwKsOu3kz\nMP1z/jGGTRYgYrFZzkH+vofrlrdAZbaqzx/U/yz/O8kcNYU7A1fERbwyD4Wn\nSrSGJdGCvNdGSgqztDsgGc1W4exbomBKx3vw4eV1FkeYgVwiychCGfP0RIma\nTqso8An1M8/gmFrWyHzYGHWdtSMuAmxD/Sk9gJvcgyIZPQPb19bzedFiAUB1\n+gis+56wQxfUTuT+jwNAy6iTOMxwkD3c335sxm2o4B3QHaY3UJvO8UrmtswV\nHW5z2pLDZCWZ5gEHHU6dD5GEKuPK9kbnNZNnPK9D/IQjYLV5bUS8cjCm1GNw\nFi3+\r\n=3M+d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.1","@aofl/cache-manager":"^1.0.0-beta.7","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.9_1523674568567_0.7597141650484545","host":"s3://npm-registry-packages"}},"1.0.0-beta.10":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.10","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.10","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"19a7c5686f01224a56c8aeee291e3f3bf1c5326a","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.10.tgz","fileCount":4,"integrity":"sha512-4T3BfRelxNjgiSNvo5d8qkk6vhtGdr+FA8v29TOeMPMWOW44qWjwoO0IsNZCVNGfUrhObb+h0F9kMs2GWtI1Cg==","signatures":[{"sig":"MEYCIQDdf4YZbFld8UcOGUfZqW2NkaO7qIqAf/Hp+gIk9Fin9gIhAJrXO76PRbhjVAyR0nvLPnrYBQ04G8tsSsYyA4leA0Bc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa0W6WCRA9TVsSAnZWagAAMTgP/AgsCwJlbo7DqLaBcnlz\n0Oj2VTxcQokagKT3SxmG3n5SMnvxJ8i4VcwM9ouGflHBKNUTf4Pz22G1sFkE\neAVa004Y/duFVOPV2q1f9wqq0ZS8/DZJARWgcCkQ4Z5AqT1048ZPjZxspWQt\n2i3OEflSBpCUqbXucXBJoUL4nXgi3ch0aevKaDJSjKn3ytKatRSuJRW55WTY\n3XSfO+d5ltOFGFnu5yLyikosQsmqQXK9l9XFTVJ+aTvvtjosBsKsLT9Y2UhM\nEweQIUjk2wnkomWb7G06UDwdgihDH9FAMVb6u1sVS1kxQginEXKPyRrKimbn\nZPCyEXhDBSLrEnEkvCtByDsCPZ0EF3H73INDI4/SC44q8zVvUCGdfKO/78u9\nC6ht+ZLnoDMbWjW20gKjWce8xbfGahUFc84w9cXpAzDwxZKxNxyoiGpdcpgU\noUPLLTtGhVT9nLzEY+VSjJKoa+4oKI75UdFhZty+UxV01zHSRes0pn+yJ6Ra\nfCbg/LpZ2uWGZ/aAtXinI5M4bqLno8x5EtU6fpOLjw3PdNg1axWxL4HwoU0h\n92aq7xyfXZAhMfJLZu59NJ9n3LRmsJMA0rrLraQn1cl6iOFBBV3tRFDSg12t\nWr6auWxRIlJUifkesr7WILjnnx88vi23n5leGDkTjDo69zhs5ZaEAZkDEE9+\n4+Bf\r\n=iomE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.1","@aofl/cache-manager":"^1.0.0-beta.7","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.10_1523674773690_0.18339064193052224","host":"s3://npm-registry-packages"}},"1.0.0-beta.11":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.11","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"c104f95dbfc65043d103fbb423c3042ea21a6bd5","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.11.tgz","fileCount":4,"integrity":"sha512-HxauMKs0aW1q6F7jR/mxu1XT+3avYBGn2sBZd9qdnXqiIY5tPbh5E/riao2A/g2zmDJssLiSMJnot/QKHTW2xA==","signatures":[{"sig":"MEQCIG6cqDmyGeekzl8stfRuW9O9pWWQZ76/47OJX0DzV8UIAiAKp326slixzaPbFdBN/ycG+5oBXwdyxChLwcPQ8rJzjg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa4nldCRA9TVsSAnZWagAAFooQAJ2M+h4n+UJF1tfGFrRM\n/Y4xBHhPEEQyxcLEocl27+hPEz1J9K01xLpfrfyR3clEiF/JFmJ5knxzGUXL\nvYnA0rumme33JqtUTTrStJEKznC1FG2uA/iLS7IWnHSkEK+Jj4+k7fLhczzL\nBp4Q4SikwSx25h+Iv8xycAlzhZxp0e0GFzNSOfOXdDKP1KVfZoGmYm/l+h0K\n58he1v5jcw3jlQrStMwzDGWFMxZeG32y/s7QWEs1sMtW6bQB+/LqH9J8UbY+\nRALhoAgJCN5JgYCSxH0e0oQr4FYfIudaHqEjqBDnfP/fjV5F/Tl4qPxzLvmL\n0Idz6A2+HD2EPqx0rSvFY06id4ZWDOIbiJKN+BMTbNy4udP3/hMb2aR857Ow\nMPe2WrXd38sU9IIg33InynibccpNKXTVEzMKUT62cUfZQ/iV54uYvRtdgKlH\n9kqBOc8ssxkj+Aa/yv/slI2wmnNl5rmA+BM4EjmjmjtwWiI+Fr/HszFpRwM+\nehqsCT4kr1Fs1uSoPtJfLAE4wqq8nwOLdx6zsHcrJM6SPHBZ7E0+/48lJcpn\nRqkaDRVORemHMsbU+CE4DsG/eZty2pfNGjfrVlbK7dJLAjSsgqx4RbpMYwLi\nAZFMXvr2WTj7qSnVj7hqt87h2Vzqd6elVoEPPwf4uTEt7B76fbagp33zZ37E\nyC5g\r\n=k9ZP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"5.8.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.1","@aofl/cache-manager":"^1.0.0-beta.8","@aofl/server-environment":"^1.0.0-beta.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.11_1524791645108_0.52472454493048","host":"s3://npm-registry-packages"}},"1.0.0-beta.20":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.20","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"ISC","_id":"@aofl/resource-enumerate@1.0.0-beta.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"8559be4af2669322fd45b8d3eea8dee5115fd037","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.20.tgz","fileCount":4,"integrity":"sha512-sqGV9m40mvDrhPXgIbFx2sbpTa8DxvQTjwssVkXqgESDVI3/XiD3cx/0UKyOjBXJnLa3IUjw/8idnnOcZg4Htw==","signatures":[{"sig":"MEUCIQCiqsVtNjkjFxyOUzHAOFN8wbGp5gaNsxeFGB2rwZHrpwIgRLI94nSWT1rBM3QT809rihcEYWNNLb884acqOsb9pIo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbV8D/CRA9TVsSAnZWagAAHU8P/juf+7TR+JMivGHnODYa\n750oCaZsF27k9JMm86oI94YUjbp/rh3JicKTxnHiS00eFpw8z56sVSzo5AC3\nvd91AqVKP9t03MWvo+gKQp6YwUxG8QNNvQ7/Dx3obcNwXokX6lNwdMObeerO\n219p3NevwUDjHhx8oG8h2pPvJGownuVl2CnYDP/CnfYfx6QUnOO6WdMoPoF1\ntLkaW0an47e+jT78sb25CErABLKqX4Ot6qJLWFCHVlgNUqhnU0tkVjjMdSg4\ndCoRX/eRnfw9bFOouGXxqoXZcOccJlB3G2XByY9WCxzbyw7SoLJiPgqDwxEc\n8RzeKJ49lgYw/hrOojUig05+w95NAelunvdWntKeDEjYYiZ7S22HzxDDgGrO\nxI7K5j3vEB/Bsrhx+VmdJq7oeMIL7nNOo9g9RMloDYVnRmQ7oaQugq/hMzKv\n7jZiZtTqXaU6lKc5OdgkUm5Tu2QmIeXK/rLRBkNpniOn0IRVJ61B84NQFsn3\nrUeEE/nrXvLyWjYsj6Y7AfXh3iPAfhau4uR5E/9bYjXtovqH2E7SN0GGdMnP\n/SOthRlOHNtRWxQe+/zPB2pwyf+C3Rm7KaHlbas4w0duvn9qsJPBHAEKNdSV\nWImjn+CvnZtPhhKQf2BiF5dgSzR9VjWm8IjbSRrR1ZqO/eUV4/NOMVoTPmhM\nfMK+\r\n=2DAk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/middleware":"^1.0.0-beta.20","@aofl/cache-manager":"^1.0.0-beta.20","@aofl/server-environment":"^1.0.0-beta.20"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.20_1532477695503_0.019369618380565612","host":"s3://npm-registry-packages"}},"1.0.0-beta.21":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.21","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"9e5b9032b8a3d5aa1b4c75e468ef218ccfa1c28a","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.21.tgz","fileCount":4,"integrity":"sha512-K3vUnSQWYvs7WRbttnhuMcMEcfEQoaHjf4FlLKDhgwdlUNOH1IgexUjZJLzSQ1b/RDwAGoHmtxQjzm7lMVrgdg==","signatures":[{"sig":"MEQCICvnzEch5KPHAUm0nnZhb0WYnGCJ8fSoEIEGzx/WTc/3AiBX68GkxUtu2LkH3j72i4jAIe6eS901s/Y0eLZbRnHiJQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbZqrECRA9TVsSAnZWagAAAvcP/i5lJNI3+K3a98WChs/e\n2YBSvUfiMiHzSS85KcKTSZrQsg+FRzKiomNvrCZFqTTZE9vXQbPx0W22K09v\nR3vWP5GeX1wNlnnoliYvjIEq7ZNO2Q3kG2M8m2cefCvAIvdhAwshv0sCQdzO\n1HbdCNvCjGJc51hCpQCp+MuE0o4bzqfEVoOg3ZWNkhsYxNHtlSthMpGja6VB\n9fOuS93sD2vAK4iIoI7qyLlxbgSbsYmTdN+ZDHeWVle50ZTwFaZUVNXs/f4g\nyFZwHiF3UC5AN18282GZDQPUwIAFnoX+FHaodJvhKQsYGDKfisbPlf59/dpc\n1KBcL2ZrdSlG5XaHRJ2vnobBbdCyop3MXdoUacVF7Zue2jmP2ugYDFVPx/Q4\nmjnBeDtCWWsah5wiwVsyJ/flRCk0KIcE1DoegMMLXf0yhroBoXcr8527gSj9\nsCX3Muf48AcCIKQpj8W54LGStGFJ6IFRw3ew+/1sKYw8xdEMifyuXoq/zBu7\n/rRzkQ5pZKqbG9qwT3LfBd6kIRVVA0L/HGE3LhUvcyxETddU0IaLw3TuWhbQ\neMXKt8fILryVOy+AUnVV3jo8X0Rrxbp2kO1SBeNnN7ZxUcYBKkSAwaKD1pBD\nAHktZF5mF50waVrKZXEzo/CRzFza+XFPlazM0mRn/GJrzOZTQUCrPklv/T5Q\nOp7W\r\n=G2z9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.21","@aofl/cache-manager":"^1.0.0-beta.21","@aofl/server-environment":"^1.0.0-beta.21"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.21_1533455044271_0.6427981311534623","host":"s3://npm-registry-packages"}},"1.0.0-beta.22":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.22","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"c4dbea51cf6c4fd27d64c1f0f3ccc770f40419c9","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.22.tgz","fileCount":4,"integrity":"sha512-bWwZs0T08JM2YRFj7aOfGz2zj7l/ba+G5F3fgkMcuDgTbeSeimwigDH+1eV73Sg8zdqDwObdqbr1R//+601i8g==","signatures":[{"sig":"MEQCIDsv+vCUjAOHCoD8WpgNtuL7H++ZS/3wJG2vqMhkc9VUAiBkeAR1igtqWF9IHKFd/YuyKxinSR+e6W0iSrYNImqVDw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbecyCRA9TVsSAnZWagAAhsYP/iywNibNwQyG+LpZ1s+U\nY1XlGuOubYFUEuisij5KRgN19Ki5yFu6YpH5FUF/WyxYOwsga/CtXZMMYfha\nvEUn8Cuo5PodHiTt5TfxsOjCI1AxffDmOR1/YTwdWEb0dfDfpWbcjxI6y+pz\nhfhDOzEjaq0CEk1KJOwQS6lW/RZ43JE53V0w3ZeqLYkHUNwaj6hCG/x/7Cyk\npdGB5gTKwHu7WkkldxfTvpJheloJAauPhD6/mS8Cr7OcfsDfqMwnTNxKbGhn\nqp5OC8SzZoHOt7h+8lFiCznCEFPMUe752Vu7tH4OMfUj08Iw5CQ+SGxURowN\nWljirZZ8Ul6FYUHmU5+mYeQ9fArix/N+rbYJZXCVaiutxX3BBP9G6SkZPnUK\nrvXszV7PAogbal4Z8qsNLY/XTq4txj08RnF+fshAeXSYJs4N76bKlIvwSbYb\nBGeFgm5cOWYiLgDTA9+YF5BZ1CSYzGVAlcZcHs1VE5JLBpnOybtk3jMwPpJ/\nE1/gj62ZBxqtFwsJdsocI4+pOHZAgQCxHNfUMBvxk3SJQEGMPeOXB816RNcT\nv4P8xiFtrRi7mJkXbR4wI1JmGPjRLwfdTVQlpqgFQVU+RRdR6UWdap3ISh1B\nBjZQIi7LH//Ot5LPA/fKu8VUbQD99xK5df+cL/439BOcaDt3AtQOW1hTYu5Z\nQw7Q\r\n=bhZw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.9.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.22","@aofl/cache-manager":"^1.0.0-beta.22","@aofl/server-environment":"^1.0.0-beta.22"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.22_1533929265680_0.526622089512431","host":"s3://npm-registry-packages"}},"1.0.0-beta.23":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.23","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.23","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"d2537bc8353139ba1466d5bfb9124f1df8a6436d","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.23.tgz","fileCount":4,"integrity":"sha512-XN2QH8lhCHsSgCFol0eBpCe5WXvjdXupn455qULNnHfcMEz464i7vbynjwLHK/348zEVTs931ZqFXm1fzuItOg==","signatures":[{"sig":"MEUCIF3oM0cmq6zGc1gSFKwegvHip2FjJbeP7N/W1RTxfuDcAiEAnHv40J7wvy6Bciy8eHtf4VWKCSO5Qton07sCsrQD2yQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbde/wCRA9TVsSAnZWagAA7moQAI7Y80ApHyn9kfSYuTEV\n60Nyzg1fHdM+0oGTaqeG2uusvVEn9ntswmSGZ3n4yXJGoQuIsFC7KczqWT/I\nWp39IO5tdg4sHTMKYt6YzlAvYlpnP7Fn7Fd2OgYRQ7WjzbWyIiTO0VINwrap\nqrFdr/jF4Ek25ybdpM2sZBvJSgUY1hT+OpQza8KxwEoW5RCcz8M9Qoi/C4XJ\na3A4UMDkXh55pBXF0D6tDj4ftz/mw0UliDtZNBkrxuDUrfJjwLvAytCIXZVk\nbt8xSCxXyLZJ8Vmq3l2S9O2bNSeKVE7IPZ+V5+zK8T5LLomTD2m8Z2A4Y2OU\nLjm6ghWZw/94b8hqFmH+7HpynS8I1gYOxeZxYbWK3Buot8G5sRVJ6TFnCRBp\nw6FapXqeeTBFvFgpsdK3675v993jypzqDYWfAL+C2Dsk2gprh5ArtuFoItjg\nmh5z4wCDCAC5l6FPuJfDhDrXLmUEDE/ydPnzTu8WGNYvU3EcEjLsWc70lx2z\nDd1df7oGBFSkM2gLR4mckaBJX/NeL2PwND2PPuPSyw4XhFwhH8WFrzTa/4Ws\nf8sxSw5+LTnkirIamgvdKEF92FHB+WGDZiJW4Qrp2colsa4js8vlIl84xBOF\n2VeidxKnGpePpKzc0FRRPAyKHwsWUlJgyYpDLWYcuuIg6k/ODI5Au8Nnk3Wg\nBrKd\r\n=qaA7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.2.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/middleware":"^1.0.0-beta.23","@aofl/cache-manager":"^1.0.0-beta.23","@aofl/server-environment":"^1.0.0-beta.22"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.23_1534455791803_0.5006966143549072","host":"s3://npm-registry-packages"}},"1.0.0-beta.24":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.24","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.24","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"351717c165b69522582dc2b35882efa60aa7ccd6","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.24.tgz","fileCount":4,"integrity":"sha512-AzRkH7NLZVZB1GmXzX6108jcaVdnZMQDde1IQWRSiLRGks6BQ2GsNk4O4xLMhhnFN3xQ8QsBRO5cZURx7SwTrw==","signatures":[{"sig":"MEQCIFFkAt1BXFGMrk/TOcpEaOVG1YbEkt2p4bPprT7zQbtYAiBvrn/nwMHq8D086WM1q5dT5NOSpmkMnXXO97ZDIe7B+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfeTpCRA9TVsSAnZWagAATwQP/At6TE9DkYPDxDJYLH3K\nq11w2R3hePuEEULbf677fMFiBVTgO122bn3k0pPPopl2FS/6AFSRyZs6BdIx\nzTOW6I/HTLGiN0TscZFRyPnT2fhi2tUZfnNUYIEpqwEuirOzBG7+8Zeg4eeY\nulXS+9DcTy0PbhcajNFsOIFF3MndDsGXtbQXf7kthdGJRJeopCrE5GDktMm3\nWVWDaMxUPGu/aNelFpgHwwjvmxE1ofxshsC774z579KoVJ4r9Eul7LC0pMJk\nSutDAi45Ibk6wjEjxN8T3qzkzZLlxchOytSyIYHHJl6Of0gskr4EajiuNI9u\ngASuWMUOKoD1T0MJQt6Njjpc9I4qKJbU57kHhtif1J5V96qlYrs2+RAOneuD\nKNZynY2C5vVX3N1IloBpk/5cmCdioVR62BkADmuzAAF6Bfw7Pw9AB01Mm82c\nvpAwhPpcnhRf6UYZfLa2pPOcR/j74hTCizn4Cx5aRuMTki8RY0Jo7mD9jZj3\nuwgJvSMXuHhkZKhnLVdf5hGqWUbiaFI/OEVn/DmPr42N6687GsQhJayqj31e\n46llobeWekrPP1cvumpcpj0BRfYa+6pi1AUFaiBYWnoCGzW8MoQf/5Ar3jw2\n2TFwyGDwYbQ66+QYJWEw8CT7d3kfV2tFOyiDK813/vrlM1K+dunoE070cnhm\nCZ+l\r\n=RoSI\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/middleware":"^1.0.0-beta.24","@aofl/cache-manager":"^1.0.0-beta.24","@aofl/server-environment":"^1.0.0-beta.24"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.24_1534977256752_0.7360258532063524","host":"s3://npm-registry-packages"}},"1.0.0-beta.25":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.25","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.25","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"dist":{"shasum":"695122017da1b096941b2bd75d545b078c6562fe","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.25.tgz","fileCount":4,"integrity":"sha512-QfcklyGrTiauVkFQhb6PAh17KX6dnuPVgd9YYGu7zgjD9ME2UXq2OvXAg6wXkzRv1hCSKHFTSwtN2jZXyJWIVQ==","signatures":[{"sig":"MEUCIQDMWwPNnRJVwETnZeDLiadU3tUYf9IoRID4h3y7PIQIigIgQNnxzRqLSIHPsTOX5CvSyrf/4hLLVFaN435KEb/sRzE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4050,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbfwtQCRA9TVsSAnZWagAApukP/Aup8kx/jGQwCtwhNPZ2\nSv/kMBec995R5FpUl2dvx7phcNMpu+gF3gvthjXq0IMqDMUkf2NrdUTgW4NF\nTUgUUnXfEqPwq/l8zoo4tPLpvH714V9kAo7TXSYewxQq4tOQBcXHIOL+z6Aq\n8mqbsDckDuH3SLSuzi8keLSkX++wZJscnOPWyA1RbcwxHLX5ji/F9JYIbTDo\nZMki1rSCqIQ1XW9gRAE8mkiGqODGSwafI53QkmZ95UgZqiIB1f6UgzWYyT/d\nmI3fbbnwc4WFVD4tpkJhjM3s25CnWcxnRts2SqHnZGTxjArb84Dm2TaawpMW\njUcH/1PKoRXkIQV65AjgJC4m1lJ/4hKL/buym1nossZe1uMRkVmTn7GeqyoP\nKeJzeGaKELJ0mFN88kuDKmo16Z2hd7Y9bye03e8XRWVQIhNiesm4FmWx2bXe\nIleVyjwdgGSlPhLdzyJ73CMz99ggHBwhujWHWL+NCIqc/fY/BIguTQEcL+e/\nJzUIiYUPg06fPPLslif4umIR+ig31ACUMwqP/SVvndcoFZ50GY2ErPz4oiNJ\nETk+OR/1MNOQ3TdmZdmzhi2Pkq0Pc2eP4XReJlG4CRQQGCvD1Hr4XyAmm73O\nsmQXT6588Pnbs5eh7Ik54A+mwrc/4LBgqWyt0I7ZiosIk56voC41fRQeB8+6\nuJpW\r\n=3Kz3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@gitlab.aofl.com:CoreJS/aofl-os.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/middleware":"^1.0.0-beta.25","@aofl/cache-manager":"^1.0.0-beta.25","@aofl/server-environment":"^1.0.0-beta.25"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.25_1535052624124_0.1909476903540368","host":"s3://npm-registry-packages"}},"1.0.0-beta.26":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.26","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.26","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c83d819c029c749deb3f82316dfe2251eb74fe66","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.26.tgz","fileCount":4,"integrity":"sha512-je9fVK9+F06gkV2lbfo3ArDfYSPW9dLfFR+7ycwtbfohApS2+ODvfYzoMoeqFqtQJBDsT0/SPMm4pHo17VgRAw==","signatures":[{"sig":"MEQCIFu+ydhaXN7Ag4t4JYDgDQhVH2Lkuty6EGBBPmMCGEZqAiAQT+BOP0U7uVN03NXe2aOvOg8r923my+71dLxssWLUBw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4049,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhEKzCRA9TVsSAnZWagAAjrUQAIS0BXDmelHr9zzspr/t\nnvsWdF0E4wGvoETRdJJBPlqnSfkQHGKdHZ9nWk6EQoNUOyqR/XOiiWWVqVPk\n3hS5ViTcsTY3MtEQq+KZU7D1JJHI2i0eTbbpZEiFqgdFLKJ8KogbkSCkvIyO\nRWT7fXnojkJrgJy9bOhdkRFZSRh+Q5B73kZFrnazzHQV+jgNmak6g32wW4DB\nXOZ2lRTLCCR5XwzRPnume96oIFFxNxQAq4rx7b4cKm+HR8oTLcZ9A4DdSr08\nxgwj8dk5qnByCuPgamfWj+MtUwcHReWYNX2TXRqE+eIXQfUHScxGtiRqyvyF\n1AbCe9AKWd6ozNt6P1stwVlmwuiPT18aUJcMg82vXoCbWkekWlCkfsgKUsyF\nHEeYqYXMqMujHUgbP9HiCVSMyzLX9tjoMCYGWXX/Ga36CLepUJd5aLjWafkO\n5e2tTLTLDfbTuyWdG2Oghsc7HC2Rp4yU+qh6QjlndRvlbsfnil/ZaW0Y6hnb\nKQ6nIcpc6lLt7vDzo07qafekaBEqwNamNzply/SAekK02vWYGY5FqzlmAaFs\nAzaZplP/iwYhgXY3XYB11K7X83SPLMN66bb1/TMgjG+AyRybVnqWV79SZpAb\nUq82+2FvpOoCBHlHnStbZnkzqgfwa6qFh+0YFkrYO+qLWTP4545o5LgzqF3/\nHcO8\r\n=yhdE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/middleware":"^1.0.0-beta.26","@aofl/cache-manager":"^1.0.0-beta.26","@aofl/server-environment":"^1.0.0-beta.26"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.26_1535394479574_0.8379080187120957","host":"s3://npm-registry-packages"}},"1.0.0-beta.27":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.27","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.27","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"3c2ed24d44b04cacc285868c59b2a88fc59f7d83","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.27.tgz","fileCount":4,"integrity":"sha512-3q6o3/MiRSaeTtmlq6cU68Pl/wqmNlj/So8NJunbBWYHquuKA6zTnY59mOrzaF6uff9HcUct52BxsOrLd5ncWw==","signatures":[{"sig":"MEYCIQCG1wwhwxdtGbLYZWm69bviuZhLEQFrjfk9gdY02T9QRAIhANibqJrnjACFewmZ+o5RAuqoKjcc3KNER1eM+QlKDxqq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4049,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmATGCRA9TVsSAnZWagAAZXsQAJTEej5kkdXJYjX8vKSv\nglgPB7ppkk/4aOaKokTKQzj1yl3ahK6a+GhaLQXcsWRg+g3wVIRv8t0jCMUH\nxDY9utekgIcPNw52CthXkbXViNhgRWPIiW6ehMcxDE6O1HUHcT5SvXpGpBuG\noVJ7ceFlyMJsGdaST+CMsVBTZGq4EJbrk7PO/LtfYhDR50nDpGrZ6FdAIpHJ\nG9P9qH/kEaQgTAskSf7/dBlK9V80Vb5QoP4o6HnljVx3ykYcVc9V5JzFuVDq\nJhccz5KTXHdjkk1ALoHP+h/wPy9fZxr7O36Jnhm7RbboJttFEvoiQ8EFAZIx\ntVbtobCaGMP82cPizAvDNEZqUK2WU142+wqoxPhFrDHaPKB5hX8SzEPxKN7H\nhm5mGdyddNALEMgwVMNmei9BmruR42G4ZYf/6bBzACiUmyBdwRKd5lIs2IWT\nJs1zocmDMT/A0lkYeVLReUSra/Qkj3RgeDtAfyJrQqO7PRm0Z7yZIH20MmZN\nQ9W4EU6cQC0H0TXTDebEuukZDX2NwBywW07PlIDt/mKOQ2rvNcp3enG5QIBg\nMkVPCybNR2NF8TJUzgl/lTTtR/cSfFyTdMgxBBMYoHwsZEBHBE5wmqHKqf7b\na6tW8HOwRucEFW4Zl6ba+VYkYtVdE3bkjl4qu95DDK7Pj1Lzc2suXQrFnaqu\nQhev\r\n=17OF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"ERROR: No README data found!","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.0","description":"","directories":{},"_nodeVersion":"8.11.3","dependencies":{"@aofl/middleware":"^1.0.0-beta.27","@aofl/cache-manager":"^1.0.0-beta.27","@aofl/server-environment":"^1.0.0-beta.27"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.27_1536689349432_0.19585267972169773","host":"s3://npm-registry-packages"}},"1.0.0-beta.28":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.28","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.28","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"362e32f3dbf40f1f7438c8b654d729f3974dbc5c","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.28.tgz","fileCount":97,"integrity":"sha512-ZNIig439t0QoSXrgQAJYoFvYLE3mit/54UOdu60Dob6TTnpuCGktvBLVLqUI9qQPC9kQ6bAp1FWHM/3jG5rPXA==","signatures":[{"sig":"MEYCIQCwPQmzbxt1M//wsCH0lqgJsewIGF8BC+JcK5RYtvJnTQIhAJI8o6cFYM0T4G/QdBYc8FTTtjwapVZ65pNZ4Ydrnmxv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":423823,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbrXd/CRA9TVsSAnZWagAA8dwP/1H2wAs6Oq2khT/KLskq\nfJ5CmHi1Y2V2eBsvmVAJnlIys5L3OadhkqP5SbcqrrxwPiE4wB//1LCAgezs\ni3hLqJ+sl+6MNI0mOG4D5DDveguJjhiweH6BTZw9isKJ+KQay6mn4zWb9yVy\ndYhi0aUK6UXvTqRgK9U1Zyq8WjJAiTbk0E74XwcuHPaMaO0H1ghGYy0DY9L8\nU0YuGJJfUPPFEYntq83ftcknsmB+73A5dLbDXbHGO0Fm+cQe6v+sf+/99D2d\n8QAktAd393djC3rOVfajNxZORDsyKDsUmQHY8J4HMBa0I6VxWsF0gpKnw46e\nFK5XYU8/yVc6VHhvsZpnVplYt/b6oINumqgSWf9gORVKXkgqJ0h8nGAGZlzo\nj6xgV31UBXIJhJEe2PEb2xD6aY3YGhwlYp5Cc1jrNhYqWkoIE0UDlT5+2PQ5\nh0q311P/X/pxRhHWr4Xt92r1qzEkx5DBJDK36Wt6oToERg0C7BmtjNJaoWWD\nlDdG+brDOPtePcQr4FPCpS5oIxubwukuWdZtrS+oR506ineGl/AW+tafhEIO\nk3f5GuqmogUduKxUCsQHh5MmhDfF7Zik+crscSBbdkw+3Eq2sz6+AA92tTWd\nBYWvcGzA2sALr8TcMRfygWQRdCzkCgniblTJZXtljacNNy4ovww92NBZxWsu\nUiTj\r\n=YHVx\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths\\urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server. It also accepts regexes to determine development or stage environments based on the url.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n### Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n### Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentRegex: /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/, // localhost or all private ips\n  stageRegex: /^stage\\./, // match url starting with \"stage.\"\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\n\nconst resourceEnumerate = new ResourceEnumerate();\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance.request(resourceEnumeratePayload.api_urs + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.28","@aofl/api-request":"^1.0.0-beta.28.1","@aofl/cache-manager":"^1.0.0-beta.28","@aofl/server-environment":"^1.0.0-beta.28"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.28_1538094973559_0.7316725392930965","host":"s3://npm-registry-packages"}},"1.0.0-beta.29-dev.1":{"name":"@aofl/resource-enumerate","version":"1.0.0-beta.29-dev.1","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.0-beta.29-dev.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fa3b44aeab6776fed57094db3b906e5732ade0c2","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.0-beta.29-dev.1.tgz","fileCount":97,"integrity":"sha512-rqYO66kq4yJkvWaztIRlsxdLjVWJBubkS8PqTlg8R3NDrItD0AMbFp4bC5tTQNOfwXFlH+2qdKzFQ7s4lvn6NA==","signatures":[{"sig":"MEYCIQDT2imsyER6/eUyylzUFvddzNOJMHNhT6gPyEWImN6IVAIhALm8wZh3vsGKFHnd4zd8Kr3+7HuOQqmYiNYpBaMg1XCT","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":424182,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbrmY2CRA9TVsSAnZWagAAmh4P/2rxjzqdJ5eXQe29bDnb\ncfykyJdB16dKYteCd/QDcmXeZ5/aj82WGkvzLfvE9VTYh3+Mx4g8yIlUG62S\n0xDj9A8FZdPqY19h2bMaJaxp10k9pfhK4jVgXmZiYZ1GQqESNjAlyo9QykTZ\nl3ou7CzHudI7YEUE7ybgETa15JGAnll7QwkSw6RubQ4o1hMCsTylkbe85dzp\nk10GGUXDBiJu3II0Rx61VXPKcpMfisLD4ya+nzSr0XWzyDM3kOUuDrbUUK4o\nvKh7F9oNaOoAXi4jwhPbhGzWEJUk5aeG85jFA8nmkF117Pc3erWdAPMqurwK\n2fkQXt3DR6SoDmhaY3ZjF161YoxCtQtccc8mYqff7J2VNUYcM87dKKmnLAXA\nnythPyO8k0nH0IywFNUiBJ4GHDgRMogVGq3vY7af3TBX7iuoTc8qiZ3gkucK\nsUDB/HQXj/g0Iv8IrIumz5nWxGkg8cwU6z5ebXdbi9Ic6iTcCB3u+DS+vlQ1\nmJMC9DLCrpDnzDGeX5hFmDgHo6odq1hz+Fce12QYBzK0HTovoV1puES7CCOh\nIzE2lql9Uq9AVSnvSqj70iRQ96sKTtM2EDZfhBa805wz9nI7v/hTraaTMyHA\ngme++zwpNDOaW9ZdxWn2btyeqdN9S3EVyLyvlBDoI8yeq6SShU8nDL+gDy4K\nwcdA\r\n=Sj3a\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths\\urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n### Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n### Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance.request(resourceEnumeratePayload.api_urs + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.0.0-beta.28","@aofl/api-request":"^1.0.0-beta.28.1","@aofl/cache-manager":"^1.0.0-beta.28","@aofl/server-environment":"^1.0.0-beta.28"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.0-beta.29-dev.1_1538156085810_0.7443892816926247","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@aofl/resource-enumerate","version":"1.0.1","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.0.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2ef313755e0640f09da736c7a6d38b3c7c81e84a","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.0.1.tgz","fileCount":5,"integrity":"sha512-U8eLQ3G3b3UIRSMJj+BdusVTk9qBks4Jc67v1bm6nb0E91tmvmeCCtl3LNfwyl2vwLV6J2mKH3cvzwHOEtFl7g==","signatures":[{"sig":"MEYCIQDpe+FyLogY2gyuaDZelYtH829Hhi/KrrDSqb/4rj8f7gIhAMeHGfC1+QGvYJrfJSsyR5VvV4ji28t3fgMZs+x8P2j4","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14495,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsAa/CRA9TVsSAnZWagAAWckQAJiYQeHEkbskk5NyPYKu\nQqZ1/6JvUT+uJXmFtQCOSRvGbA1CJAJ3IW63eu6+UZbyu3VOfdycx7eHByM+\n9pDPcDazxwfRa/g1HZGOfFSbcvtu95gztsJvL7608wTVxB5mehbmoR+l5/pe\no+n9Ani129GIIfbqisusppFVPuU7tBACg+eYvEo/0yIUc7E2EFszdg8ckwhU\nGYKEd1jfDl5AHabe60SVvwwDLVSUhdSNfbpTxXhWcnGjs88JDdrUL8Qr6uq3\nvzPg5shx6judDlstkNZbKBqorbvDLTzkCtXqER9gUeLj6w9ZojLVPkIvnr8A\nCuFw5my3THkSfLlGduFR4E1hBRFBMBu4tXFH6E4Ag7J9/gwbNpXIK+nhtWXa\npEkexsTTHZ17B69McVKeqHG1WnSObv5+86gR0e2nxLol+RW5AXZEMdUTNvKm\nfi3TPQ0OD5FcBLrcJDuyhjzCJe2SZQKmQLK6AEhD5Bc0dH4Qok8Sxk+Ry4Y2\nakDl9pcfyK517gkU22mSAIKDPE5kRMqzbqZgH0aMcCHzy6XzNgZPUoD8Qgrf\n77XkxGdL4axfWqBsMzC5SaYinB5R1Hqma/KvjHHzIx6enkCHp8Yi/oF3DD4O\n5HiHNL/Ojjn0E12fqaRZROjC2YNnSHYLW7/zCblzj+cFb4fE6zJzuiqEOtd5\nFjXG\r\n=cvZA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.0.0","@aofl/api-request":"^1.0.1","@aofl/cache-manager":"^1.0.1","@aofl/server-environment":"^1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.0.1_1538262718678_0.3698942891419852","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@aofl/resource-enumerate","version":"1.1.0","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.1.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9b98ee803546da7adb632112b0f9757bede601df","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.1.0.tgz","fileCount":5,"integrity":"sha512-vHdAOqETI3NT9X6kmrLtFXOIqQfW6MEmtzx0Z/7XUYF/lvSTDg5FHRwdDET0dzK8dhhz016V6tqJj0YoJGeNJQ==","signatures":[{"sig":"MEUCIQD1ghN6DH6FgYupuSya9wzF2XLf7KhAhq0UB+p5UvAfwAIgKGVLko6CPQA6MxKhXV6ib4px+5kdnnu6SuGUU6mSr3Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14905,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbx7jfCRA9TVsSAnZWagAAQUQP/2Uiq0HOkXjU9Owy7C/6\nqJrWO03Dy3bQCB50V/69ddiurTKRhoZKL0hlDM6iFMlmM5ddi77BLDcyl6Kw\nCIn5wxMKJ9/1c4b5KvPnSR9ym/QsYwA5wb+7qDHoX1iMXYDFsFZLbP3QtxQj\n6Fa326YlAd/Xdyx255aU+TzaOwX2js3fW9hFOE+9lX/K5p5CrXdJ3R4Aer/d\nX4bLKzD3y0j9yAfE3pV+3QVi5EYFBFmXs8yzTCb6vktLDrLtEUNGHDDIwvrL\nOSoDsc8yjl6LDZebyRXCfIS0PzPPd9PNK+fFd+byp9oj8sEMNDfMr7FcpV42\nSsNezjnnnsg5f4cZoJZXoTKpP1OH1OxVCHoOy1PGFfC7KcRfEViRhe74QvRM\nyStgpkjdsCpz20aIKduu6jHSvkgboRISqmFje0XDCCriwlZB1W+18d77h9j3\nl1/r3AhQj79vQCVT60qWqYXm5ELZhQWhfd0u3WJnOjm/cTOWbqYsu4sHiGaR\nqh6wBoXiB9nRd0FaIuh6aL/QWPxVcdtnPUxtDbWKtB40y+2VerECZVrmfyCz\nQQWGfaNYZq1VPGhIH9IxBmobZKwdpXgJpWU7ZGewfcfxhv8LT0TgjPfWuJus\nmIjRUmPmHEI4le25jkzbIgklYOMgMkmLtO8wzgZScINeA/NK+b5J6KDzFP+H\nX1Bo\r\n=L8Xk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.1.0","@aofl/api-request":"^1.1.0","@aofl/cache-manager":"^1.1.0","@aofl/server-environment":"^1.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.1.0_1539815646383_0.24256652128587186","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@aofl/resource-enumerate","version":"1.1.1","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.1.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d1272f9b7f579d8e0b314ce6045069a428565661","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.1.1.tgz","fileCount":5,"integrity":"sha512-0g5d9eRkEi8AB4gmIun3ZDxTIcQbAJWe3u7M2KxxI2D73r99qhd1HRBcYxanfkxlkZHK066GRZhbSWP/YKA5hA==","signatures":[{"sig":"MEUCIC+O3qS4bCe+lFUNLp4OZv66mNKG9W8knswc1aYVEPyrAiEAlAoBjhHBv6mjhE/sHLCAU+LYWZZiQlq6V5UDOsUSTkQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14907,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb12J/CRA9TVsSAnZWagAAjq8P/AvPqEOIjrOGADrpMY6b\nP9IwS0qs9Wcg6VpsnY1ngjLAHxu0Ayw3qZ0T2WJfRD2Qma6MT+1cltMh5Dlm\nylNWNel/0LE4pnyVz5WCCe0XR0h8eJUKb8TYJctCoz0y5nvBxwLszWFv8HHY\nmiGnX3aAEGV5E1vZf4OTQdA6HwPqNAHi9BRxTUv5uE7x8LVc+zixDaADG015\nPI7bCcDARDmM0tcR7fO36H7DKB99hzGbSyMErABLej770X73AWuJzA2N37Z+\nyglTcHpmYcPpeakgIaTofYns5JcCdfTzkUsj1JPYsuyvjG1+0LgaX59YcDjp\nR/yr6jN+CSx7ScSaSEYWg9mC3VlcnFytxHa6JOdjqSL8dMqKIf5bO0GB6nj+\nU5WT/FSruXoxX5u/ccE/b9/nk7IhAwe3vl+CaXMDsXOn8NZuj4gYdbQMOj4t\nfUs6mrEAMzOzPmw9vxnq4Ky23BvGaUoFhyagtIMrn/muQj0lnEi2RSIQkrGF\nqbb96oFsQjz/WuxefIisal1vPMEbc6LMHIGJDnbpnSc50JgFv69UsEL67t9x\nvMSklD/WlHf5eK8/H0HQSr6olnN89tLpp12W1qQoF+1cRlAs4OAYstqlNIWB\n6Xg7GaKJSHZl61nnzatdLbvakHCfi8r98muPBKwHpyrfUj7kr0VZeHxlkXE8\n4Jxi\r\n=BH1Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.1.2","@aofl/api-request":"^1.1.2","@aofl/cache-manager":"^1.1.2","@aofl/server-environment":"^1.1.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.1.1_1540842110952_0.011884216981991713","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"@aofl/resource-enumerate","version":"1.1.2","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.1.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7a4d3447028a216c76e1cf9c006d48f04d6078f7","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.1.2.tgz","fileCount":5,"integrity":"sha512-IQcYp9ZzkqJzYMkh3Z2qXeGirpk7PqRk+M4I8FYkq2umHg84Mq/8Vf4w6PPw/iA/PRt7Zw7+zbq2aP3sze+RRg==","signatures":[{"sig":"MEQCIC7l2mtWDk6eVhRDYFJPtRXn6Ib0OZFC3yKtJTcU1fZlAiA2lQrGTV59JXmRqKgk1UcY/5S9RuLK9i/uOpUhisYoGA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14907,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb12KICRA9TVsSAnZWagAAfXoQAJ+IRiB8Eo1rNV2rzAv1\nLscF7ppjACeLrtaytvvMU8b4V0WG5teKjY9yT40T++kZ+8rr0kxvuaQB9LVZ\nMaDOqh6OWuVLp+y+tD7mvAgVtiowKh9BOam6RSS5SNWR1t+hOKIDjArawyQH\nm+x3tuwUSlPH/1XRBRheMmZAOlu06D4xUkDHXwOz9ksx7V5AiFrGrASjR/dF\n/lMMvE2OdBrrxnz+aBI6uXM8UyIIjWVXRdcmRDDjAalGnrjtyBdh9U8pBoAw\nhNWENBgnvjU8uAOU+B/SgreUMNYohgcGI5NixnipxXL2l4uSytZwrpjzfQB5\nYFIJMgGOw6gzs0LKZP8adZr5Os9L+yW5EWcen+25xM1UScNTiVzXqExZvidq\nFXQ4AvzGx1cigsOQ6lM+zFA1nhh9D4wktLLj3gaDe6FzLaujAje9jq/LJeSc\nblDzm0gqVg8n9lwKYcEm9njDp2NcturXwbY0uHiq2L6qR0l++9pIKQo77iSi\n0NZ8trgy8lNcUR9IDYgrIVpL6K20HnzzBPjewrpnB3SHu7U67XVVQ4596e37\nknKgswQgAZBFu+AfMw0b+O4gPoHy2uYevuKclkX/0l+ZSozvvd4ATu06dKV9\noOESjIKa35XJTYj4dsIexboPmljl5xBBtoZNc6UdxlS3yR7FIMIq01xwEjNg\nsv0Y\r\n=PPoz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.1.2","@aofl/api-request":"^1.1.2","@aofl/cache-manager":"^1.1.2","@aofl/server-environment":"^1.1.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.1.2_1540842119817_0.12200276237263163","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@aofl/resource-enumerate","version":"1.2.0","author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.2.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"b83171968e032ffd419cfff7455c67cf7dfe8b00","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.2.0.tgz","fileCount":5,"integrity":"sha512-vAG8IH3pC6yvcHr+Hr7xmSK4ntAWYYFhPj3u1bDDb5cX2qpQyACfVqKexEO6E1ZKQgG9hCHEe9waJqC9bQmLkQ==","signatures":[{"sig":"MEUCIDLREwS0g1oODBJjyKdc3f5dpeD8cONE5OLaUeHujIIgAiEA/Wv/oO6UlZD1wGAy3A+5P0Bz4/cRzyEon1217WjQPok=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15051,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4f59CRA9TVsSAnZWagAAHx0P/j7TPtOCvYIuPLnw/HMS\nPPh3VYhX3bpKgBqmaBbgeTD3VyhJlLzFZn5mBc7pDBX/uROlhtctKPx6szS1\nSDmZRrajLu/UJjKoCNplredZfQMoVgAATaN8GuyNYPrg702OAYwUc6QRRgCJ\ntgyxfsf/7Yjm6ZlCTdNe+c2XAf4V7z5A/OvcU7bKp0xYgsBlpRKQaiWQGBxC\n9nRZ91BTF2PJFraV/GWav6N+bhIcUAIovsrgC3ki+ZPnAi6zqDYOy9vlCFbX\nUBXElaEATENiBC/WwGUzF5YPteceKZRCTrgA5nmwgHYr+OgdfHvm9bv3hBAR\nLaDQdtlCTJIcwMLiPrCVu8Qk4/siErRw/6hyHGnG/Fq2nYVf+gCc3AylYw8Z\nQax0SrU3+UoTs1x5GDnXKR78ejoAYYGEsvlZZAseE6Bf3axD57fQgHMwWwFL\ndFTE6LS1Zl0wdUGB3BSiZQkdfhd/mbTre4CubKVms3sv2HcEywe3vCAwHWnO\nWN5wkTmOmz17uJ/VE6gG9D3sUTO6PqORMwZcsWtW7APgKHo0vq/VVtP30foz\nzzZ0bNBg/xK/YBe1x/Gw5HtfwXX75COFB0ubz1wHHgJkW26UXJ1xIJt8RXtE\nH954NQkFvCDd08ePLhOdJGEMZ0Z5ow4tgoIVm9SRG/+8lTm/v0ufHxY3ORdb\njzrI\r\n=MFl8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is th","directories":{},"_nodeVersion":"8.12.0","dependencies":{"@aofl/middleware":"^1.2.0","@aofl/api-request":"^1.2.0","@aofl/cache-manager":"^1.2.0","@aofl/server-environment":"^1.2.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.2.0_1541537404742_0.9867807834035203","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"@aofl/resource-enumerate","version":"1.2.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.2.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"08518c943b8815955c6469cee52b88519ebdba5d","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.2.1.tgz","fileCount":5,"integrity":"sha512-ezFo2Sq8zyQlPfH/ZQmxNFgozdghQI6ys7FrIYvx5BeLWav9utp6+XkpPQ0/yVHDt80hK8iLKlUPs+OTs8/98g==","signatures":[{"sig":"MEYCIQDAZqZg5Ds85fN9miG3v5qtLfuci++IToqMAzQVyHJYOAIhAK4bEKhf/zSxqQL7iN+JKIWugtcN/ImlGWa0AuPy/Ww3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15373,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb8dVzCRA9TVsSAnZWagAA8sYP/37kf4rEN0cBpywLWy43\n78euQ/z3dcy7iAD6cWsvGARpUl5dFbkLpJqddt0z78xvz7PxfS2g249Fi6q+\nJ4wQZUoaNgD62OasDSQmzrjB4IDGm86Lk8QWBlnc14dNcnXO8NiYy7bVtN4F\nOOG2B+U+tI6euwxYMiKegCIS8YeIHi1LA+8MSWh1VfXzW9a2jaY7kcwwYwfu\nkDunUrMnXsf4jKuSUxsZlfl5QdBI+D4bMcMZ33qq07SGvY2swJLYHBvWc3HR\n+Uo09qKsrrIX5J6Z0/BR4av5tqUSw7rOro6MiidjxDM7bnNACainrOorzkzM\nUfweA91yAMuoNpmkpxfxwI0rEJxWaBFRAEfrHk/W4+qJiRITtL3zL9zUVERe\nhNPVcPBMZqd99/zrwslBSS0+1bcLU/78v2b4CFAVtdoklw1PBNDQ0WnTu7Yl\nbCx6/pU0ofMlUVjCiu0vNNBxT74KKEgqlD8eK7yJ1hB+ZKjmK5NHiIvfUhFF\nSgxeSlxw+bqmflcQyMTzrWFrdUQ9qGn7BX9dknPru1i4mmmohcvavIUlaxRo\n7yw/Nq6VOq3nN1XKVTXdOV62ta0nXpWLMiXAanax0Jk3wR4LKlR7aYflemEt\nOJZMcnATy6v+8q20ukfintbppmlM8pDWNst4uRsgW5jQpPNcchWSf2ujk0AP\nOwWO\r\n=lt/J\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.2.1","@aofl/api-request":"^1.2.1","@aofl/cache-manager":"^1.2.1","@aofl/server-environment":"^1.2.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.2.1_1542575474512_0.570013964002239","host":"s3://npm-registry-packages"}},"1.2.3":{"name":"@aofl/resource-enumerate","version":"1.2.3","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.2.3","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"bdd1e32e9bab6ba662d2d8f3538c9741c2b72bf7","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.2.3.tgz","fileCount":5,"integrity":"sha512-oC0f56sdS9uhdJx411dUxjqvY3Uun51sAq2VxJR6FtRKPIbchUToGHlZNtET4+QJe4TbVVL9KpLDud1ksURnDg==","signatures":[{"sig":"MEYCIQDU/V6YbdqjeAX1ZXyxTXByAzDNyhvkG+fqd86RDJUcFgIhAJGRRlnYC/SbKV3+RFVuYynFSYJgEdZwQExqFjqpfi1P","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15373,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb9KQ9CRA9TVsSAnZWagAAHpwP/RrXLw1gJ5ISEVm94mkE\nJA0gqKn9GcglhoGkCtLikdyRhq0l0QbadyP65TPHyKQBm8bMUgkwiKMW51EM\nngKr1esgNUdjXAcFijx3MosnaV9l9qzBWezmPEaOLA3H/H06nMgoxcl09VzV\n1d9R5mHSXi5zoW9niomc0WM0T9YfCpklrGS5kXhPcPLmIK3lR33/UBZc6yW9\nkGLk/DtxRtykAs2rDeRELX6tjqt5SVA8L6nRz/6kHixaWO8JLJLRD4T5ywcg\n+PkSIJTDbt04DE/u4dg4etF7s4wCTc69zPgG0yNj/n6xVRJE35Hz1OvejAOA\nW89W/+55aRXpTWY5lEBLOTf2EA5CjfpfxpXfVPoP3RtzFQS0tYF/jNT9swBX\nuYZlb4FMiHCvnBsUOBvkMja7rLKGp95quPLa0sdgUwX9z4nNVAVbLpIY9UHI\n2d2Ci7qd+vwvWSMg/sg0xa0LZYuLht6sf2G2ol/PBv/05TqheaHyvTcYKcBd\nbe84xa4ZyCw8RzVYnuRG7UewU7Owygl1J/3RGG7I8bL73dBaR711Q6q+YXgm\nPkWGl4bn04hiBPmOMmxicTsQ4HoCdIM4FpnUozkv40v1TyFe1URAu8J/9y8o\n4pAzpefEFq/KexChmsDiVD494TmYuxXvv+abXuzNlKf22sduZd6s6ZF4kQW7\nK4NR\r\n=8ru9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.2.3","@aofl/api-request":"^1.2.3","@aofl/cache-manager":"^1.2.3","@aofl/server-environment":"^1.2.3"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.2.3_1542759484518_0.8430283305906427","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"@aofl/resource-enumerate","version":"1.3.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.3.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ffe3dec1223000c749b46b321064074440b585a7","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.3.0.tgz","fileCount":5,"integrity":"sha512-yMNBM1qKTLU7l1ejqGjobUNO+lyDu6s3K4VXrZqH/EE7CiRLoRd703dfFqTrZLEExJImHwUYna+LnHDm+tGKjA==","signatures":[{"sig":"MEUCIBCIvIT5cX4hMIYEgrFcgaRL2T26JoSE41mLMtRwGhIaAiEA3BNMnmFGk7q+Wne+draP+cvAwmnuJHXo3fyr6VPXM3w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15373,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCY4YCRA9TVsSAnZWagAADugP/0mPCVwJbKMT7mncs4eH\n7X9SPsf0hi6RMU5se7dIKIptwUdek0brNzFccmf42HpFg4ZIuTXqnoFUE/Hu\nY0FgIVK8UQhtaL1G8+nRkF1y0ozUZPTO7H/onGcWb+7ejcPB8G60OUL/bn+S\nS5fmJ6O8R/dA2BdRbfRGGsAMW2EFr1fGBQ3lodfywudJalTRnnQk38TaF8XH\nDZk+xouF2oEKFRuNqX/VGLv0aVvM15PaeKKvGF0q+s4iaptJrGJSeR5zNuwK\nFinkvuighmpvqQtmzKyuKrW0OV5gXzn5wPfnpvYOSYkmIxvLUeKHHfeYT1Dd\nJaipQG6Q2TrZ+dFs78SPkjX+htEciVEOQfGs4Lpsyaw97FGCytdyUQv8E5OX\nvmAQ/8y2BfogIAi3J+tNvk0OarlO39D9+X1u4/2p8TNOKQtFsxqJyZSkbcsW\nkcIkDWgXJ2D9UDvvgRwudCa3GD0b7gUVqVh21PccY86Ul1p5FT5DwgeYtYUQ\nnOlKnigunlVvX+hzp7lwgVdqEiVnrsg4sOzWwrg1mlTdYUTFmlDAniv9MdHn\n0hBlLukcm/3CbMvxGw/cXo100nWx23AbngSibmJaLIpM9j7OP7zl6hQ9Yd2y\n03hqzebc7qLD60795Z+HcSuBI/HRBCNHoGJJws0RC9mYTUBARLQ3HcXsRKts\nO3g4\r\n=uktO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.3.0","@aofl/api-request":"^1.3.0","@aofl/cache-manager":"^1.3.0","@aofl/server-environment":"^1.3.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.3.0_1544130072119_0.9108271045602319","host":"s3://npm-registry-packages"}},"1.4.0":{"name":"@aofl/resource-enumerate","version":"1.4.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.4.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"787cc41d395428ca7c7bd114e92c9a7bc036bf02","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.4.0.tgz","fileCount":5,"integrity":"sha512-HDSvsJIM2RNgBXn9lhvMaEYgLAThcDcshq+E+1QcaMsBGh3pYqpW73/FuvSKujhW93K8GtBXectJkeCafT2e9g==","signatures":[{"sig":"MEQCIFj6fzEgIlptHH7UdLku6973jWTdIl9jo+BDadIDhKyNAiA0Hy/h8gcr5meZp0LSuZeWngY/QaKaCzd/DIKxuFSjqA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15373,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcJY1tCRA9TVsSAnZWagAALI4P/1wvF5EpJ4SFbMn7ECmF\nHjmvjslFLk6IhEEhB4sODg6bjb4hgDwSlB/vFfdG5xnES+0Dkw/f8fHgea6S\nKYeduQvFokCSxlv69sbtYP0S6371QTW3AmKJsioVJ7zUajKsWDvlJUUIx+Db\n9Zt9PBwHaB1EjjLVXPpFTZEZIm3Oxn8OBLWiu41KVDtcf1xWYyZZNROmiqDY\nPF3PEIEW5WiDV1e7oyopuDh/lHCmfW1tQflHNMR+LhcJMd2F4EXgUM8xEVVZ\ntCYYkOnN/8RKDnC+CX7lp37qrDKsoedq0kwzP39nL87NrPzvjEKWOiVbQa3U\njdvVY/5VHnbcketCbGvd2A4Ve1qEiAfhsi2fNrtjSwgKewIVLVup67Gg4grZ\nTMOeMdP1C6zdMGkcm2hBit2o0F5uZPTWl4wWA0BcF0HbPsvXxqbFxJ55tMyo\nxM6WPp1h3Ya80gqy5Y6tdrjuhLVRVENxnN16+T2LAe+RV8bWnDjYxolGxX7S\nlbk6jbRKnsSazcAtCiz1hZweWKjvcT2H0HaJ2yk4Dme+S04Hpv51EaQMrFuY\nqB1l6R2ikJwevA/BGlnpjHKzsSZjzsV8UF4jkJgsv9fBBFju7uMir8aG3mkE\nOsUxWkRLc9QjZvHfqtIeLPcVkUofC2y885n7bnMF7jOQ26QHQWcYkoRHz0qR\nLc9C\r\n=l/+W\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.4.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.4.0","@aofl/api-request":"^1.4.0","@aofl/cache-manager":"^1.4.0","@aofl/server-environment":"^1.4.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.4.0_1545964908747_0.3835488365371307","host":"s3://npm-registry-packages"}},"1.4.1":{"name":"@aofl/resource-enumerate","version":"1.4.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":"Arian Khosravi <arian.khosravi@aofl.com>","license":"MIT","_id":"@aofl/resource-enumerate@1.4.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":["Daniel Belisle <daniel.belisle@aofl.com>","Micah Blu <micah.blu@aofl.com>"],"dist":{"shasum":"b2b4243260b2fed24e4eb403e1e0c54739901721","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.4.1.tgz","fileCount":6,"integrity":"sha512-oP2Yris280jT0TQkeEAaTpQRLCQXqbYJ0afuxo00dlzgwVgGhswnnY54WjQ43bwRC/P92Q4CLkrzTPh9XPomeA==","signatures":[{"sig":"MEQCIGTCGO/UlBuoO03lWZet5We+FcHvcGy5ZiVSHLBMvpwgAiB7H454FazVvTZI8BdCGHOeeKE234ZlqcSxNOSOA7BE/A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16665,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcM5t/CRA9TVsSAnZWagAAzU0P/ilYQ40xKfCM0JeGFEH+\nA9hdz1/q8djXfnLLc9YJRzYrYHDjQq9ZsD3pb/w5zVq2lkKi1AV1eUxH1dFx\n1MYWdTDaWyxCfxKGa3mqRquRsWPcH1k0vp6t/iFo7Wmm0gssME9vamxJYTFW\nvhKJ2npf7Jccs7JjNU4HVO2Xw9kHfsf+ODyyfY+NXide4mfxTuxweKvgqmK4\nAB7zaF4PFV8uxJIqteSWBzJCN5rVMH/SRwzlZOMR+OW5rqskqzKu02Z0A3fM\nACF8i2/ZHG8uiuqd602bgQPvDtRE7+2Zl4WRaCRdOeYHFfNR1YnXsp/VqQiW\n+wbUf1LGFPHjy35ckSIb3lZMTVk202Y0h7/oyttWBUEe9JrKO0SbicprRSYk\nguK71GT/Y3WEq/RiUcN1TK0aG/MFFZl0ccWo2katZh5bSoo/Y0n33Omu1o7C\n9nal9xf/9YMUZrfiiDIxW/whjFN1mBIYmpHSWvVrcVPKuu+347+0O/c09k4O\nJ0IVR94W211u97baME7pbcUfcVbc7shdI789vVO966akjZxpxknpvRuehBaZ\nolUizGjLqiWPf6pgwDY6UZUc/3iMaVc4qoZHF466a2bOS1KHohWF7/+NVHXr\nDH+iggw3LdYrhYi1vhSkbcNG0fL45BJvm9UjnE9QqGZ1Pp84ElT1sAtEk381\n1tJa\r\n=ccI8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"60297b316858cd061ea1c221a7e04406b910ef38","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git@github.com:AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.8.0/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.4.1","@aofl/api-request":"^1.4.1","@aofl/cache-manager":"^1.4.1","@aofl/server-environment":"^1.4.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.4.1_1546886015336_0.43338919384252916","host":"s3://npm-registry-packages"}},"1.5.0-alpha.2":{"name":"@aofl/resource-enumerate","version":"1.5.0-alpha.2","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@1.5.0-alpha.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ed3667af30ef7a27bda881c085bb4ff5aff053b0","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-1.5.0-alpha.2.tgz","fileCount":6,"integrity":"sha512-3XAGIdzzjObpa8L1LUP+Flaa1u2mjIRr7yicWyCWgzYmrr9QjNtQfc8WKpA13pYwSOmj290OiIxR0/KCZX2dbg==","signatures":[{"sig":"MEUCID5DHUZzfPINtTtt7lWgrh+Q6Pyd8ERKxt1KWWuyMLHGAiEAjemQN23CKYdbSn+FaTfRmawQTPEaNz8NXQ5SA62LGHo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16689,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcQQe6CRA9TVsSAnZWagAAffoP/RbARfxTthBbc+E+ghpx\nBf7wZA2hV1wAV3MLL5hxT1zoT4aNmwYL7d1egZRh6tqtozn4O9oDFienuIQ6\np2diYi2B9oVGo0qzTUxA4WjbZJ0dtnTpsFMjd6OBSVEu4xAfo7LyKeGxbrFt\ntCu8c7OYFRqgKg6ZfAoqxHSiOZPVEggGNG/2QCZkUIbasUZ5L5YgQepndvlu\nijouZ1Oj8RSKzqPn3+zj3/9yaW5HVQeIu7ttS0hIB3B7ZaMzcJeyPFJkd3iO\nnS6hNMQhnVLd2Kk0lMJranpZwMAuk10AjLxSB2UKHdoYl9Pge1pp9EA9lVrG\nO81lW1JZ0i5LwcpHdFx7woUq+bLqaHGydEfQ9SIoeZnLkJlmuvnX1+vZL16s\nH2co2soPND/6Wu6MbiHdb9XzXR+GKwQEDyvEnQbRcngBtIwMmsECgOlzUDbS\nRaVvXELfEXgpY46yywSsz9f9i94q21YT3F4vVRBLYZoBY/wiIapgc6QwiBHA\nLLoSqLFsjjBbz1nqLotv7ZDIu/wpKqI9TrHg6BE26XDu46yNdBo6x1r82lay\nz7Y/QjMCyxx183r++pcQGIouyBRkSxDU1byPJcUy0hrQ0wSmBASKR9ekKxMT\nZ8zvhput4qk+gIQCDihLl2Fi1hyBoB2Yg/91XnKSvx3+r4DtxMmxI5271Qjw\nmmRo\r\n=8y+7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"069f56d81a39ff1cdcd698c4a3227e36f2c5a1d7","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.1/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.4.1","@aofl/api-request":"^1.5.0-alpha.2","@aofl/cache-manager":"^1.5.0-alpha.2","@aofl/server-environment":"^1.4.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_1.5.0-alpha.2_1547765690094_0.017533334504956644","host":"s3://npm-registry-packages"}},"2.0.0-alpha.1":{"name":"@aofl/resource-enumerate","version":"2.0.0-alpha.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.0.0-alpha.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"},{"name":"bill.salak","email":"bill.salak@aofl.com"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"197065e3f9ce4c484794336d0da2e14e38635350","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.0.0-alpha.1.tgz","fileCount":6,"integrity":"sha512-I6ScSa/DMjCFq1CfWxMmJaQu5nz2S3GyYjYuNShlTZlP3b1uZdELxQdYFsqNFEGkIBaOLX8KgH2lz3pcrU41xg==","signatures":[{"sig":"MEUCIQCytDd94u2yGF0CusSRRge/3ovvC29YcoSpopLf1TqLbwIgcE26X/+5Cj9YctBMdWONBTNETTUEDpZNyO8lE5RG2wA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16689,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcT7JBCRA9TVsSAnZWagAAeqcP/05Oj8lHD+4XcEtgDMRr\nK7QS0QvmqUmTDOtv3rU/HrHiXbTF8xQX1qu3sWZ2XkT5xzYGzuGv/3ZikUMT\n8eqpP+32kST80CkzVvqOlJixZECkoeYghsnx0svQwdldY6K4YLikKbPCHoaz\n+XLb/Do3i/MKC4F/8eLqwLDlaLupvE7xvXN0wQRefnl2OZQqR/Cw16sgygaZ\nzrDppDH3C+i5fvSLw/66Km3c3vHcV+Ts8tBHQChuPrjXif88OVt/QmdbuOGa\ne1dLv6UGPYhhHMpFx3L7RrydMOfFjAjSk1e2GCDLDIuGlhMwFzg9GTtcnBlw\nXaRsGCbYFIhw2y+LHNCONdkBGlyRbhPu1r7tSeEjLztcBa9IFN+2h7OzJxG2\nUKuHLQjdWbdQpn0vQ1O0ez1mR3A/L3i9u3iYZVpYms4LVE8LcM7KJyoUBJds\nbq0o1+hE7sG6GzJ7UlQjxOrdGO7/HzDsYbog1MHRph3vovDS2/sfrzth1pwx\njPcmkcTRFyOM+vQR+WZdUMBNR3S7YWS7X9v1diIn/PdyGjHDIKrW0kENzMah\nR7J4p/CAbS5OVPRIWna0jbXwuql/wpGJ3jkgkcX37akiFkZdwTOU68RRLnDv\nxM38G0r7D1gKp+7VdVecyxrDq92EatF/LyT1WVgIH/xZns94zzP/iCHHe2+e\n2Vbx\r\n=YkBB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"afeca11d48651d7710e6942de5fdad812d9d87f9","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.1/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^1.4.1","@aofl/api-request":"^2.0.0-alpha.1","@aofl/cache-manager":"^2.0.0-alpha.1","@aofl/server-environment":"^1.4.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.0.0-alpha.1_1548726849246_0.5885304084928897","host":"s3://npm-registry-packages"}},"2.0.0-alpha.5":{"name":"@aofl/resource-enumerate","version":"2.0.0-alpha.5","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.0.0-alpha.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"f5815647994221abfc9e7225909278e09130e314","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.0.0-alpha.5.tgz","fileCount":6,"integrity":"sha512-fnQuIE8E2JdahpGSe2yVnUUM66dfnN39Oz+1Id0pPuISe/WsP3soowHq0On8raCiDxC/FmFkKh6uPxE96sE4Pg==","signatures":[{"sig":"MEQCIG8vDPI2fc99giU/L0WucUUSxqhHMaJj1Vmo8MMCyd1XAiBT5L4BmCk4P/MjhD18KQtnJTmhCNBI+OhJOh1uhwAvxA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16729,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdcicCRA9TVsSAnZWagAAeUIP/0q2nxOv1IXrtUvSXFun\nmBwzyS7F2IhAlxwtBEbE4WLvTG4iPL8MGjYyAHVXuFQGJ7WyVbskBBin0Ton\nMXHNtqa+WkcUhypUtEhjCI7S/7DpbJsNDYKsjFRqSEhCvO/9SkTzh5NcHvCI\nId9XbOfr2l2jTQLvGSkmJq7b9OgO9gPGrQ1l4Apohvk8SIZmP3VvJ+dKyv6S\nXSS7YH2hx1rpApBQ1Qp1ndTBpNuXxwX/oCNV8slWrP4yuvU5jfTY4Lk5MCK/\nWR1koFrVv7cHsY0LPCy7/OOZK6csTv8GQcZItzyUrxBA+yMcG9LFySgVjBw8\n8joLpVV6fPVE3Cm8u6sA2aRc0kU4KjzXCOk5I3t0tge95u0JCV5grtR1Km7a\neMZWojqtU9aYcTHa9iIDmR2/YPY21UJ6nidsvtoXc2sMXBV31PF+pRzjmqOd\nKye8X0PyYzEXmzBU0BIeG93Kap6KWCt+bbaAlT78ymTfFtLERare7mszum3v\n404avydeszfCjWKYzgf4TLL5CmMWBbINslbTtt/a7k28F2SUaJouJZrA69Up\nmKWTO1ZtKeuqbH1+lpW+agtzhmMR1xeL+a5Oa5yHy81+qfPwHBACox0JVxXI\nfw8pwM/DRT036QgvswUSLIh/fosCY7Hm30E8wqBExy6PRMVleXWJyg1vl4TI\ni9bj\r\n=vnVT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"00d91514e0c953e8cd998150ed5705b87db20b39","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^2.0.0-alpha.5","@aofl/api-request":"^2.0.0-alpha.5","@aofl/cache-manager":"^2.0.0-alpha.5","@aofl/server-environment":"^2.0.0-alpha.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.0.0-alpha.5_1551222939475_0.27822053853977424","host":"s3://npm-registry-packages"}},"2.0.0-alpha.16":{"name":"@aofl/resource-enumerate","version":"2.0.0-alpha.16","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.0.0-alpha.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1896497cd9343c4105c768fcfaeb8d5eb1dc5bb1","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.0.0-alpha.16.tgz","fileCount":6,"integrity":"sha512-H2S0N4x1IkQABFv8aqq17OOPXN+iIzXyJJ4ERJ/5/P8H5mzjOGUkkbFPS8EZdSiZjLmCnGxHyfRyncK5TnZeSQ==","signatures":[{"sig":"MEYCIQDNg7bNcIzSG+JpQMDY5Jw6LzKa1PHRqA8FIXGunQ8Z+wIhALZmbChktmWDvfuZh5FRpj2HR4WNgQ9eJ6vslT2C93to","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16738,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcwhFJCRA9TVsSAnZWagAAxZQP/RD+IuIgjwshbYxSmN5o\ngZTM2DYvFdxhuRO3xMiQ61YQk27gu0EcO7x5Og3msTuCQVtPWScDUPXffkvR\nt+EloOPdlZ92FBNvoNagNCFk+6ggTn7dGVstZca5zNCLlwQdGMmo+pVt/EaP\nDQKkEBdh94Yf7z2SQUD4UomSvTe8QL+ammVhg/qndp362a+gtXMhhdIaxXFr\nwBJSZB4AX2RIYK//Sbohs/LvGV+LZVCXJ4nbw16gm5pT7A+CAyhk88qUt3Wr\nodBMnLtaHcriEfIePS6PxXMuWWIUHJtDlELw7vykr2JvGptTLDmQ+Fewk6e/\nrQAJ5OQ56P2cVYBWyfC6qZx6TTy65/z8hDe425niRgoAxXEqV/W7iveq1Vbb\nA0Nt5Z3KCx0++zAWcJDsvifTNVk5y8opc+hO8jKvKQQ/HJ+v/WHXqbrHJSfy\nVf+wrx3EYpojOYXNuEu9n7TyrOfTjutpHahbPjEixzQLb2KOu5xseQ27N/7D\nnq4Af+nhQ94kENKd6hJyayD8QxCzdgpZHmfA6/9K8oXoXhkyw5aZzGjcEe6D\nAmRFSVYsSrgKNwgfz0m68gkUuUb/iptC/iTnhIodq+5OqFrzH0RwqcKKA7Ea\nqLWeCvI6Cx1qiIzdT+rxrGq7iUrUmno5ha0Z+a0iYhzHYP7QlAbOuRULK54K\nvv8n\r\n=9Ktq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"0b6aa717a40d408713b5b981754243de8a8aeb55","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^2.0.0-alpha.16","@aofl/api-request":"^2.0.0-alpha.16","@aofl/cache-manager":"^2.0.0-alpha.16","@aofl/server-environment":"^2.0.0-alpha.16"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.0.0-alpha.16_1556222280398_0.00633231869862505","host":"s3://npm-registry-packages"}},"2.0.0-alpha.17":{"name":"@aofl/resource-enumerate","version":"2.0.0-alpha.17","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.0.0-alpha.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"bec303042bde5f2fbaa1b51c65cba6509f85f2a8","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.0.0-alpha.17.tgz","fileCount":6,"integrity":"sha512-NxaspcqVXrea1I2DCTQdIi2pZ+ufYQIg/hU31eLfp3fKaERfq+ZO1pGJCQFHhxYLHYqknOHHHIONhzDwUGAq0Q==","signatures":[{"sig":"MEUCIFUBVm5U34f1IqnLV2mAlGuvWy0bghyz2o7vIgoZ49/WAiEAzJ+h40OIsIT8uaJwvgDEFYFu0d9hLB/mLi80fD0wb3U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16738,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcw0+cCRA9TVsSAnZWagAA09IP/2/T22APMBA1HHiE2D8q\nHjxnUgc/zj8qJEX6+NacFTcZm+Uln8AjFJQGrjpIib4WpdN+G4a03GlLZKTU\nFtK6H3yn5saoZsszVX7hOJi6CO3E3OJ7Bjy5ONM6+rBF4kNlMUDi47/PbIiu\nOdubyDycjp5GXLrEgyQ9jU1MGyXzvbELS171EH3caZfZHkW0fG8yaiRROO92\nJE+/A8e2+W+RXpNBnQlO4sh4/tOlYN/bZiz2RagHgyU880BIa35uHKjYQjll\nm/ZJfkjlGHKKcReqDn234YTpisrN8vCdQj5QecG4GV+Romw1HFHgMdQwhRdf\nZQPUh1TpQukkRndBsdkwGFy+VY9FOKJHbtkSL3mGz35IbPZCLl6MeoLXlqPW\niUmLmxUkQuNWqfPNJQkySqdmqa6YRpiJOexEgNMfTwEXWlgOj5LsSOeQNd+g\nkdJx3yU/ZxVpEikQLfIEdqNO24sI/PWsryaSOPhd693U+M94BQG4A4MTsHXd\nqhX9UkRdhFT+7jTO772ruQngmXljA0zFX8Z2V5gGqmDZaa/DRr6SAtcEpwu9\nhAhEU9f9DdYjTawcxMjOGyio76YykmOZc09LLejJZW7rgLpBWhuFDkLZyGIL\nhufcEHvyS4CasnGkEfoa4kmsGb5zP0RKujucQOihT6lYtjpcI3mzqZ56JT5q\nCR1Z\r\n=uPhz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"6a396437dcb380ba2269ac50a5b3b88e54f99027","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^2.0.0-alpha.17","@aofl/api-request":"^2.0.0-alpha.17","@aofl/cache-manager":"^2.0.0-alpha.17","@aofl/server-environment":"^2.0.0-alpha.17"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.0.0-alpha.17_1556303771873_0.22977777872791205","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@aofl/resource-enumerate","version":"2.0.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.0.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ae7791099331d970f7c4577a7469c1d135cb2949","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.0.0.tgz","fileCount":6,"integrity":"sha512-sZJHcv91TnyyahuHmdt5VFIgxVGMKXV1ezrTSJgaoLkBLEV7zJDZ+U+35aMlzA4uYBuvMNDhHfaoH+lMqp+ITQ==","signatures":[{"sig":"MEYCIQCzfDA4lll+wj5S+W40wAnjzfy/yRdhrJh5mpNqdryWKgIhAIcjNQ3Sfa/qjFQnMMcihulUtd6mXHR9VDT6C5V1Gj0R","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcyKK1CRA9TVsSAnZWagAABV4P/0WgEe42qsg6NUpjK42N\nePloUjJFtvINJLwbgoH1SMX5awa+d2j2B9T8ncJ5+K2n58Jv3crKB8iJkikL\n+eTgA81ZO1rxOitjwVqB9bqDC2NJbKcSEB4FDwcc4QF4rk8ZIJD/kM9WIYDU\n+Mi8GCAANPz3M5KfCpwvVgYUMvjVmlgw7KAqAxrBqLH4DNBmTG/h0+9xrnuN\nuYnWXDaVUeS51z0URmCF7CnG942rOVet1gExygbweRsvkkHsFUghB9ToN+vQ\nhLdAhdfAZ9Obi4h/ZBA8G3Sm8aFs8csKnjsr/Mx5QtN3oX0DpSDBx6cPwvun\n640/5J016YKHpEi2oU5bgy3L0gwrhPqy1Jf0yU+VHrN7XqfchlvKyohlM4e9\nBUI7A2xiTmR1MOeL7odoPlgppdKZ6KLxXuw50q7pC2ik9sunHqOtZCdFtgFk\nZ0zXEoj8kaz0uTphHM4n8DkxHv0I0lbLu/RtMn4ilme/lktiGOkpn/1JtXNY\nLnGfj1E4q2lXeewHy96ozFR/K5Mt/fXr5U9ux0ikqq+h8vgKSWdSeSC+3IHP\ncHc/6IZlGEH0byqGiY7tty3MhBe/5OGaCtYdQVxrvOHGo4tLlym1RSHkmpFC\nMc7ZUaHxyqezxxOh5lR+7m8LdXzOfX+PMod7jbgLQu/vTgts0bB8zPfnD1CH\nTbzk\r\n=zN/Z\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"91b9b3074f7031a51ce7afa9b542ff5dcfd64997","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.13.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.13.0","dependencies":{"@aofl/middleware":"^2.0.0","@aofl/api-request":"^2.0.0","@aofl/cache-manager":"^2.0.0","@aofl/server-environment":"^2.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.0.0_1556652725163_0.018637110128512102","host":"s3://npm-registry-packages"}},"2.1.0-alpha.4":{"name":"@aofl/resource-enumerate","version":"2.1.0-alpha.4","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.1.0-alpha.4","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9a76e22f6104df32c6ef9369f25cfd60aa026ce3","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.1.0-alpha.4.tgz","fileCount":6,"integrity":"sha512-YZjXvDVAI3ru8r2DVBsdwXi0sqdKBlPIEk6Zi0fw5H2ZynB8L6zrN/qLZuQ8ACoiInlc+pNxrRYMT7dffqVL+g==","signatures":[{"sig":"MEQCIBW+CPSg6171HLSisbvD1k7P+I2M94F+OQfYeBxGoUzzAiBPV+QqOjvazWk+0iXfEsf+FOYw1GLCnUZrP736PBZGRA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16709,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdN5PkCRA9TVsSAnZWagAATW8P/i5FytaFNxCfBYlOO/Wv\nbm9EHLbpEqui6WN8Z/AhlyA+lbC4ZvEwWBp7cLgrW76L0RZSXR27Na8hAY7j\n/vFOy3YE8a1iudkWFZyNZmpM/dzqMkjTFyTeA8nxF9qiK28AZcr6TO0YPIGU\nG9kiPA5G6uPTXd46KdNbJvPq0D3IdWhVwvjKLq0/l8YKSfBTYgkeWDGnUf+Q\nD9faB43MTDaldtbVhRcWFm73KFAChgZFFvqU3N7ylNxBj7GT3ZlRFgUBfdXH\n36WXdPCTwxzKLRzpW+qkHLb/FhYYSbxYLtaoJ3kqGzNWbikPvHdftQ0ke2Ry\n6mILoehSsvKdIa2UCh9np1GAZQDm1OzljmKDiJXs7F/h2XQLu3nL3kMCIu2J\nWJ3P2InzvE7RvVB509RS4zGqzWeoFVTorsS35sdBCAfNpQdRZKW36VDan9Ai\nejvi5w6f1fZPQ/F7WBip34w4DFs/lrR6c1hVvNL2dDkedbAnc9yNNN0qedrB\nJ55Een3xM5Vjqn6Zp7KTsIqk0GsVvIGdJ4cL2bs0P7LvSR9RF1QUhN++LPIH\nGm2FXwipZq0Nn0SYrigNNaecDob2QMcjZvpjHR5rnniOVw4A3CLJngWALTwZ\ns1vvzBVpsZD/aueT0+V+te9MGohqWBt5+yRnHLIeOMMl40f4Xs381h+r9LWn\nP+kK\r\n=ATcR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"7c4ae57824ce8cec4984c32b93011f7fef10e1b8","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","dependencies":{"@aofl/middleware":"^2.1.0-alpha.4","@aofl/api-request":"^2.0.0","@aofl/cache-manager":"^2.0.0","@aofl/server-environment":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.1.0-alpha.4_1563923427314_0.574583240774597","host":"s3://npm-registry-packages"}},"2.1.0-alpha.9":{"name":"@aofl/resource-enumerate","version":"2.1.0-alpha.9","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@2.1.0-alpha.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4b5d9a9b59c1bb2f54769d360760e11f5d0d3283","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-2.1.0-alpha.9.tgz","fileCount":6,"integrity":"sha512-TANRmDZf8xBtKy09tSO/VtUr61469sQJBoQ4yizhpx4qrP4SorcscRzXDqr9ck2TkxwJT31U8XIjXx1J3CavbA==","signatures":[{"sig":"MEUCICXGn4UkNl+YJ6Cz3ba4sPV3sM/nl8NWv2iv0EQ91HugAiEArVTIPSxtO0t0dlammtNFLSyvE2SkPK++QL/efTZ2HUM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16709,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdWO2ECRA9TVsSAnZWagAAqaYP/3WfuC+SuEu8g0Vt3xyk\nm780TxaZt2wUmPblfWA6NXT9b+h81jYxzatlDPZiaD3t2QwgCY5bUiDk6XIL\nTP3I9hhMUGffJENnXeHfylAItTPPUtQv4AAzPtG03jxZ0//1EyF242ZL98vL\nEgUIGzKsisCAMDYw6hBwfYBrL3ooxrA0803JOMtfP0bEtZSVasitg4kEwK8E\ngfyO5pRY41waT54f25VLXI82lsV+Cxwv/5xSScFe/m4t0AihNVzfyIsR8/7y\nQDqKIZm3+0/QIqZqUyL+YXmZYLq2dKZPxHmrIt+aHGBNiP0hzIXmAFh5aLUK\nMZ4+wd1w/QTxATowpQiMdPfOC9Y3LmwAkrjtjr4jGczXWWYEhXb7nJpvplYe\n2tF6i9NDyJdgnfFa/slM/o7Gcycbd9qgyLDYwUx5ehjch9H8L4P65qcKM4u2\nKzf9gfIxZULocJIS10KWyYGJmqrtFniGAN+08dHuc97SJwfZN51pzLKG96V7\n0usfvMKzUhvagMm8bH18uJmCvFHYWGwJXaQ5SZC+UIMArzCdnasiYNdKaXu2\nxfD4G0KU0dFPXE2G33eW7rX2pY+ATapz3iR+ST36kr4BI6aBBzLn/klfjG6s\nGStxtOKRiA8jYYEg6tis3eSmWsPVGQJ3be6yuGN/BOF4Cno8hZCOhJLk/vpq\nxXOA\r\n=8r8H\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"9dda0de8d96eadea8f7eb7f19f4eab08fbe611b5","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","dependencies":{"@aofl/middleware":"^2.1.0-alpha.9","@aofl/api-request":"^2.0.0","@aofl/cache-manager":"^2.0.0","@aofl/server-environment":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_2.1.0-alpha.9_1566109059772_0.7262862317711862","host":"s3://npm-registry-packages"}},"3.0.0-0":{"name":"@aofl/resource-enumerate","version":"3.0.0-0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"767a3e352cb120f5e4d60dee06ec18e32cdaaa7e","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-0.tgz","fileCount":6,"integrity":"sha512-YHlxMegtfcJhXyoG+yOamKTrE/3vES8sPiMToZk9gcQ6s0Jg/BThP63AuSdL88fONNc5ne/g03LCSMjHrFtF8A==","signatures":[{"sig":"MEQCIEIdHMv6uLNQ7EZm6IC83Ik7Z4g7HRwD1AOpwWMfduvIAiA8rQrn13CX/Lzx7hnK4belFvySUIr8nPFpmImu3s7eSA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16703,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgG2HCRA9TVsSAnZWagAAKsAQAJ1k18b8mpPmY3d3TCgs\n4+GDB+BmrLuOGCPUvuuK6pmsCx1fqdWX+x0SU6DAQWNBGj7ndXJIwZsE4O0Z\nB+FDw295GSITtOjbwogks+IaqnPw3rBRK3PIuw2/GJ5MVkM5wSMMSIVK0g4X\n9KMD0UdenXj5NOXrxc4jF5ich0Rd5O+zHTOncJfVJ4f4Ab9gGcdT+J3J/C3W\n2zKBCyOC6l4yhqLV+6zk3eG+HuMlS0Twh9SnmCjuUg+x3g9RLqHUG1i0s71h\n8tcJwewVXVf/3h5R0PmtsgGIhLiTZ5R+OtBIYYycVFdFqC5p4f4CiORvkxOE\nWOnibdVutDSjAp2GlgBHEc89UHRmyFWPKIw2C+LrlMKrkTiO+UXh5D6XPrIE\nJ94vKLPy6H7cHX+ppM2qFF+P9s2n9iBCY3IcxGt0Fgj4OsQaGBBrzFfxyXCK\nXMkxOhutPiOPKjBhSCN6cyVfsZuZOuVV2vOXnvuc1p0ub7AvPWTr0nfh7qnx\nvzZiQV5t5U7U8xAztdmTxEYkPkc0oKZH5FgdiABaWDLGn2Tj2y8kogK7Rli/\nZ+GxEzLVBg4U7Sbjn0mWHutQ6Uuf+1zmP7q+i79dDVvoSic7o3vtF/iVjpLC\nfsAByxDs8nFWVqhoqF5Tvcy8VTDSv1yGB/rfQEHl4XlAfjUfuDB6CHGy4cSM\ngXId\r\n=nSXb\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"68ed707a605f1a3cb02ab70ff9ed8a188867028c","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.15.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.15.3","dependencies":{"@aofl/middleware":"^3.0.0-0","@aofl/api-request":"^3.0.0-0","@aofl/cache-manager":"^3.0.0-0","@aofl/server-environment":"^3.0.0-0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-0_1568697735120_0.035807042184065274","host":"s3://npm-registry-packages"}},"3.0.0-alpha.0":{"name":"@aofl/resource-enumerate","version":"3.0.0-alpha.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-alpha.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"eebd77849145f7cf61c65afbac25b82f020890ef","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-alpha.0.tgz","fileCount":6,"integrity":"sha512-O/8DwDcR1dZQi3CFyJUZFDUaLbSwomEgBS0AJvxMmvTsJqrWYfl7RafBXp5sLAB9QO8IeqeJlmGsN0LY8lLkWw==","signatures":[{"sig":"MEYCIQDwz2MZQf5cJ7DE71oWJ8H3j5+XDnjj4oOpLBkKw1CGKwIhAIunrhWNlDhhCMSHU5Rz5SW0HjfwcPGsFlYXnZCo1+8M","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16733,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdgG39CRA9TVsSAnZWagAAxvcQAI+87Ixb95r60Za4Fmek\npDB0L2ASuMc2SLYoIlPw5Aa9Envb9Pf4XSCfxaghD3c6Nk3Z8T+qmMGJY2Nv\n/kZ5/Rug71QU0Ff6+k/nf38b+hkxCb1qahsMq0jox5PbGKuAL2eOwDGaC64x\ni5OQ/4HqBvArrzStWJZQk5ufVO5JT0wTvDdUKrs85d39dxLGBhm++Nbh1Axe\nJAJCb/Xu+WUW7GlH6y0K6HLvC9J9LO1PKjpHoZ9oXRCMlU4MiO+fwai4MUFT\nfD/WFatddkA9QuuYpzgQYjg9wFSxj4PYjzVaKbSrWKfzThqr34+N/RDpCpV6\nc/Nt3SYazDyRTJtcSnKTr2jDRmwpj+d/JB5O7zCVP5+/zlGDDB3Gu6WzmMqw\nd/+DV6fCHyqqPwcwUZr/pUaelYBjCqCzWgHWQZkaONrBrjf8GpQMxFhm7mXi\nuVYFicXm8ZdnJEZxYDteTo/1vl2mx0XqdsWhQq/xO+vO6jiJc/IMCd4+uy1L\nEYwqjtJWkYVK7fdtO8m4EXHis++keijbsIi2TclH/C/pJtN8AAlFu2LU2ksg\nYHQ7LFmO/23gWnr9aZTLVCbKzMjscHZKu+ro+zwyaXJxZW28xTt+NHa6w5WI\nT4dQi8j6hMu7HQLeojYEcM5PzcepbgtC/dMIldNoEwWU/iOGajxl2ydunJ2I\nLGpk\r\n=qbCU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"c6c4d16f33cbd321585e3e7c86b1aaaeeccd3627","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.15.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.15.3","dependencies":{"@aofl/middleware":"^3.0.0-alpha.0","@aofl/api-request":"^3.0.0-alpha.0","@aofl/cache-manager":"^3.0.0-alpha.0","@aofl/server-environment":"^3.0.0-alpha.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-alpha.0_1568697852613_0.9723383536708274","host":"s3://npm-registry-packages"}},"3.0.0-alpha.5":{"name":"@aofl/resource-enumerate","version":"3.0.0-alpha.5","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-alpha.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"159c15815a5c808c9fe70cbbf58266bccfe93f38","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-alpha.5.tgz","fileCount":6,"integrity":"sha512-ERqQK4BYVxvJIbRhgLCow18v0M8tWArBIQN7I/zst+0erbxoTk/tYUcvo/dOk2na+nhZRfjoX/T1FKMowzs+lA==","signatures":[{"sig":"MEUCIDnlRXXQI5xNQHD5hvSrGcPUzZxzYIsdR8Gf+7fbBHsPAiEAt0CBV3gtbi/8JSb+9TyCNMWaDU5KT4kDyEP75ATZviE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16733,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdhHKUCRA9TVsSAnZWagAAerAP/2KYoeVWGN44LgyxqHgM\nvpQCqdJm6pcB9m3AiyJUtWNNpQ+RstKk2yPmm4UUsdIH7AX+4RZIHSosyRoW\nbqg7xdsWKLHpDpd1kD0NpPXaGwvRyq+wEJ4+qTQlD+1WI4FnJiJ/LqKNAYty\nCA/um1mJn3I3vyayUXZGB0H2+UNFE4iIkhjGV/AXZqKjPIgToJ8IUs3K7cN9\nmn6GQLPKD5Vr01GjLCC/fEBmvCa6wwvbEK+MmAqH5PMU5AuUD7iHG4IPXR7+\njpZj/Z+w3icy5oU9hVFdY87FtseL0VIAt/hBoZpeNIaU6vcPQZI4TFV1YwgT\nPoyDvubeK+KSasK9QX1e0jXQAyw2S0a68xx5Q2enLO63cUk6q6TIr3A+2xXt\ntWqug9b9+3ygI7oit/1Stff909X0QY/MHv8xE3m7Y9GzBC1ZcbWbjjSzynhY\nr/s+cnzjhGrWfkTksSn0nHB+5WkKNaTVoihwIThCFemBmYe6oeKqTzFe3E2x\ncUKqECZWsZmKNwZ1NEUl3W32CMdHJxkSkTMJHtFD6zMkqDsDqNH+aPff+BQS\nHhah3c3k9NoQzHimuBuH5Q+onzeWLS9PRC6IFOStJv3x4fidByqGMrqXljGb\n6OxQuZLR88inxj4GtUXPBc6Svy+AbmBgaDjK+79UXoJFsnu016WK5Y2o9ZKy\n4L9S\r\n=/pQk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"09f43882b317744481f4b6845b1cfae0461775d6","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","dependencies":{"@aofl/middleware":"^3.0.0-alpha.5","@aofl/api-request":"^3.0.0-alpha.5","@aofl/cache-manager":"^3.0.0-alpha.5","@aofl/server-environment":"^3.0.0-alpha.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-alpha.5_1568961171419_0.9748397357823755","host":"s3://npm-registry-packages"}},"3.0.0-alpha.9":{"name":"@aofl/resource-enumerate","version":"3.0.0-alpha.9","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-alpha.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5b0f6f6a5a4b0e7ca58780fde4437e5e1f2594d4","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-alpha.9.tgz","fileCount":6,"integrity":"sha512-nu1c0QvGBsBZFV+V5a0DHDwwytTOgkEZybVMAhKEdzAEvzMB3RuiUUBmjptmEB+BvRT9JjimuukWrytRNdxDcw==","signatures":[{"sig":"MEUCIQCDbE8e977/dy2u0g5FcZqjFqTm4rEp6CELvmGt8rGERAIgH0/jnxzxrEjNA34YQaJfaVVZx6oNtt7ag+QkQ8beP5U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16733,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjSZ9CRA9TVsSAnZWagAA9JwP/R0yIundU07EWFkQfzkc\nR7S0tj3zoUQjJZaYBQuHv708OpDgSp6W5Bnac7lHAV3anPCzVCG1prD5atVg\nvm01zse5E/ZwiTB8ZZQ4mHpfv+ucuZ9LjmrswO6nb78fg28Dy2QR5C4bfjl+\nxONz0P+LF9/F78BCyt98nTCqpVL7qHvUm3qAiwWU3EjOhcfI8KaWMz8CvLMO\nOBonqJBw8ofTEpjQOJriU9I4PcfEHz4Ynxk08pYKqOUs3evnZ9X++qQ9FgLK\n2dliNSgbKxeLmoFqLQTvitwk1iflKo2j2V7KASwnH3uNCty5lvdXvND0WLVm\ncnElFaiYJ8iSSoHgdZGHLdHGZndMXvsQOso44kwFj3UKnNSWkpMu606bfJOq\nmTCVxgNgMtddPyHZNb3cvZ+1OAJesf4Esiu9+ADNMQ6NIMkYllyxWQH7+9Qe\n7izEXDLfljHiJXpmfgLwFxU8vyD6zYrkABxI0G6ZuamMOzks/pkyfstdbm9K\nIz44yQRTz9lhwDTjrBdwO8SHOuZeu2VtpgeZx4sLaY7dWc4Cqu3tkmTH3ztj\nJMKHjqrluoCUiK4hGsJiv8z6/jDsiMONkkv0GeAG3mMOT4reKGa2gPQbL5iZ\nkOu2ukY/1ZDyV1Jt/J/wC9ELzg+pJAFgKeKuWfCHpJaqigKeJPFIfPjC2Jip\n9RuI\r\n=XUop\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"af4670fc661aeb5d8cb38bc049ed149e776972fb","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.10.7/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","dependencies":{"@aofl/middleware":"^3.0.0-alpha.5","@aofl/api-request":"^3.0.0-alpha.9","@aofl/cache-manager":"^3.0.0-alpha.5","@aofl/server-environment":"^3.0.0-alpha.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-alpha.9_1569531516959_0.41217718562481065","host":"s3://npm-registry-packages"}},"3.0.0-alpha.11":{"name":"@aofl/resource-enumerate","version":"3.0.0-alpha.11","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-alpha.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"23bb88060607fda0090f9693c224cb9ec3765208","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-alpha.11.tgz","fileCount":6,"integrity":"sha512-uaj5ijio62E7tCkhU3vVZMXym3cPQuHABWMgjI0MzEi7Z6PVMY0PeIkH6/enZLdVtY3okrpzj85BjYS7cynCYw==","signatures":[{"sig":"MEYCIQDi9FbKZaRXvSGEflkQpcqyRRmNyDTNcfYRKFqjwOLsTgIhANn0bRH44WC3RPYU1L/DVD6ev3iIMtvQI063vcA8Onfi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16738,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdjbEDCRA9TVsSAnZWagAAocEQAIj0CczV0u6SsIcd4lNT\noM4ALFHWo3BM8V8XrAsJgc9YH3+tpFuCRoi9o7ni4xWwOeyWvFhkhHGrdP1f\nW3RCzBM7JlKgFsq/NQzXMwwpK4h3ByPH3POARCmgX3A3YxmugOKZy+kSVdno\nfm7mJQD/iJ0Ng3FvCDP7iPDz+5EVYRA28niwOcTEPrPSukxKVZNFB3PmeqrV\nfPiEQEVodZ9uc64mJWpJY9B6/DF+ClyXJ3n9uaNPcGCNugWZlr53d0GxpUco\nAn3JpDIHZQ9SFjYV9gkNx7qAjjUcS9/saf5xnAaF4eZj9rBSLzVBuhZxojFY\nwlIDFeSuVuQTPEVrmX6Mv/onnK3JHM/eAqemt9rdGgL6XmHjjFciwswq61ZF\nxp7ECzh466LPjc9sz7BvilUxJ07Pk0Rqj3aH2Nu4C9XWhmIf7uFMu0GVUVHr\n406yaj0mVyzqu9+wQVn24ZGmuvbqd0XfFTgZcpVbgCLFHcEPC6gIhEDz2PSs\nw9IluALSebZxdI0RqeRrTh+mzbEhvzTmFzoFiKjCvx4qvgVWXXJvOmSZYa6F\njtTTkAunmdyd1p3WH/7RSEkobe0/vT4xIcQ3aLFf4z8rYTFDy0ieOFMwEI1S\ntjm7X8zdZ+INdFmN78tpzZOPVju2vsmsPtC3+x91bLpZ0YKnl/5oKgA8LWPZ\nPJQx\r\n=btGS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"ecdfe7e68c95cd3ce9eca2c86626275d1d4559fe","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","dependencies":{"@aofl/middleware":"^3.0.0-alpha.11","@aofl/api-request":"^3.0.0-alpha.11","@aofl/cache-manager":"^3.0.0-alpha.11","@aofl/server-environment":"^3.0.0-alpha.11"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-alpha.11_1569566979384_0.7427986735949639","host":"s3://npm-registry-packages"}},"3.0.0-beta.5":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.5","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"317c4424d9bc305fdef0c11a22989c669e2925cc","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.5.tgz","fileCount":6,"integrity":"sha512-dNaYbvM9VMZjdbbzzX4lUdaHK7CPqXRIzXES4rqMZ+mgFG2ylLVd1tOo2w6cYsfgu0g4cSfYMBCPTGxK7RLqbg==","signatures":[{"sig":"MEUCIQDhy/fMNK4yHuT12GvY4CS1zY8H9xLxR0zMJZLpeIzvBwIgRUUxOaOOnwzBvnhPRdfecPRJzeOdTOH2tses6CytJeE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16596,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdmbxgCRA9TVsSAnZWagAARSIQAKP39pybAqpZVNbLRgni\njqCurFzxGjpkQBuZ4MDyyUpyPoOdBmw4ByreEXo5MtIbbfWFLcUDJQTURkkz\nB2x9kVcR+WbuMCRdqEn5otMYYH7QCSKw+G7F7dKpzgecpj+NlkS+iYOPt3iu\nZNqNfce5xTaWprjP1PQsbTpqZOl0dJjUQBHe5+OLCss+uMmJ/UlOIiRuq7UA\nlLdnAqX0BnY4gRLxe4UH13s7obHqGHh/xXmU7jLKw1eu2DGk7Us3hEvXIyn7\ntk1iJqQCYltXJi0+EckzOlvRrCIGUOEtsRGfd1AJiaZv77M7kQKuK39+NJgG\nS+Kk8hYjDet0Rb+j1szjt1mq4IKcrJL009qOG783X/fnqhcMjoMAHAE2PI8R\nbkfk1r93CynC2+phpLxPxL0z6MHe2T4Bw66+DbZDyXIEFyF1gtO4rAJGHfMu\nRWvLTzOmS8qQapsaKNtpNwzDtoVAyWk/+V4/tT+3cYs4yU0BRV5tLdQ7F6Ta\nRaE/etAqwFUPfaaAE2IGA1tm7yq6RSrbYaQq4f+XJzTAx+tn+AmYEzth9TPI\nDm1Q83MTUJ7HsyY+yekCN/O1j5RkBwoIqljBE7OOEm1vXCWrumiBSVybY3Q3\nlEYkEGWTHNaQ0YoCZX/wKO9WFAy5nMmNS860brryPxhClnmjtN+2TCfl3KVa\nB2je\r\n=kewo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"6eab96d111f1ebe9e5c5cff00cf108d46ac4ee19","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","dependencies":{"@aofl/middleware":"^3.0.0-beta.5","@aofl/api-request":"^3.0.0-beta.5","@aofl/cache-manager":"^3.0.0-beta.1","@aofl/server-environment":"^3.0.0-beta.5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.5_1570356319574_0.6634452645558238","host":"s3://npm-registry-packages"}},"3.0.0-beta.6":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.6","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.6","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2d7529e5e48db72af95cf2a8fb6b8c6ba2b48b1b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.6.tgz","fileCount":9,"integrity":"sha512-MxqfFwhMt4Y8+Y97HoS0VHjv9WCVEc481eaiVI0cfAcRDmHwOZXi/JAe8+utgt3xJGqEAnisriJCTvra7en7mg==","signatures":[{"sig":"MEUCIAWSRKDpJqZOnJv1SkhXQdftCAIGoIse1XRTwycUjZTxAiEA6oogALA93S+rGpIrQAsSNJj4MJzXMvMPudKNRHdRaV4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45697,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnBVpCRA9TVsSAnZWagAAdXYQAJ6Eh/MdM7x+laDOZZCn\n5tYZziPavgG6uBNxZ517FqbPQAZTo6IKppdp/kWNAIPuz2EnlBh3XvMZArTO\npK4pj0koZYxcE4Dx8czrsph7NXMj7zqqkIZ5kHFUOpRSZM1H96hIyvbaw4pY\nKvWpsa+qs138q3Pw7akE4HUpl6m4Pi0RhIHtE5Woqobr2ze6bjwEX2jKYX9g\nM15i4UnrLmZdZWtyGaWuHqfVhg4gRGK1+8OGur8Ir8AmSz630hlb+vEzBaig\nC9MDJ2kIysO96wjEbgFzerupI8WH4fT7lFLeb61kNwop8dCs2pQxpNC0s+fJ\nVyDZE7WyD7E5yyw564mjlAuQseerievRkJ7HHukazZyf77rAownVgfNrtdTR\n5w3nlzvI2Zu/XEnYQbMOLCA8qz+H5xLkXw6RsVglvX+UVxs5+UNjYjR0oKv7\n6hY6rqcjqemd5l+SnIO3ERI0QW1hQmbHkTXUUxq0oi8kN/s4ZE4kV2g0Fn0W\nkwWIA75xNlCNf0jvg9eT3YJPBHlrCiY0FZlKCcQxzXtzhfIt7dRTe4232Lia\n+FcKE55DA30fjyu5tN2wVPEHzWaGjIy3r+PgTpqlxMlVAY+8alexfg+/ISrG\nac7UJrxG94bJPYQ7YeQenzywnjW+jLhOvw7pKBp85HtraF+jE91oecSbGp/Z\nthLM\r\n=1dyr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"23e8e9dd00e515c9305baf320436e43f51d7edd3","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/middleware":"^3.0.0-beta.6","@aofl/api-request":"^3.0.0-beta.6","@aofl/cache-manager":"^3.0.0-beta.6","@aofl/server-environment":"^3.0.0-beta.6"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.6_1570510185019_0.9722447943940875","host":"s3://npm-registry-packages"}},"3.0.0-beta.8":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.8","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.8","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d8a07e2a624d32c10a8aa2dedcd06581d1a82ed1","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.8.tgz","fileCount":9,"integrity":"sha512-jLorfJdiCXLnYB7femfaoRH46xZ9l7BpMhvm2qxaLJjp45acKgFB4sGak6Y/GMZrMFTrSAiLtTozWUqSq6k//A==","signatures":[{"sig":"MEQCIH2zvTeMgnPfzt3TKS2mHvXhR6oAOIoMW2I0p7bhGBPxAiBjCJAMUU44fv0r30Ydcu/aKRUdyWm5KHcywO/ufRGlpw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47348,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnCMiCRA9TVsSAnZWagAA0d4QAIweE4r1A4dBuUjfiJmH\n1fNqKSfdWxtpNxSS+XfUt5lDEHWx3UyCn3udVMzDn6SQ+ks2pEfZzvYY4GQ+\nNxmx8t6aB421qM5kEhYeEHluMNartbjlCTbjkNl+z6Z3oqH/OQ9TeaZZASdo\nSICstr2ZR5tb36OSWe/hl33brHa3gm7GSnrxbt1G5UtnPlTxszdePRMwnCS0\nEL48pAxC7IrPtfgfJeg+1sdx9x0RqTPyPVU40mAgCZp4SKUqg+ro5gnlklFd\nqne5r+4s4q0t9kkHZAnfB0Q2cgkzNt8tx+s9XOVnOd+2g9bxYvvR5qi5MJin\nJ1U63NddciJepCg0PbaKnGCr7v92wD6f44qI4C1ruOBvi5V8SV+1ezOJ2sCK\n6reubXkio2s8SPst+9/XWbSsbxjALA2vszY9pJFMnFoBtahQlSuhBM0/PNg8\nBlozyGUsYW3UYY5j+cET/SvMqr48NSTcZ7EB4XIstBJUeUz3wVDMHXcx6BaF\nm/FySWrlVC9XvygykZCy8rmc6PTlm5ilNmqFhM9Oai8NEkuKytqrzG5gFKYO\np9Mc6GjLN/tqyV71X6duyg7q4pG3nEmlEofhxF304ovVtMczpxg7L4X6Wbug\nOEPI5qA7Elxd8vSkZe8qfwtsLw3aLMkNOsIjXW6ltbcZQxqnDyEzkA4QoeQX\nkIeO\r\n=iUBa\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"31f766f3cf621147bfa1530b863757cb08e5fc10","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/middleware":"^3.0.0-beta.8","@aofl/api-request":"^3.0.0-beta.8","@aofl/cache-manager":"^3.0.0-beta.8","@aofl/server-environment":"^3.0.0-beta.8"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.8_1570513698205_0.20615407765246885","host":"s3://npm-registry-packages"}},"3.0.0-beta.9":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.9","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9057fd7f508661b936f4bbfc6c75782947d5fad6","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.9.tgz","fileCount":9,"integrity":"sha512-Md+DjL8QG6vgff5muJxtWDPhsxiq1OPJDiwcgSPpnXZPVMFd/PCUP3JXwjmPBEZcXqkz1l+xOLj9gxbdQVT/Yg==","signatures":[{"sig":"MEUCIQD8nuLWKymshoR/UOQEbKaYD9Ci1G1uHSDXuarznlHJvAIgKYo1yngxnF6+y2H7A+cAWEuhXk+A+08yH0VRPiOzuAA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45698,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnCiiCRA9TVsSAnZWagAABI0P/jbyPxwmcu0YtEgjqEd4\n53lqjxoenos1hAqA/pT3p5W48oi7yRin4fQm7F9jEnlAz8lskx4AVQJZ/1Az\n+1i/EE7F7GIGyOYVdStchOQJK+yoiWPCSJJbaYnvdlr6aMxySdAJ1ElYCU5z\nOGtBQDpxJBr3MHSrwf2Ua1l+V1TKQ8NScQFxwZiVCiI4LzR88VAEil/HqlIt\n6zrtSs4rRSmNFzg+SaihDbgeFxp7wpTFe1izSmc8LtQqpVjiHDTvyDbL/VBE\nAerFA7+kBpg2Cc/vBiFr/beWRFBnnvjAef0dCrlgmjuXkEZnYOaGAsS1IQOV\nI7meu3vGGCJhHqStImrCBTuJTCndOKFqnh+02wOOuABWJuTVgMrIOw4Dgi9v\nflDVavVuB++QlqAKuVyS2S9jhCjsAKpGZZ9u8QkHNvao+VTHo5VJ1eQxGVVD\nb8HTjZUYZVt9kxi5NZeLSgj5bw4n1CQ2zjubyL/kcuTHKYnJ0+u39Bcd3JOF\nUN1p9tn9JR3JSRuvrZSDGfCeFuG6vaOmd3tlfsxQ2uiSHONt73+kovHEoOLj\ntRA5MsEcUDUaSYeF3/sumljJ/SRe10LiLLQLnZGAJA9B3saJXJll0o0qXgxs\n+SPMsUssIIemjGV2YnOscrjAos9wyrlSRvBgx5hOojAiiqfQNlD8vQIikXmr\nNzB3\r\n=fTBL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"e9e6bf24a51611b9b997dc99e770d43466ba063d","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build"},"_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"@aofl/cli":"^3.0.0-beta.6","cross-env":"^6.0.3","@aofl/middleware":"^3.0.0-beta.9","@aofl/api-request":"^3.0.0-beta.9","@aofl/cache-manager":"^3.0.0-beta.9","@aofl/server-environment":"^3.0.0-beta.9"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.9_1570515105822_0.15561118685044395","host":"s3://npm-registry-packages"}},"3.0.0-beta.11":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.11","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"aa1c76747528fd1dffaf00c4cfe18100706d9038","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.11.tgz","fileCount":11,"integrity":"sha512-go28Xlou7lEfghpjwNm7eYjDwzgpxwYfmf5W0GXE1Pc3m5EeVgY+Y47eGQdP7BFQYuIG7PgxZ8SsqiPFvpnUYg==","signatures":[{"sig":"MEUCIBxBWysq4UxOCPsgiIzf3XpwH1CbalwuMVlZd+7lNcqEAiEA0oB9SJogzd4cFSxfm2WgjEl2OiboOC/uogObIfuN0xE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnFohCRA9TVsSAnZWagAAvk8P/0tQfn82EwK3enKCrNkk\nPckoUBphcRQE00ZU2o7XyaVeqt+LzXCWiCuYHVP6SNhCXQSHPsZ0jUJVwXWq\nKjDNJ+5/kZZkmukX48BEZzUBd13oUqYs5rKVaWT2TW70u/ja8jt1khUmExAa\nGVaH1ZV2W/GIGvo/+s9ZtBQr8eqSvYSrNDtoez/KPIukFmaMWC/u7p1UGsOb\n+5a/hap6HZYxdU+lWeVyDS07A3GDdstDdgUExPvOusUDO/Tf5kRSTNdoqC2c\nwMjoGXUyhrduLlBmAklf7xMbj7lBgPvNq2VdD353WXygFTpu+AyuzqIsbM22\n5+snKpm2KLtjGuDjqKEQkimpJ2kjxpXr+m2/mVqBkZ7VereCvYJwy2D3gsAC\nVz7LEM0Hngr5ap08L+gtyf8xgUGVdhH6OdTC/oBX1tKaqAXCUqyBfmsB0uzr\noZyK14Jn/F0SX+1g9mAH5mQ6fmmKzmnRPoLMHw+zuoDQVVHCReL8j6MkT6BF\n6CjzSLYTuKey1PiNsWGJkdTrj4aKW17xJQyBNWWUX6e0rMYPenhQAF9FtK3Y\nm6JUcOwpVwOJFA2/jy+fDZlXTVhMcflRX0tPjqxJSRsr4ncTEzg6iQM+HdwT\nSbZj5wOjcWjHNm05NnvMb79FFuNgRSOPBIPR+KftqJ4gwKiJfzDgtTh0Wcvo\nkRkH\r\n=9C1O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"ad7cdc30523ea031f8d1bf5c62440f80f75a7308","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.10","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.11","@aofl/api-request":"^3.0.0-beta.11","@aofl/cache-manager":"^3.0.0-beta.11","@aofl/server-environment":"^3.0.0-beta.11"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.11_1570527777362_0.1077492176240793","host":"s3://npm-registry-packages"}},"3.0.0-beta.12":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.12","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.12","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"155fc2cb0bf577f151a6f5e338d5a167b6334371","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.12.tgz","fileCount":11,"integrity":"sha512-HXAF9bmFPVuuMQp6HXFeVwuwyvKuXGH0TXaQYedpBJxxH+6oqYwoySmPCXotuSPZVwny/MG7zvUDjwu+iWsZ0Q==","signatures":[{"sig":"MEYCIQCeNhhm10LxBTfQV5yxnVwiE5a/HO3ChFUXmgkEihkzWgIhAKxnytHXjom43axpFdXU80uVKbxULVbEWlOLE1dlRm1z","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":62977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnFysCRA9TVsSAnZWagAA5/wP/3rNJYpLec0Ob4c7C+9E\n1JXAAa1rD27x+XL9ammA3R041lRyPnD+cdBzCr5CEWCOhH29IK/Ed3SSK9Yg\n+ScG9Ib6MQ8BkAVVJ4MnVMCxhfj52jeuXCSdj3Bov7xBvjChfnQ4or1fuHGk\nxSkkB+H8nGpgKut9SEQWBDsu7OY6wM9I3nyfJbHyutHeSXS9cmwR/qgK1R44\noR9OAJLNa2NWdDBcdwwY4/fnMExPQTU9WjKc9Fd6hFTD/myVpV1Fy3P4GFjc\ng9UDferxh7CfG2iYXO5yJxE2i7N2MOkkOKoMMaz+DYv5NenfDncP2bRKqjji\nS6iJsGfBc9xy0OaJF7mMHm9SG8saH1eMQnxdXHJAsxE4sutwOV8IrwqGZoel\nuewPaP6sBMS4ehqo8T7rv1LGvAgQcyO3yZB1IJSHuYiLRXfasLCS476yqSCm\nh1MZCGoyj70TpU6Z+Qfx6n07BtsiIO4dE5usmHu+7WPtFKmJN74Xp4ou/e8H\n/H4alxz0vpuhZJNHv4WrwVrWPrIULbSVLNzdx85xS8MvAQbkSly5CIdFngqB\n9cO9Pb+Bnp1CL12l68ewucSV+3UtwFNIg4L3dEVdWx0WSmLVTkyeHGUFVzXV\nZkfrCcewZFdQIT6vJXXTUBQQiBfSQJ4pCWxN5qn+lDotETZCyCHocmSBvxN/\nT0mK\r\n=ApLs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"7fefe74af1885e7b807b6ed3522d9ae661e52645","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.10","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.12","@aofl/api-request":"^3.0.0-beta.12","@aofl/cache-manager":"^3.0.0-beta.12","@aofl/server-environment":"^3.0.0-beta.12"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.12_1570528427441_0.4477146894820141","host":"s3://npm-registry-packages"}},"3.0.0-beta.13":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.13","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.13","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d17efc3238f0c28d2773b9bc0dd1884e1cce4db7","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.13.tgz","fileCount":11,"integrity":"sha512-TzqDdAmnWKsQcRI9gGbD6p6NNwKnf1xqKYP/hqQc+0FasXE/F8TIseYxW/0J92i4B3Ez3UJhR1k8Savlu5CAmQ==","signatures":[{"sig":"MEQCIBcKeIXe7/p1Nxrv80izWDxdIpgtjX1CVl+kF+Hg5qqhAiAQ3vkmrZKtADTDG7oPGd6gQXM7O0MFTQActiiWDRNRfg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63001,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnV5pCRA9TVsSAnZWagAAZoQQAJDjcFgVitoIbefvP1B0\nc6r1Nd519i9L6FqooMjV/0usTgQ6x40Aop2V7qH4agMZVmBugRRp5CFBJYMV\nDEw8vD+/qFnNaaNWQSYUdVPdGyRsutFR9yTm61Mcta0sn6IfxTk24HmTUZJJ\nPfys8aypLXCqyP+V572xAR37+cqprxElPPkAqFeMmMhTCHynMpVAnJJQ/Sgn\nwV6pPmiUOdSXr4ofeGdv5Rofu2/cmlGysZqWKL2xBibRmq4t7r2YvX3yaVi8\nFrN5XizRnlUYbMDO3grYw8hvzCzdaKs4tLiz56OxehSBFGf+1c5X+DuuM4MP\nrOg6ovUyDLXPDrbjpaMLBMgmWzMths/WKeNaPfXQx+QONGnoeAGIGQ+fwwk8\nGuSl00MehI6J/54jYyQNXS27LR+ftQGExFlRaeWZbFZVr9nL4DSHgkrV0hlC\nYKAOGn7Jv8Kp+cBDawav2UdKpP7imO/HVVvCqIJ+UDbMKQnZXKn2hLiihEQd\nAOK2FPgNFXbsoA6eLQIP6e5u1BBxs+Vq2D4ZbBdY1fBtiJPuyh6E5VmM/RY9\n8YWMBS97Nhp6Kt+cXzHylud2bxmwtmP8o268SqHn5M1yhNsaNUbYntr9+BxH\nu4yysg7QzRB3sdUdes8ANiTrM6xHFb0SKiCjJ5kltKupK6nwKojVybk/l+QL\nPOM0\r\n=Ffqw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","gitHead":"aa2e52c46ae9451fde097de4734398430f2127a7","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.13","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.13","@aofl/api-request":"^3.0.0-beta.13","@aofl/cache-manager":"^3.0.0-beta.13","@aofl/server-environment":"^3.0.0-beta.13"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.13_1570594408749_0.7166144606769833","host":"s3://npm-registry-packages"}},"3.0.0-beta.14":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.14","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.14","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5a93dad5929c30f7ad394287d72bb76fef4b7877","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.14.tgz","fileCount":11,"integrity":"sha512-fC+g3CwXUx1FU6OLn7vz7uNZP8+ObFcZO8boJEOdOG1XUk1ZngdJiGQeYz+bkiNazVpSzRTw5G70V6SNMU/d2g==","signatures":[{"sig":"MEUCIHN5juUygP1wrNHdfYkfZXocVTdGvecqB2Atac8EduXrAiEAlbjRnAx1Xo3DL8sjC1ZFv8YAH6oMhoWUEqT1HzEpmds=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63026,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnWMGCRA9TVsSAnZWagAAZE4QAJkX7ihhrPfxZ8Be/wL/\nMMXCxSBR9Crl2YoT4DdlwesmogMuFFrR9qk44aVB9VR8fIHNxo3w/4RY7V0u\nUZ/BKoTZC+5a2TihUtoVyIlPnPZ3SJGCZ9p/a3J4I8jifeNmP9+dSr52FGWR\nymH/dtZDA5Hi3AI/cFdEFPNOEW+41CWD/TuaYV4fDkRfS78CWVa+fufVk9mD\n2d9YQXahc7PrzGBZBi+WCu8FkcFgtv8UnNzBeCeK94U1QkG+xcLal0dx1tPt\nGmy/D5DcLhRQ4F85ZsAtwx7NiBafGia2KmnvHrKAMg3KoQ5W45ezqaQfmI6g\nxpDjzBaRJUkAt5LJGOvHY0NtD1r2UgmGnKgGeL9aCOTrdMM9a0iDfQ7jGI7r\nHvA8m6lSr9fLhlFXxccsapb47vhr2ROqKLE18eV8T5dibPuNA00JJaQyzkdz\n9GW069dPbd5nM0lJHcN64eIYxiuvbhk6jrsZ9aMViDphthK2Ks+h23UZPHud\nrWR98wns4aY2LbseCh/vBPX3LUWXDMd1Au3OtYHizunZFETvccuWclEN2u5K\nuPGZqsFd0qa5f1ODMFmRKYMHFsUkEupIbWnoMWCnnusEx2Gxw9zlK8z5naOQ\n4zFcRGxhCt5EFYWZkawP/9rR7WtP4DXZIMox/pec3MziTQOwZTkGqeF2SmjF\nDE2E\r\n=Li4f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"80c0c882f3af67f4584dc8d38de8a62ca5632c94","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.14","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.14","@aofl/api-request":"^3.0.0-beta.14","@aofl/cache-manager":"^3.0.0-beta.14","@aofl/server-environment":"^3.0.0-beta.14"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.14_1570595589498_0.9801564761378747","host":"s3://npm-registry-packages"}},"3.0.0-beta.15":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.15","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.15","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"63aee7a7d91a38f11b8d94c07675abc2eefac91c","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.15.tgz","fileCount":11,"integrity":"sha512-4wv0PYnjzxtyEy3uPQeLyTOhPF7r5S3ncp6fQdgsCoSWuT6rZI5foO7qcaALqp4/Q06zrnyhbVrCix4lW1UkSw==","signatures":[{"sig":"MEYCIQDozPrQYfq4Sn7tI3OkwmrOiy5gNZZm+kDImZCBMPA0vgIhAO94BjsU5aG1bwVtkLVQHUm4TP9tVyDjEXflD7+s/UQB","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63026,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnWcrCRA9TVsSAnZWagAAEGAP/1vpEVEbuHToRUKTFof1\nFYyLJ9QA4Lp8/ujXVej2LNEm2enfC/y9oExPOzU0NsJs/vMfzoTsSu2sONmw\n0D7/22LjfpQIhJmtnTkIYTEESBKB0WjO/6WqoT0UMxZr6bsvn/dUZWZu1OvP\nnNkmtgfQqUsNX7qtMsphNpVzMEmU1dlpZh7i3cI3hNSHaakE8fCslHKwu6xK\nRuqEPzx+74KIpTWtN8v8/P9St2D8t/v28oXhXfjNjl6OXPZO9W+tQzHLjZuI\n2NZjHYcdqThVcP8m904Z/B+1cE4RcbEd8Uwz85Ibp+izBiZxPHFoWZoEJdtF\nHHQVMn7rAm30eXrz99/hImzs+x3Q77G7n4ioFW+ULxpVaxErLiCErCy3Lgi1\n96hDh2y8F4OaslwlzAyT1pb8OAH36r2vjIDz7/nvudTryTSzZWK9lk88L6Kz\n+Glb+Mq9lXELRkyCIhx+yfDN9D8McuV9WigU31IPKPrSVeHBDvGMmjdqw3yb\nP4RmxgZTZ+rfenjL6D/hiNB6UR6AfsGZn66ImYRKV0vVQ4Et4Z5TyZ3MjD3V\nBDmLIHnJd0/hSdojDLlWYj8XyKEtmcax6R3qrosbf87i41hRIC29IBIO2a7D\nAeaH0Fw9fuycYtk5d+OCQNaaVA+Z/OsZ8HT8dodBQi8aWb1aU2pMPSwk1vLv\nOLn6\r\n=Igt3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"0fab45fd3f4a1789a3683dbaece87d579e9de597","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.15","@aofl/api-request":"^3.0.0-beta.15","@aofl/cache-manager":"^3.0.0-beta.15","@aofl/server-environment":"^3.0.0-beta.15"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.15_1570596651038_0.7837191744725787","host":"s3://npm-registry-packages"}},"3.0.0-beta.16":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.16","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ba911ca6e3a4005fd1f78b6e96d0cde23cc585f2","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.16.tgz","fileCount":12,"integrity":"sha512-ad6V35rnvXNF32aeUXj3pWpWQjWZbHcMay6Sojfo4niVoOmoyukUh4TfXcrjiGM1stquv5joNxYcOmTGeilDXg==","signatures":[{"sig":"MEUCIFAy5Myim6aMoIGlAd7ATljEYHZ84meDbYFBIVofZoS7AiEAzscYZUrXSSoMglQOxfKCQ0/4dVudx794Jx/XuQ1t8gY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":63067,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnWq+CRA9TVsSAnZWagAA2msP/Ay6xbqw8T/K0+RgAdLq\nhZ9kS7gaG3XBiD1XJlRQNgMKBSPXwdEo4Tp3ibvf4ijV9nAx3ElzoA7d2flb\n2UDg+a2RK8+rGwi2xxjT4coXJzCb6YhRbEO+BO3aNycV0cHeNoPJeDtgIPTU\nK5n6siJHvtt4pnMe4QuM1yA60pKMOjQLHI4Mj9jvqm1aDvL1QESXfwUVvnex\nlmC5zfgdYCNYIyu/F/5cxKB8n03jN4lnWEftUCKqzPXkETmjo/G9pLtZSuy0\nrNs8i4A9PuKfmzhF383WCzUZEUZm/wdPikK5BkN9Un1LA01XzKk2stM3Lxhj\naV+2TNhuypMAtGQVnZvqjePxhsW1viwmUOyH5vsj4tsLwsuuzgYcBepei2CE\nnWmt1hLlNBd2hsgQv1/A4cyMwfwS4yg9jhJRN0wIK2uLzDjkq7BtE+FFpq1G\nT3ZA5fyeiGlga5JOOMCjz8IMaF/LRYD+PbS6LAIBg517ulZl/kMCfptbhOVV\nO42WW+5FzNl65CqqLMcb6/N1vESvAzw/UZdEPrRpbCyg1hoCEGxllqzAUHL1\nNtixEPMaurN31DqAlvl4DiDck7GZNfcyzEVRWxjtXuOpy8jmTPtwfYmrRF/n\nDmbIr+XIgbTPRXZmgHsQy6boAX5CzUge+pH81xJUKTFgQ4TfBEyYqaokJZhZ\n614q\r\n=g4Zv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"32c2f889b64c30fba2458f8704f7c135b47c5b95","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.16","@aofl/api-request":"^3.0.0-beta.16","@aofl/cache-manager":"^3.0.0-beta.16","@aofl/server-environment":"^3.0.0-beta.16"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.16_1570597565896_0.07250396369689849","host":"s3://npm-registry-packages"}},"3.0.0-beta.17":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.17","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fbe074406a496be70ad9d0dfcdfa7430e60f0691","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.17.tgz","fileCount":12,"integrity":"sha512-NFbxrEpoyR6Df9hOIIH6Zzp/R2KrN81bqA3jsWV+BvPdIQVv6wKhP1QmSSVkG0hdZ4rdEMcqYXoD/fsz8syOaA==","signatures":[{"sig":"MEQCIAhEhdvVxgd8X5MsN7av6qca9T382MUveypA+DHE5MubAiBNT/DDI7O8um2dU7GyeYLJfw+ilIs425jUBh17xNohRA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":75275,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdnW83CRA9TVsSAnZWagAAGN0P/0+E5+LbdvzwgKfWCiAg\nn2blwuSWv+VdFVD6L+Ny8AnHfUtdMBKLBAfeHIROn9R319H2dlpZK7cI6IAp\nYlC8ygThBxNl4ELmW9rDjPapt5xhs8SqOYz/Y0tmFiIoY/MBNgKdzAikslQU\nrfDcIUPDm0+aZjPyD1QCH4C6qYuL+G2l6zsDM6Qjsqtkxukj7FvGX+3vgc3q\nYlwR0Q0/xie1ara5RFbDStWkqbdGEGfwD21x9WVjgcUvrmDySn6o61jDQSXk\nWz4eqkVIfx74TbFpEwx+dzLuq1os1iQkf48T9Yos3OP6+TxW1G1K+cizUz4v\nREaqsxQSCcLfg85DoVjT7pvng9br+MDN8g96qiADFtzKENJaQQQfpoKDH6Ms\n0dvhGLM0LPn7hDvTlpH7qQLkNeVbVD1IIe389G9bCvTfUItwKAFZ/16Y86nx\nWzPLLhIuomLj8CgRQfj7vEbI8yY12uPv74ZwaJk20s79m++YShKOzqLVyBN7\nAL+dSmKnliI9VYdG22JyTTmm+5pVLmSEra0ugb3yN/tBgwYUxqz5tKnSXgcN\nLdLX9Cy+flGwexOqYxKm4XXQ1JWnvKo+1+1VRJ3PRITvINzzp2oIebL8TL0z\n2KtQn0WXD4sxVKxR8cRxcphR6D/rzmadAibqf7CCRCaGIFl889NSUPH4BfBU\n35sA\r\n=9RQh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"1a9a0010d531b8a6ab7287dee07687c312379976","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.17","@aofl/api-request":"^3.0.0-beta.16","@aofl/cache-manager":"^3.0.0-beta.16","@aofl/server-environment":"^3.0.0-beta.17"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.17_1570598710815_0.6539291464221053","host":"s3://npm-registry-packages"}},"3.0.0-beta.22":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.22","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"73a948a6052c98a80c03a534cf22fe203dc7daf8","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.22.tgz","fileCount":11,"integrity":"sha512-eVZfcFr/x608lo0PUCfe+omP0M48xdjKTgTnyVSNB5gdC2UNXHypc8+MDH+dETpdpYx+FI6/+yoA3xffu5vI4w==","signatures":[{"sig":"MEUCICAq5uk5AN2zkPwF5h9iHOVb156K0EtSPdS8JnIL1JnfAiEAthk5uX10HS6CGNfzDtPdin1rOcbZPOYhZd30ZteS8Lc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoAfXCRA9TVsSAnZWagAA1zkP/1zPt4ZyF5NJg0eIdX4I\nTKOKCPjk49FvlkGrL7S6+wsBh31Zar2MNHoC6rwHLA5KGtNphnkwSV5q1EDc\nCl8H+4Rz/8DVJywPWQurPEQeU1jifxO9RnRwvnWU8MqWFqfg+35WYlPs5pwG\ngn0qEQZYxrZj419SA5lHqowmIboQPwE052k5yirNMvfh6L0vkv2f8vmE2E/0\nN3wNnJJEU4KCcqy3/cYuy8vQkFXAFMcRdb4D7vD79cGN0lZA4+psiwrwLD93\nGC/yg7wGirewdeF8v8aJLQgkWA6TIKZ/4RdpWtkQhy6w/OasOVJIk74QksYe\nvLwlK+F0lk0lqilYg1efT59zmonM1GkAU8/9NN8NoWCXPfwRmmFQWEY+Guj+\nRyhvDchY86koVxMM1L6PD2S9fDfWzMKk7VfG0pc3UyZZiiwPjiNIB3iqQctj\nYQ4KkgCCYX+/lGTBTkHSCBvm2pfHDKCToTCodSMLRheGl+ImA2Y+jlcEes7R\nyMLI9h17vtXrBubqy7mB9qX7M9ga72C5P8rhyUL3KLm+mG9pIfruFTD6bsbq\nB8euNJOuffHZ6vLxyhlir1PYiKhCLtTdo3TgguV5Bgtv9f8XcgZvsWjfES3w\n0GI5cjU2tzfP/F1yUcK5yV4bGUGt+pWsTQBwEB2KXGcNEw1KvpoINRV4xij2\ncj/6\r\n=/d8c\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"6009b3c38f31f159b65265ddbc3653c0087909be","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.22","@aofl/api-request":"^3.0.0-beta.22","@aofl/cache-manager":"^3.0.0-beta.22","@aofl/server-environment":"^3.0.0-beta.22"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.22_1570768854460_0.24893753327781165","host":"s3://npm-registry-packages"}},"3.0.0-beta.23":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.23","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.23","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1f17bfb7bd50620d189ed36bc4aeea67eb201c66","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.23.tgz","fileCount":11,"integrity":"sha512-FdwhsEWao/k9wlK2GMREniBuL05xEOR4bcBuLQ+7xKv1CFqfehWe1j1wYy1ew57tjkzy/IOw0EuDUFbtJX+WIg==","signatures":[{"sig":"MEUCIDKwRcm7FQ8lwPdpDQPeun8cZU5PgNKdytks+tDGifnqAiEA8X/UiVHwajcj2TdDqbUc4ytymazzcJC8mJbrfxfmlus=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoBWzCRA9TVsSAnZWagAAqYwP/AyN4g7FM/u3WEdRlVPu\ndHBIY3mQkql06ZHjfqGePhvFwpCznFIKwlB7Rw7TvADOlCmcfLEN/9LK2E4B\ndTmWK4clLYzsVtiitdyjF/etcSiKqTercsz+WUoaU4sQ5EzE/V1VHdEPsYWr\n34Lf+dIWGYrqOwzu1jOI5XfhLdAqwJ9gX9dbDAD4LesIB3UOm9K9klXawSZ4\nS1rOgiqA64IQuZ9GiaKXzgto6MwZUQc5rCz2vW08Pi+HlDdifqGv/BAo3ezV\n4qxipfCBiwzFDclRonFP3B96pJUYnZp4ucvwOZ5aw2yysIFuJIRU8XTw9ziX\nwFJUwXAK7uEXc6IQEM27kke2NWEVzfIq7AZCKYtTv5tcunVbnLJQ0E81Edx1\nG6trqBquU4JhG5MOfVyQhKQs9TEdCML7vuyBYotrsTuNlsTmfVhG2o9kxL0k\neZMYRe6wlEnRQsO5q4wB+shS6CJ5sWccz84RsgUaKbiDR9uDls+xOcJ3Yswy\nHRWSYkv9+uZzEccKftfRxa9xIEOkHneCboIamzYrRAcuod4+KhPixgbo539y\nAlBm0nVBlrH0qc035ry2/GuMPtyEVoMmoT5yF9wg2w2NT5L7lJ9mD5Aju6RD\nrs/jaNdFWe4xdKVNUvSX97J7un7mDwctvt5yPQTRGSp6T206NS137vcFgDkT\nxrpC\r\n=v4Tw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"35327a525c0190a3c1ee36be061e25eeab73ed33","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.23","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.23","@aofl/api-request":"^3.0.0-beta.23","@aofl/cache-manager":"^3.0.0-beta.23","@aofl/server-environment":"^3.0.0-beta.23"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.23_1570772403123_0.16836148875393286","host":"s3://npm-registry-packages"}},"3.0.0-beta.24":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.24","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.24","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e17cd0b7fc52f8bafa9553c300b5cc06dbd9bf47","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.24.tgz","fileCount":11,"integrity":"sha512-Ej9v0PmQLfw6J+xZurhT+1mNKUOcerAwwfw0ZIFasfBCGir1Uqcti0HjhYO5kNTv4GlFxTT0R9pQ/XQzyCRGmA==","signatures":[{"sig":"MEQCICuDDinRvn7CNJZioviEfwWV3z10FkKCqqgth+j3mpcZAiAaEgfapBC5yKjaCup9BfRtRVYB03IXspeoS3hOk6cMKw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoCKLCRA9TVsSAnZWagAAbpAQAJppYnX32qgfWvCZHP9L\neSWujvf70xcwYouK5dewhi9GosbzajbBnRCWPWO7+W5f/LV+zem2ymhOzeO7\nJSy2h1fLcRskeWT4DkXrziwabqKh6Z3AgCt5xXbNVkTw+0K5wl80YPp8xWer\n6jOROgVXNEOHfto4xBEbOsSFySKhI5Pi8glMzDKAKWaXVkegkwGBm7dxleCg\nn82ZSTunIkggzWH1QeQmeb6gavCPkc32jZcUJSQ1x0JDQnP1pbSftdoh8rHW\nsklcBPwKKYW5gKIb8IO0mT2W9wKrNSyg+9YOE4OTjpe3c/7LOpBoutcNERz4\nvJaW1lXaku+3BCKxpxs2wwZqJVHasJmayU4HjjyHVheNvzJDDlK82kRvqP+s\nFyPv8ENyYbAk55WdEEKVnfzZJYuz5UxvyTI3O418TiPoK54BGgAB++Rs39U6\nD6pmoWEkObUO9dRBM4u9QGW8DYJGtfbXuhqvb7ZHoHlZbyHktJttZk9aJP0m\nHgi48fmyexBpQNWsb7ihLqmFjC8935/H5ad9R1qIPHWcFcVnqfJEufSEQJas\n/+aBpPw+NVnQXCAjNQ6RV5xZBeZmeXS68ebcrDKqW4wGlmcj9zRodqMAS49+\nGDFx/adXHefxj0GKNjRQsUbrAWpMLdkNiG15j8aQ1ifZ9IzW/6SjRUVyywXk\nux9N\r\n=K//P\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"be81016959caf66748582258c92f8c73471a9f67","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.24","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.24","@aofl/api-request":"^3.0.0-beta.24","@aofl/cache-manager":"^3.0.0-beta.24","@aofl/server-environment":"^3.0.0-beta.24"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.24_1570775690610_0.9809520232510505","host":"s3://npm-registry-packages"}},"3.0.0-beta.25":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.25","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.25","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d60544c58404e602446ae161822f6f34881be46e","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.25.tgz","fileCount":11,"integrity":"sha512-96UJ7wokYRv87d1elEyWULi4xilAlPxVhFtrwH574QJUwxbaIrSOqbb3c2tuzAcQAnGEyy5K8uraYwD5tcng6w==","signatures":[{"sig":"MEUCIQCKa3CHI0wn/6VnOXWhcpZIkaRS44sHEcerPo4JYI5ZnwIgdj4jot3/JrQM6TuTg/Kn3m/3Ka0wDHDkhNfDFxnvqd0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDCdCRA9TVsSAnZWagAA4TMP/Ru45y9ty66dNXSuHlVA\nPvT+MFW4zEOWdiWtcTPISHGB6iPsZl25ftUiMGxatVxbbaq0pnW7ai4A8PPM\nh33l6sn7MyLJnn69oQV1/o4yJ8gs7BwePQzyQio9+8hION3l478tuELk/DH4\n55Tz8UO50gNODUMyC1c6qM7oP8HvwQRBS5MA619yotU3c7O+DoQ+u4gFCZeJ\nMxfiY6/uL3tbsN4jbjFX5F/UMn7xwmM5Udz+pDlUXsY4bWQjF7J4i3wk/JwL\nMsZlLtOVatVSpWeGKgDYlpBC7zXatKMECOOwkbKWFA1w3w8LsNa/OFSdio01\nuSKDz9gZhLuCorY8vH5uOh89JwO7kGf9D0tcRgthkITE77AAynAYqIfV2+hv\nuFugSIADxDeU3mtdMfueTgHFxZj4r3hrkmgOLulljeSJ/eFP2rCROPRAi2NZ\nhLGIK8y7g64uN86koasBfLf8Sg2bp1KBmromRAlWlvJVWfLmJLGVmkyoKm6q\n8xXdMOomG9MRh+GuDbhy3YR9iUrCsuWfWasIVbqMzGyLHSxhuhRUozi+NRS6\nJ6dbYsIKq2FAtwtLexkaa97UHbYGhOslalaXaCA8XQwUeauJzkUFAWiuOyCv\n1nhrLwneb8XxjJ6/pjUoW4qbHNEeDQ6IADOjo0WkLFgogEvKW4HfBxDJFB11\ntG63\r\n=A17/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"658a5f60a694ddcc2ddc62e8db80688cc6b71c68","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.25","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.25","@aofl/api-request":"^3.0.0-beta.25","@aofl/cache-manager":"^3.0.0-beta.25","@aofl/server-environment":"^3.0.0-beta.25"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.25_1570779292571_0.2150314908305968","host":"s3://npm-registry-packages"}},"3.0.0-beta.26":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.26","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.26","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"46a43c4592aae895cff53a362207ca21f6e02b13","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.26.tgz","fileCount":11,"integrity":"sha512-t6OOBy90hOvRdMO3phrCdrhCagPoG8CocTI6/15bf10J5cLaURh1OS9sFo6dkNtOI1j+awvTx1rhAqPaAdqFoQ==","signatures":[{"sig":"MEYCIQD037mUkNvyE6zNVPXkGj05v6aD5FRSM3Hf9XD9h2h4SgIhAMH7ZqGlTO0Yze5ivBU59uK4Eqgys/hKgw9zPl+gKKWc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDP7CRA9TVsSAnZWagAAta4P/2XVoH/3NctUXZN3hot7\nh/mw+emlJARnKyT5hPpNX70Pqta7ntmehJGBJSZD3MEQF8TiJVpjCXRGqlOv\nZ5daVN5+3dwhuu3XJWG8ElZCYER40aYkklcpytOtGwEUzRXCq6M0FP4LIN49\njjbseXoVjxRXqhoJjczcvzEULhdlknxR5FYIdmmOjGY+YL6c5XCH35l335U2\nR327Uqj+MFI+a/WHGGwxS+DCmFebD4d3TtJPC/ARb19jrKUQijpgCPaaf0Rm\nR0v1C5pVVPtulGEWAXz4/Teel1tbiKfYqd4jWv9RSyk32a+0lV2UceU74Ksu\nMdNA8Vbv9JRY+VbET3kW4IWotxIMwepY6axTGlxZ1tau+WeiG0oiRvIvE9/b\nmK5J9HypVP9t7pr5hITHgaF5nfWTubVPg+KwkjDINPOkQyiHRRDd+5XtYjaw\nCm8GSWlQzdZTXqhOxk/BOpy2naE0UmKSgcHBee6XCSZEl/TJtBLFhxdZL1YD\nLfR/mP6UzLB7FLG7aNNxzf0GNUnQuXWMCljNyUdHIibAqrFdd/UYz5W6X6iy\nHr8mM5IPBcuVez2HKllJ9DmdzIg2qXciff2Mh+7sHhH7qGL+1HEGbLFaqqWA\nj5IBnZK3l5SVGQrZwI6cJ6EDodXfyz29pK0tE+L2FjsSXlcbsstVCMJu6Pgm\nyIGU\r\n=FenH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"12fa62b6d27f95d1517f1ec4707c284b865a7081","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.26","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.26","@aofl/api-request":"^3.0.0-beta.26","@aofl/cache-manager":"^3.0.0-beta.26","@aofl/server-environment":"^3.0.0-beta.26"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.26_1570780154362_0.28924542071821735","host":"s3://npm-registry-packages"}},"3.0.0-beta.27":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.27","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.27","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"864e0aee88468144a42f74ea0daa196bcad242a1","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.27.tgz","fileCount":11,"integrity":"sha512-Llftatx8cLSqjAsA1Ma6+9HIBR2zdcxcbaP77pqiBtOyzu81UYXxLrwwg7BRvtXzF3FESsOWBgs0NeSGJyVGiA==","signatures":[{"sig":"MEQCIHlmKRU0LnYotOf4+ssNaNQNgwSXbAgvSN1HwsvyR9gLAiBhXt2AfhNnrdzWLnSjSR2tZd5Y9AnoEI99PB/EawrcFA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDUfCRA9TVsSAnZWagAA2k8P/2EbtuvETjknppUqNthC\nEb4hDdF+1px4QTo26w/r8bAODESg4n8iUVtR0LdbjRh9tzjpfP1SwJajN5Pi\nFOFPIU7IIWVQ6TN9vQkS2rYSlp9q22Kh7HHkLvSb/hGfISmvIKdo71fff177\nvSgXwQZigLKokbVlofwvdtK4pI3lxMbmEup22OyCFH7ieSlgydMkolx5Yks9\nlWDv3hbesz47tJNTxT85Z1703XwuNJgtVGymn5IKYUeblBc4Lh9Jm93Mbuaf\nm9bqbop4gHSOkK7NDcGpG0EsnHVJP7OgS7BEj02SgccETsP7coC95MAghOxG\nZWFPTO/2ZmaZrXPqg4rn9UhP05ZwGyzBNV1o2TRhCVFCWiXFh1ERle4drZZ9\n1AVNpXsW0AVeLgt0vse60ib7lZxgwzfbveEh5ePrSqUrZUvcvVz15oQmzxOz\ndvaRphHpJ0bNG4epq7gVfiSgVcv4eStQbtpea0qKDHEpR1997FGRrP2FkMS8\n+hOqBNUy6LYXLxG+x8JX0xrLCeE+Dsbv8+P4mTfslN5DJFhTCgVotltSblIP\nWh+0wdOp5kVMdoV4A7ITke4iagtdl5sNnBYOvPw50aWXnGOVLYi5nOiSdW5Z\noN3JmULQgBPEvk39kZIU2C6/jHgg9Z5tL+C2+PmzI6Apiia5uuFMERZue6In\nPVj5\r\n=IS+b\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"de2f0be87aaadfa43212214d4f491d68930b2495","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.27","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.27","@aofl/api-request":"^3.0.0-beta.27","@aofl/cache-manager":"^3.0.0-beta.27","@aofl/server-environment":"^3.0.0-beta.27"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.27_1570780446336_0.9936009801752781","host":"s3://npm-registry-packages"}},"3.0.0-beta.28":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.28","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.28","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"cd2d87683736c27eba4355e26a828aeb17e3044d","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.28.tgz","fileCount":11,"integrity":"sha512-stAH21ftOI699d3xwnzjhD+EgTFKPtjGmjjJNElTrjpbAEiN6MMlAfURh3L79xvxMuqIQGX5zZwnk25+yqAu9A==","signatures":[{"sig":"MEYCIQD0vnJ0jFkYDkJLH2WuJIZzt5ag0xcoIKhkJ3zrCL/f+QIhAMw6imbp/ZNohB0wZsPxa57SB4Wp+t1OcniMrQx/YO1l","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":73651,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoDbGCRA9TVsSAnZWagAA5ykQAJ8k3RGW59w0idf3dgpR\n1Rtf3xFg1q3OM2O/0oRTYDGQ/Znbf7HYxhfdVYzlMVpa+Uazuj6TdTtCpXak\nxtF9JKXlD9cySbQiGaQKJEULhfbK+BttD5s+BJqv0uTUW1pzIQPyHYRlRYOz\nVfI+CrYEaOH3a+/PrSq4kXWY3uV/urCB03kY68ojX3jssFKCTZtfoTFQ0c9T\n5/sWSr4ssgCHgHncbZNaJzr+HTNXpf7ecjnguYKtsu6zDDrB0nWKwLrwo8Qj\nQ1DMKmeCgAjnzEJwpE8JPymrQj6UzH5dX5f3WmAASzoL2nqs0SkrNj+fhJhR\nFSm8XiGvG1jyqQ1hhPNosfz2d3rfjp98E3Av7x/lGPUVaV6brPpZ0Mc97HPw\n6fMkt7n9GwScQXMSYk0pdPxFVL6PWJfljRollvUfWsCA/LYwZKUEuFo9PO0m\nzE4sYo5tqlSOTgrl5jnedAjNQ3gPWVteCEyQit6CaqOgQFDx3oCVPPNAjYaQ\nGthl3uKz3qBwaQ1P+wtfdpGzvokxkB/OsayxdJETK+vN4UWwUxY1t9Tbs4/h\nknEkokO55mv3P7DxWEj6mWzKXvk+l4veuL/DulKW6FsFx6Ig93D11g5p6N9h\nXjh3OfKvNMqhuIqhpyY0S00Urg9VTV0B6umU2O9VofzRXUQiVMLzs29tZ7KK\nTF4X\r\n=Ekwk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"dbd14b0bd931ea76999d514d051dcd0a3ef6a8c0","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.28","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.28","@aofl/api-request":"^3.0.0-beta.28","@aofl/cache-manager":"^3.0.0-beta.28","@aofl/server-environment":"^3.0.0-beta.28"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.28_1570780869705_0.3530719917335461","host":"s3://npm-registry-packages"}},"3.0.0-beta.30":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.30","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.30","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"cbafde623c5dc3a7fe0ceade6f6f48668bb461fe","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.30.tgz","fileCount":11,"integrity":"sha512-XoYLz7/5Gn/b9NA/twQM1cqzERlFXpfEXLqbB5SIWz7plVT9LNASyoRw6jq5Ecs9oHyeHvFsFXQ6Mm66i5WG0Q==","signatures":[{"sig":"MEUCIQCZM2PcHW+floAChVlKI+3f3OJ7dxSjDxu7NUrT3GBROgIgP6KLS9tXcFfz+WPvLsxSgv8XOGm6raLbweJYFV03F8A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45624,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdoQkqCRA9TVsSAnZWagAAdhYP/RY2K7lTxVCW/4f7cCNZ\nnTDWKHoybEDc/uuabppNVkaR785hdXu8IUQi4sSO71rGkiIYzwosS29HQBI/\n1cEAq97zs0lhiAYliW59tLhEKIJKXvpRsW6U5ukNarvcUCtcPan6Z4Khv5rc\nfsQszcxM1uxKd19z2f5EcnofHGlHI+R+fbNx0U1Rl3SkazgfADtW74IiQwP5\n3f8tJLcZRkCG9mn562VOKfUrkxwItqHen0wpBEEJIU2xMYbABr1RkDqamH6/\no1mB6h2p9Flxe8qyYMMlBOQy8521o4eDTYPLuebEEtZONTm9wBAmp9ywYBMF\nrpDx7ovvQoaS6b0ZyjY7gDHPWD+3w0oqWyaWyhFteycpkWDoJPzqil0OsEJP\nOXGgp0zlApiqQQYSLDKq9aYVo0tMnpP2B8BkFx3A9j3aSGMgqdePcK65wo/L\nPWKyINEcqjZCVahsavRzbgG2gs/OGFtMiUh9K6IgiagkMiWHMTuLZdk0NBQg\nLkMAIDh2LwBCHBc9/GF0jXHe5WF16yGDBek+sAgVatZA1aJr0DjboRGtwrTd\niyPEajzEGIvDTCGwKtWz2JolnDgdtIQEBvcFCMLXArRJc0IHFrn8mKMu82P6\n/vdPJl0y0yzmAhGvKydruLI6gm52OfN6JwUGSxiohYO/Hfjx0Z0TjDYh6iuI\nZfZS\r\n=KZRR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"7bb6b9b6e2c1d77cf7e65680aeb6a4c60e0300f4","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.30","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.30","@aofl/api-request":"^3.0.0-beta.30","@aofl/cache-manager":"^3.0.0-beta.30","@aofl/server-environment":"^3.0.0-beta.30"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.30_1570834730196_0.4636091176620769","host":"s3://npm-registry-packages"}},"3.0.0-beta.32":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.32","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.32","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7fc70a4f1b14ef3541a11e8aec252b66d46a7a46","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.32.tgz","fileCount":10,"integrity":"sha512-LqKsGUTG+8/KU6K07PwKnUZjX0md/J5zKWOEABp9Gq0pOyT3KLVZaGt1foeiWDUdZh7a1Ssb7tW0+mtwqv8RmA==","signatures":[{"sig":"MEUCIDe7NaRk4lVKikOwPBh4m/c2LtOdZGOx8WFMDSOcZwXLAiEA+A1wiRXFqKYis7hAAaBH6D/cwf+12rFEKxMQ1b4DiJk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44499,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdo8qdCRA9TVsSAnZWagAAkXkP/3bHXxX67h+UdeCJx3rp\nKkZ0DGC4cFHYADiYc5c1Jst6ORMj9CTvXN7AmWmKqlY489j2bDR89acBsb/O\ngngGyJwhKQs4jsZvsXLObQy4hKvXrjs74J8d78VUatHXwXm9gfIuAJ39hCyK\nSOgCYiAkffi++ZeDYZf9u7vhkwYSRKO7wN5FIB777E8WBKNe/BbVzCKUdLH7\nvK8wB9n+yxb3Pg5x+I+irttQXRqsyM/t1PJ/TegBQkasiQTwunrlaRliDT90\ni5Ma4HjQSN8OTAQtvG34N2uEkQ4Zw+z8mchxBq7f7zAHIAFZDbMVQeWd9EQf\nY1gOR6ybz1WU2RzSIJzW1u02GOFl8ug0jzWfjJU1x43+s+BoiJKKhxXdKtgr\nKnlBLw3UFFA5xT2/2odJUJZPuBFhY6SSf+dC249wXRvPsLp9McCTPJHx2qrg\nr3jXN2O4uhcr0zLhvgkp4Uq6Y/C7zi4aEQlba/szQwYrmfHfJI1yfFZpguKC\nHMKCfcbGjrAOperChfa2o09VmHKZOVbXW8ffPVlnSFLkK7OQ9yFYz8+Vb4N9\nsvBwXzajVD4nEnGK9v8+Dce/fytv8Wl3fnJYTxjZrTvphJki+/NNxdw3BppG\n67qpFI2siDFP9A7n/4QzFR8cKtxyGIx9iJR9Fq/5rb1yU9mBzW4kj+7uUBMu\ngspQ\r\n=C7Vg\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.11.3","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.32","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.32","@aofl/api-request":"^3.0.0-beta.32","@aofl/cache-manager":"^3.0.0-beta.32","@aofl/server-environment":"^3.0.0-beta.32"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.32_1571015324946_0.20570381430590778","host":"s3://npm-registry-packages"}},"3.0.0-beta.35":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.35","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.35","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1c03845e771505c8a362d3dd67a2078c2aacaffb","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.35.tgz","fileCount":11,"integrity":"sha512-ncc+TBb9NhCW3ZQPMhYED4x2ipcza9H4VAOwbaVEg+Sv08x4adrVXH0pM4m2KuEflVS7ujgs7HR3m0ja9FnUnQ==","signatures":[{"sig":"MEUCIDtcdJI5DC4lPVt//qttrUN458Kc8TOlPKwYSapmSALqAiEAwf/g+h4krF/sBeBgVRrWdFefaI4zT5YU2A21Rf13qKk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45637,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqWLHCRA9TVsSAnZWagAASggP/RqpvP/cmjJ8V265Hq0O\nZO8lxRFoMXt+lbVtAODOILU0Uj8E7cK/6SsW531/fvZAnhMOAB+xShiIc6Rt\ncCykVhRCUfuRu5XfS3uNX8a27sVHV4SfcA0Hc+B3ZpkSjgsBLejY9XbS1BXW\niWTQ7WkHFW/gatT6KcvC8hYtW6Jem/kesDDhYCNi/X7q7CXgHsv5IOJNOuTG\nT5200WTwuER1C6tUuFnOWHZ7Cn3MC8CKaGOoPFUsKPrZV39YVLpWIHOKv97x\nYpESzPBn/qEjzoAqfsb4R3uAUik5+m7uK8/YHl9Yy3R74osBllkxThJ6FLxJ\n2yZu8MqE0LGkSx898bKFjflHlPrsxFFHODVB1bMopuhNmKDWCLptYs4rpYNM\nku9tb2Gtzl2oVAQ0FEOdr/eryh3m5s2NiaZw6bVpTH8ztuiVloGe5fHIJzHx\nI1dz+nXjEpoZ8Qrd6SeCdSqQc0znR/T2r0VMLG/q4TcopCy2aeWTvBjeSG4c\n0FthC54D57kVF59kaRIRXgu7aYD14Yk4hYwqIZjlL6UDP/QNJT5NEyW0xJqL\nhrJYpt3PFvBPcL6HkXN0ODpGlm/3xEsQcIgJ9WVp34crzICPgIncD8WDhjen\nBOOmO5KNeDOjfVmRnhBrN7phzV+8/YTIHJ/bcOEPM1iA71+xWJR/KN867j/f\nP2kp\r\n=hNWq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"6506e91bedeb6cd9a30c22f437603e14e02a3ca3","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.1/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.35","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.35","@aofl/api-request":"^3.0.0-beta.35","@aofl/cache-manager":"^3.0.0-beta.35","@aofl/server-environment":"^3.0.0-beta.35"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.35_1571381958969_0.5844874113882437","host":"s3://npm-registry-packages"}},"3.0.0-beta.36":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.36","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.36","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c60e20f865be77d12a0689c0c62f05a3c4710f5c","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.36.tgz","fileCount":11,"integrity":"sha512-B5Cno8W6JUJLcyNkeaisFFFESqaAMNQdMrRKIgooLOPP8k2qrngLjeSd3dcFl0w7QTBsUbkBTic6C1upPvpf8A==","signatures":[{"sig":"MEYCIQCh8RKQpGjO7V9n3Y3MR/dapVEc2jnJaoXMSQazkympMgIhAP8JizHCK+LcQCho8KI07fLiPRLmgBvCkwVDtfUos5VJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45637,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdqulmCRA9TVsSAnZWagAA5P0P/RLrJj8lgL7ml9NM9mip\nF8E0wzboxiCejmWVxX21R5tLos3G1b75JBVJGqwtfE2fspyATCIaHbatwFke\n9RuRSBikDmu9RGMfwADSgDzUBqDhc54RBp3AzO4VoiYndqhlHXgRI42Na95k\nK7BmaZw0LE6p8ybPATpboOHVa4in9Fv+rCK3Iv5TOkQ6Kf7JoHzR4m61v5TV\nkh2lZRSZhcrf0pjqGd4ss4l67u3A+kbeIhIH8L9PS4e6x9zabDw4Gj31hhj8\nTT+RlKptf1tShH2JZOdKgMU1H04Am5+tt10bBqHltn0NkzymIYP+Zk0kMz15\nmfMZhuyRtKCIwot70PIZewaTcicR6CAf3IDC3l87YJzw8eOW5676cCvwryOb\notomBNpgx3aZcGML7P8UimyCuEu7JbbupPeGgzOITL1Ga7k67UPKy+w6LDRj\nFBpg96K9F2BI9PmCaQapYXoUogktu2DC6sN93uMIxZxALnHRHlgFkQWx+G9Z\nG1zowSzShntht04VgoKyneYWhDbCqviJN13tFOx8PKwE4N0QR72KA5rJogps\noTvyI85qFaZTtdriJgusVB5tXbWNtxd2nP3vthBPetNFeiTTF3T0G79wQWSl\ncmen6UtJIZAQtSBcj1bnoyGol0dP/TtNEfNwlXPDREjkF75M3m0Ku13WZzGt\nr2bh\r\n=TyHu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"9eae9fc87437b61f0019ffedccbc3df7c8e02a78","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.1/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.36","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.36","@aofl/api-request":"^3.0.0-beta.36","@aofl/cache-manager":"^3.0.0-beta.36","@aofl/server-environment":"^3.0.0-beta.36"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.36_1571481958152_0.10243244941913243","host":"s3://npm-registry-packages"}},"3.0.0-beta.37":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.37","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.37","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"55d575f79f150c42fd776dffee60422a96d376ed","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.37.tgz","fileCount":11,"integrity":"sha512-1PUQQvZ+ul1aX6e64PBmQUEkjdg9j5VEiUTzbvYohMS9dVlCwtKcFG+fFkIgexPkVq3W/TVI1Op4Z+b08a1E7w==","signatures":[{"sig":"MEUCIFXTDmyVPYeQ78XbJEQFp+GOLKKqxS0/OleA7ZfD2qVrAiEAsm0EhTQD7FU/2qSOig/3YGIPSQ2FoKyIzsKRMgeaYUk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45637,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdsT/DCRA9TVsSAnZWagAAAvkP/Angp5MGnP5Y0ect3S6Y\nLtqVjv3xlXntQJ9rSNalSZ3QD+kPeN6QrDhtOR7aZYk6FnKPUqcTEgUrG5xj\n67g8pHI9X+7n+glEQQYfmpxgMMGLSBNXzjzsCfD5RDEInT0MjcJ8RXi6f/Ip\nQoN6FeS/O8G7ylgd01LXuFrc0x5/2kxd8haR+qXBnueOYqPSZtBUG5F6XKo/\nxO+97GaWMGZ8yKnFpqIV3IMFhsnH6q0XmLnaNZZDJRWSNCxt/6Fhk2SR31wZ\nrbN8j3T5y8htSwNgnABlg3qQfcAFK0z1sR2jWzkpJkEJgzbKbTgAv87SZaUz\nI3ypZa1+WjCqMkJOqyXIxev05HC6UgcINodYSv5rfOXqD2e1KZPor3/G8VTF\nKQlKljmKHSzDm3zhNGUMAm4A048QvsCwtg3tveRzagCvM1CgMZu/MQTmMSDT\nHIe+NMw/IO6sLGDCDFZpEa2uTydAlFy6nm1jKNfFXHJGeiRFCD58aJGvGJxM\n5G80jVvBtcWvM2B2bfkA6Yzvo2jscWk1Sdo+r1zbiO3RKMy4uXwCu2+ktCbX\nYJzXjIIRux/TnY6m1v9majIZXxfGscM0akIkiG+Ti5Jl6JoxO05wisn1UXjD\nIFvg5iXZ3tFhC7Ldk7zxBU88mXFcOChoynm1NXi9E2hYXzd3aC555Le1b0X3\nNyIQ\r\n=hfzu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"90abdfa3f72b91bd0c98e09afbd59c21621fe846","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.37","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.37","@aofl/api-request":"^3.0.0-beta.37","@aofl/cache-manager":"^3.0.0-beta.37","@aofl/server-environment":"^3.0.0-beta.37"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.37_1571897282689_0.18575807960730306","host":"s3://npm-registry-packages"}},"3.0.0-beta.38":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.38","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.38","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"35aa645818387c7f4088013e0ecdd20e648a6dc7","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.38.tgz","fileCount":11,"integrity":"sha512-g/X+BZUFUS1gQZYGHhbS3sWhUle+VI9gYwEQI8iTLd6nj2VW1YMY/lO6OSxh4Kvp+A6F63IDduhBT1k3UQXkyA==","signatures":[{"sig":"MEUCIFnqlLmdUL7a3vqqYECCfyema2TCqDs2NOPZzvarD8b+AiEAz/bNcD+8Qk8kM778gwV0vCzpNKGCpqBJbgBVcZNrK18=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45637,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJduhQvCRA9TVsSAnZWagAAp7sP/i+Fvbum0cm4NbrtLfj7\nVAdl9BPdyj7y47/6z4ATZW2zMJydxGA+aH0qZ88SZbk5T7pyrH/HOOEM7vLN\nxN1WwOYRxCelX830TdelUS9E2EJZXZJDqMbNyLmKIEthNQhsWpO/LNyC82K0\nr4Q5qHJ1MDjB8dQ1Kc/SNRHfoFMg37AHcCx0ErmNa3xWicEXLKqRAbPXjxoZ\n9u9R0YdnHX8sIN0gBG86APG160ANH85bkRRY1/lQkQ30UBfykdE0+QqYOHxG\nW5SMt9hg2qmHaJjvKl8LsXL5vlF3uCArXbjUJ2DJAuCjyJj/7EbhV6zVhDmp\nIcLIBy1ooZyMu0LCc+ox2BrKP5+ACkxlltt21MzkjRSU3y0+I7nLxISc8PLu\ntyy62Bir/4YLP2C4zQT4ngMZA5/LXv6avvRczVsj0lCNNDNDHF+0X0j+iWcE\nhPhWfy2HCUIsaaEnpijtVowg0PCrmf4Te+GLctOvpX0M8ZTKisnLIfkTyBkn\neEG7lRQFghfq6cMtlqfGOhNH70W0rovGlNBU09rTo54I+m/U1zFGc2iha0KN\nq3IXKaSIU2NnhZkknmzFzm34q/e5TtcAMvDytVAEmO/lyOsQAKHGq5PXvcyT\nakpMFQ/XdczD7hgiLS8/RPAMA523D4BaTH9/KwkfDMMlc+LnOTD3iiGd3sqZ\n/ewa\r\n=tdxV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"9fff03a99453d439b551d48a69e5d642b9957854","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.17.0/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.38","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.38","@aofl/api-request":"^3.0.0-beta.38","@aofl/cache-manager":"^3.0.0-beta.38","@aofl/server-environment":"^3.0.0-beta.38"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.38_1572475951428_0.5413755918355636","host":"s3://npm-registry-packages"}},"3.0.0-beta.40":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.40","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.40","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"86c75c220fb8d13a32aa8fc1e4281f9717b35929","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.40.tgz","fileCount":11,"integrity":"sha512-CInxz+mR4uud/JGrgsngJi82tgNbF282DRVAaTi82CflItk9zA5Co7qyo3x6YKebVwB30GJXbp/jJokLH0YHRQ==","signatures":[{"sig":"MEYCIQCD+NUweYzmEmsHfGUh2v3SDVE7iV9AsWDnl2Nk5K1epwIhAMaL+pBWogQ0KSsZHaU+ovMLjM/xqgjK3s1obiyQYuJ1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":45747,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyeE7CRA9TVsSAnZWagAAitcP/3bRJ1So8PKN/xLKnfSO\nuxTKovOT8fOIAQpv07OP51FRhb80j0LUE6fE7390qK24myJePHSwFSrIIEbz\nkP1CxAARAydd20u8XnXeBYrq01oH6akEtml5oGiqiAy/qFfNV0YFvHs/men4\nOwT1/bONf9m2rFZ9iYQGK3EjtDjfDx3OAEnfHFvqgoXNx2/YYRPM3RG+xY7Y\n0ar6F/g6oYD66sfD4sT0cll7NZosGu1E1NzlbbvOqYSFqWKBncBoRsT5sfXp\na+b3OzHzIFTsbad/m5s42SjLguMY6Ip1AzFItazwLfkqLc6gEq3y/4C/yO4f\nXnsKXphTPzZG3ckJhsZppSeKIDOkxMaYwOb6QgWrElWmQjxtId+1LwwXS1Fw\ngSnRTFbt7D0Z9zD6FMhoDdiWbOSzUXTZ6kFisaOQ6ikegiE6aAdSF8zkhtei\nshaKuLDuwdpqq6oflaHBnUpmEYbvmKYP2LNpVn20szjsdq/TZNzwAo6u7XH5\n7+n3XTCMWCuVZ6F9//Vzah/RSWEzs8Rzti72Hjed4t2SZ/Zx+7oCT0LNVqAk\nE2x01RhrSN05upvjhtNIgP+4+kvuTozgjz8X7bZH6P2fmSLyRfUcc6R1RIYq\nrHSe8I9o2MTILrtWh1Xfx224GJSFj727fZPcZxqlvOhER2pFBRw+4nBwUVCd\nTPCe\r\n=gTkG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"0bfdc05f0d4406219d0b432a55fe53ab1726f4c0","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.3/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.40","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.40","@aofl/api-request":"^3.0.0-beta.40","@aofl/cache-manager":"^3.0.0-beta.40","@aofl/server-environment":"^3.0.0-beta.40"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.40_1573511483234_0.3379547433779171","host":"s3://npm-registry-packages"}},"3.0.0-beta.41":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.41","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.41","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"87339aecd2abdb9c5153f1a97fb78821d6300a78","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.41.tgz","fileCount":11,"integrity":"sha512-FaGyy06+W5zo5nPwEvJk+HnOUpekiLq7trGlibUtR/7GuURkUJg3ip7TcxKUUhG8XNWcQoU23Kc4nv/gIHVvXQ==","signatures":[{"sig":"MEQCICCjrQL3A1AsT4Us1LwRFnEi7CobQ5hThqCkhpS3yr+3AiBGOUHxU1xzIkCPjV05P2CNkiV6throfN2UqQfPYSY7KA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44680,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdyjtPCRA9TVsSAnZWagAARdoP/jFau72DV3evhiw6Z3rH\nnDC7ya6aQTuIb8CtRP2A4prI3c8DdseoHhcukITZLNfDMOUIOKvxqf+LewAN\naruYjWDRupf7ok5JQn6p34b6gMWH/ABNX+MII3RBnxcdcMavkMsY3tmuJnv8\nUT8u7y/4RcFkC/DsZTBO23FpHNpd+jPUWYGmHjQJa8n10VzLx0IaL61J6h94\nAldKJ5ETFL1JRtGDAQoWE3HHouV4xhECtScUqbn2h3zxsIrP0I+kmH5rrLgz\nklctx8JlUnfXrJTBFUWrts/rN4/VfBXTA2/60QsvtVrM8qhJclA2AkR42mDx\nGyg8qoHfIWdSe7rUWIRWibeB47P+BdPVzqVMDXPkU7OneXuQvU1SF8VVfoS3\n5ZYX9WU1vI1U3cNx2asQu5Ht8VVTXrbn95gr7zzWn8y+VofWzQ0jiHLe/gKU\nfZy4Ow5FrSVzr+bMNCBL98NYcbhk8yJrgT7B019+KqJ4CV5lqS8cYo+GnR0+\nq0bDBW8m4TkLEaNckOceqpoMx9gPco73o/i1ulTnZg6mDwIBA2+thHQGO43Q\nnNiG9Bx4TQLL/0ERmaaWZj3GAop3uDoewt4vMd29evfi0c0k3AnsIFsehkYl\nN6MIMjaxk3RIu/B/NTVbpmSrvN37go4M6MXv9Zf9LAKX4ny/iSLEoGnnKay+\nr3qC\r\n=XV+l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"212bc663acbda22a9679fadb2aa64484e35dc068","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.41","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.41","@aofl/api-request":"^3.0.0-beta.41","@aofl/cache-manager":"^3.0.0-beta.41","@aofl/server-environment":"^3.0.0-beta.41"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.41_1573534542969_0.44397290341522644","host":"s3://npm-registry-packages"}},"3.0.0-beta.42":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.42","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.42","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"af6de1a56116516edcb376e21e600a947fff0260","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.42.tgz","fileCount":11,"integrity":"sha512-xdrLjq6++ErrM5T0V2woDg2PDv4zFMstOiTzVLp8xcD5EtLo5gMFTfdm7vO3J4b0WdaDuHAJYdH1yh+m0D8q2A==","signatures":[{"sig":"MEQCIGz6430spDAhXTwoUrO2gNknB6rCgRpRQ3JK3lEpMGKUAiAQPFSP1tTNMQHMpwzOOO90kfs1PvSAaivz2S/w74uPGg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44705,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdykjxCRA9TVsSAnZWagAAadAP/1Q47/oT/zD91LvENidS\nmVEGVplSCcfVn2zoM7VkWoA1Q/aMnxtgH/iQNYPlxYeNCrRP6eepPiSH1Cvl\nx5ZAkkpGgI5zNKy+FRTReapI8AicP4xhzM1yWOc4q8R08djJU6NRdPOLnPVj\n/1A2O27iV/tyL4b4ZjRPBXz7+ZgTaof6KEQBaHUDUOymJb0HAzaoxmFJ7buK\nP6cybEIVay8fa5azwGzQ/VOCYeNVMgmqcPsjaV2FillM9M/vZRQILeVFdA+z\ne5ql6srgvGEgsP7lfCAphNIaOWvbCaNZOG0ZcmrL8LBvtf7yBLx9SRbBv5Wk\nYR78trcRsQ6p0e0iHUDrn4JZrdpDmb8mctMXypAu2CSejUue9LB+NFvbnO2I\nDQs381FDM9AhQ5CyezFJewx1Ag8VPjHALPOD+s080noeIXTGH742bDihp3mb\nhzydRGyV5nrrOaxO1CSOUgh4OfgozmKbKjNka161g6a5m8dSXgeo7mkM75Bz\n5tAe16Zb5GTsJbLHm9rIP5hioyb5uAMk1umErMkSAqNbdd7rZR/mjE6NXTPB\nFkHSIww92CbYWUX7PFRtPZRUpFIpvVZ1kKxNUydSfAmZcs8zDV37B/ypQ8hQ\nOxQdPzeEo8ZbJhJzDbvr6ekEU7zx3Wb4ey34hh8p07Fa/0jDrIVICBrSJiFk\nyBLP\r\n=FCUV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"699b13b7bf651fa15a25ee2873b72d9fa1ef14a1","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.42","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.42","@aofl/api-request":"^3.0.0-beta.42","@aofl/cache-manager":"^3.0.0-beta.42","@aofl/server-environment":"^3.0.0-beta.42"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.42_1573538032605_0.30639579360611324","host":"s3://npm-registry-packages"}},"3.0.0-beta.46":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.46","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.46","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"45058bad4a38eb99938831343bf8fffd0dee6b79","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.46.tgz","fileCount":11,"integrity":"sha512-3JNJG6R0SKPACWoc7uJhD7PM6zt99PXsyrpP0FXuiGBtdh+GKyj+V/0FCr8/Fm1A3Qcu7IBa/bk0A7/BGIrRvA==","signatures":[{"sig":"MEUCIQD/Py9K5kFkQ3rpXoy7jZNyPRm6Yx5lA0eZ2JJwoXfsHgIgE/iK21Sk94ChlvIThlmJoZTY78hB1XrRFCIr0oc2LCk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44705,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzc4ACRA9TVsSAnZWagAAzMUP/i7dvKmBwxs1lHvoG3iZ\nS4keKte0t6EfnWnHBwfPPrT1vGPTb2q9VBPIM7ty8LPH6/5c7M+8JBHgUB9M\nNyNkJtNpsKRCpCkSFVPy9dqABHrOTYATfKMab4aX7GIHwOHJXvczfb1iENzj\n0OGCco5SMehQvQ2OewRoAA4uYMo9WeNG5Awubb8t/9ts4SVfyOs6eZg8kc5v\nzDCutwywCPpzfpF9R+/L5d1uWCWNqFKe6cvj1Q8AlUtt8+FIp/Xfyk4zIBs/\npBdX7DsIfb9Pk1GiX4LBgG41E0RyDnSjHarfZR3rdTw8i/6vjSCR6b4hhxa7\nxiwCrFZLvPZfIlvUHdVFbzN8SnlSXLHYOa7dSUOfogxCBBbbk1oqdja2RZEz\nLtlE850P+yQglzb/2KGleWAx/mX0lJ0THObrH4oQhti9ap5NQKhiF9/MTBjT\nGLdoVihzd/ItGK/BP2DcjA6H+HjHSveQHxVZPzEipHCNJL1K3YNI423PxOzV\n1l9wLYMjxrWEU31cMZwx/8ZLUMlf/ffZA6E4oY1AF0/JTjW7aGHO4dZhF8NO\n0hr9WePn81qElSGCDlz1O/J0vyo5dGo4EO718Iy4zEK7cf1zkr2sA+3C1/14\nbgEuCR0T+fbVPMOjoUoSWYap7xVjGZSlQMx7UlYw0MEkTwJmKT/81A3BnAIa\nH7kb\r\n=7AwX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"4d18597a6b3e63324cc8b2f401d986dff832a62f","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.46","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.46","@aofl/api-request":"^3.0.0-beta.46","@aofl/cache-manager":"^3.0.0-beta.46","@aofl/server-environment":"^3.0.0-beta.46"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.46_1573768703583_0.6046359106758046","host":"s3://npm-registry-packages"}},"3.0.0-beta.47":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.47","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.47","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"24046df7ed616a4697eae46578b431963bdafff8","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.47.tgz","fileCount":11,"integrity":"sha512-miBxjpudf0iWRZyelYE2rdkzper6/JArWsTzqhG1vPUbrtwJbH5uPjWKIhMDHmdzjfZMNuwyfkh6cRVq6vEGdA==","signatures":[{"sig":"MEUCIFNSR/pDBSxeMfOHDnx/zZjR5rM1F+e6R+Gi1sUAkLdIAiEAqePZH43vywLPPV11JL28N4aqKy6c2WBnKsiqMILgHMs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44705,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdzfXzCRA9TVsSAnZWagAA6rsP/0XDENm4aUNlQEdSvHFA\nh8R2g8FB6g6v9P/aS7ZxZZwxAO8FakkuV4R7Lp7yU30Q/JEQ+Uhw4kucntwU\nB0jY1iVqXHKDZf/XHHJ6ovJ6aBHUeZnpgfZagxd0jIjKWhtwAXWiDUqjK0ay\nSsUygG+Qjxh6y8mJO2c9JJwVj83ZOfJgFjAZkTkXC+lpKfMhnBeTUTiZ+GFW\nVcnv/tek6/2d1Sdru//2xNadgny+4jgwmFWS0B5u1O/RG47X8RnuSYxAfDmm\n/0Wb3U1nTkSwZBZofbvngf7R5rtmkL1I2c0Av/px+ebZ3UzV9teFS9LzsxR1\nxNP3Isx/RdsnE4gAkCT48blLqRDL8xfx2VtS+v0iLrQZmr+VdlHcI/4W6QFG\ngl6ZF/tsSmoxz8ZBzq+XBice/CWMu++K3nnbGiD1QBIR9KfSBXh8+KFR2MAi\nHU7pcTn4zcfKllHfw1pm6F+zdpWL6GVF3zvzGGHd7gsR+ZCK2s2GBLL3A6kN\nw7NGM1I7fPqaX2kiQAe7TY1MHXPyhH73PY5xIY8xI1xnYyH4JEjXBg99BCQC\ncLzAzj7jT3RFbvGm+HurIvt8G5Uhi3L5LNb3Iy3Iw+yNxnq4gh14x4m+CqtZ\nzWjhZbBnHUoK1iDBI0jM/3IPOGqSUh6iJCEJJce63YzZlnebL7hy59LNA/iJ\n/pgD\r\n=bUd3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"11344382e361206a6f67f05f4904149ead37c1ed","scripts":{"docs":"jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.46","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.47","@aofl/api-request":"^3.0.0-beta.47","@aofl/cache-manager":"^3.0.0-beta.47","@aofl/server-environment":"^3.0.0-beta.47"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.47_1573778931530_0.09526762555447532","host":"s3://npm-registry-packages"}},"3.0.0-beta.48":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.48","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.48","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e3cddd42a88371217de81bcac07ecd90b55b0fc6","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.48.tgz","fileCount":11,"integrity":"sha512-ylPh0+hIbB2c9XtmaVSOlUu54fQPxI9b94WkymZIA8PQyg1tE/er1XIyFKNkuPX58/ZyzK9BiU+cLlY9CKI0DQ==","signatures":[{"sig":"MEUCIEb9pk38A682jmMKMiJGqAUoDzkLIUoLcwHdBdlLTLK+AiEAmm55Vxjhvl8JKdIDFXSVuGgoZf7RBc9hRklMNqqEiNo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44716,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0IfpCRA9TVsSAnZWagAA3+UP/Rne8AkW7LpwvNtr71Uh\nhMmldHyacdqAlf3eE1hLgrRddkq/ZgxKayWzsaw4mSzhcd5cN6VCW4NX9UO/\ndhsJDY8Z462oVZSTh92ud4Qa+m1X8PLErRFYOSz8EOo7IRrWxhZsJrTDHqFo\nFCVob0n898x3pqDabRdncsOapvph1hl6cv8CJ/MAxVH6byMhOkuvyMBeKS3H\nl9TRKxlUqtqMyiFdBO1WecCtt0F+KkwP2R+QA+i71P8o8Ig9JKkTEwWMdFYO\n87/nCKuL9882lxU2lLJ3rAVIAY5O2bCAQLiA2hOXY/XQcvduLaEj+PFfK/yk\noKhN3s1Mafc4JENO0A1sShgG/TEqEouFFvnZAn1Qi+VT+XN5Dmzxm5cGrs6K\nTc9pzivn+PTKGbg68bkUyImXosXNbCFabu2mLu8aVbvIVQqj0sHzorBKyQ0C\nQ5HfeBVC5HaWkEsX6LSrOPspEg/ggbHDNmlnWi5dP2MGM6b9MZn4RFcL9fOK\nP15Hf1dgH4C3I5mHFkkQoFwpnMoDBuw5BQ4GmEud4wUL6CNcVHu1QyKsUqfF\nOCnISit/bCo5aFINF7u8pa8l+14Q+iantkj1TScKhdioPmX/TzVcqG0GugUh\nyfM9jRleq5bzvWWQoIIC95VEIu7F9esr2KFqFn41oTPk7f08rMAg4poHSEkt\npfnx\r\n=BJCP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"d77a51a21b591d1ac0032de47395878116e8566a","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.48","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","jsdoc-babel":"^0.5.0","@aofl/middleware":"^3.0.0-beta.48","@aofl/api-request":"^3.0.0-beta.48","@aofl/cache-manager":"^3.0.0-beta.48","@aofl/server-environment":"^3.0.0-beta.48"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.48_1573947369347_0.7017032507397503","host":"s3://npm-registry-packages"}},"3.0.0-beta.49":{"name":"@aofl/resource-enumerate","version":"3.0.0-beta.49","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0-beta.49","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"8d1609ec566d817daa21c91e40ee9429b6ea152a","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0-beta.49.tgz","fileCount":11,"integrity":"sha512-N4A1sCiroftAZCIDlUx3OnenTkDe9u7m2c/aBwUZ+yYfwWWRKW5Hr9qoE2bHHdf9tzV1K9GCbde82DZu2OwD/A==","signatures":[{"sig":"MEYCIQCPALPkEl75U3s8hKNTsyqGlCebrBcxLBmO8kmzxDMWRgIhANyOTlj7XV18iZK6WE87aB7NrLSUEe2zKSOMrHaTPkHJ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44641,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0MCaCRA9TVsSAnZWagAACukP/2gDJBt92iKieytphb1i\nx/m4wcmqMM6hdzl+s/r8vv9DQOTBE/ZdvH7M1+OR0mtdvhXT5NlV33sybcLE\nVJEhIco3LL+RpV3MlxdNq7t8lMGlBJ0ns3mgzS2tiuxcYKWEOzVj8h1RvK8S\nfEMvI60t8H7Zjlgb00K2ljqAklo7nBguCGcmLahs6suQciSJ4GVnPCbaxHrA\nRpZPr4+dQiwV1YakflPAdCJG1iQUwB9EQfm0fE+LXJhnsU0eviJRHU+0KeP8\nQD3mlZ6V1l8JX1uu9BolwKCF7A99TPNVaB9fhO69RYyj74YX5p095Z/NmDaK\n/78gqbHuYjB3XHxPPRjf35w1VjE+Stov14GH+2bylgNzT/pEphZnZtsDjcwo\nkbCV5CxjRP2C8vYM5TUOnCrJWs4tsZ4yjRQl2++QJ4PFTiSCAy8pogXvZiOH\nLl2ctOq5eyFMxm1rVOhyFyjfWfWfOr0KxY1QnCFaG4RVeH4aczu3fR5La4NS\nDjsBeiBl/XCZ56mIHwu/kS5P5wAY93ESeluNzqVOGuxzCJuDUVrcrUJeXk5X\nPRtXS6fEDNa6siUXssgN8Eb3pf3CXNYRvYutwCuWKKy2BXYO8U4amOfGGTZh\naLmYSQehpKW7eGNMez4o0UIVMDSjk/xrQ8wuI9r0IrPqPAkMxerDtFQxtT9Z\n48y0\r\n=R+PY\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"a2642ff8dd100adac8db3d609f63e2bc6a2247f5","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0-beta.49","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.0.0-beta.49","@aofl/api-request":"^3.0.0-beta.49","@aofl/cache-manager":"^3.0.0-beta.49","@aofl/server-environment":"^3.0.0-beta.49"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0-beta.49_1573961881762_0.5268787940184867","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"@aofl/resource-enumerate","version":"3.0.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.0.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c9f6418d7bae5d5fd5bffc002472d1680f72c0e2","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.0.0.tgz","fileCount":11,"integrity":"sha512-c01E+oGsYC+oNXzUqHi/I4deKYyI4dF7vUTgBNS8dpsIhVGHko9Iwc8ItSuCNO4uWcl+M+BxRuLdT3h4JV9akQ==","signatures":[{"sig":"MEUCICgwGjhcpSx+PHURa7px7ezIeTl0zGXMquuKfxIdLLMdAiEA34xo3ZB40qUf6uv0Ksnc2m3tL84JvwS5JZa1bL2hR3I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44593,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd0PFnCRA9TVsSAnZWagAAr0AP/2Oc11aGS1Rc8XfZ5fQO\nA0xHdj4B55D7Qs9X6S0DxtPLeRqaYo1apl+6XvRWXyR6855SO5aXApx3GSSo\n5VJPo2KMfbfpwWQwhaiqY0AdvgWM4R8l0oC+PqhiznAJn7nV0PqpvQ/Qrn4v\n6cQNllCqwLH/9Z2DXLgxdV8NqCxkplsg1Sr5mK8x8y8jAdgtMga9OH0BFCQv\nM36aONDdR1oHHoQN5976eJkZulMmI1cgtWrsJj+kNlUbF46cxzL9Yhdz1oRs\nh7PGwD9N59X0Pj3vvUwxEmXWPQ0TT6ilbWWm4cTlczg1JgolLaUxkArF04/5\n3zPN42gYfuX1wquIkqPB573OL8GOtzPqqoa2wXARR8aYL5jp4WmyyqwwTWul\nh9wX3Z/ieiSMt14PsP9yKp4hr+AEhRRMrHfHYyv7Vc2N3TmnS8lE3pLUfHl1\nwPhdWC2irkV5nK5C1Kq55wa831lTQdC7RyWqwCZWo2LQNI+28vawbpE7kSUj\n1eZnT6Zet6qNzM5xEbTdRhTTnpDe+Vu3+jl9u3v4Es9clPRgtD0NDJlKO2XR\nS0i7KDgiwfRGxFZS4L/RwPlR8YmrgVwrQ/Hnt5cy4BDBd/4NUaJaAo16tB6Q\nGAbFzzntOqAyLOqy4pXCe9fKh+xZgs16cGUo3WAA+d2R/Mr8i2K/z19QDMEM\ncT+r\r\n=vuRK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"bd783440a25a2c579fbb506b92d90bf4fb7e0289","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.3+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.0.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.0.0","@aofl/api-request":"^3.0.0","@aofl/cache-manager":"^3.0.0","@aofl/server-environment":"^3.0.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.0.0_1573974375313_0.9660221383223655","host":"s3://npm-registry-packages"}},"3.1.0":{"name":"@aofl/resource-enumerate","version":"3.1.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.1.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"279f0f070f74f315ac5731f895f88138e1b22acc","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.1.0.tgz","fileCount":11,"integrity":"sha512-n7cLWlzwGC3dadWxSLF1AZrGKcmi0fSWfCrd7+csYNrKU0c1mPKnI53WYQ0sR6UgWghqPPBsKKFTVvenHdGocQ==","signatures":[{"sig":"MEUCIES5/d0nWwImhRRGfHBiy/DCEvYgPqk/5EtzXkJZElwQAiEAmBDaqPfJquHoWEck2bxzh7GDrOLQltfRcy0fS6ZAT7U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd11XZCRA9TVsSAnZWagAAwlkP/2bJQdOZGPdVrsHS4kg5\neUTH6LCQ4iOi7dqAv3T9Lpe57+F16TsCcgUxClDVTmfGl/RRyp8bNg9F9t0T\nPzdACDXG/IRyoPIUZ7GDtKFwYdEPPbck69jwOQCtCtHQko6UUSv5A/cmL4j3\n8yJf0eggOAcEM/tvGCxjKdkc9dt1HkXVVjNbbIWgKrawqhvpOVPzzMXl4Ata\nm66/RlLg4e6GTn51OoqH7o+DBVCz8iRHpDAYbH7two5eAvoN0OEAYVQhU5+E\n1b1DU2vNHWStv3sdPFILiSkotxSTlKKQcO456dWhduiv1NRYnGOCior2q4TM\nQCVDfp86peOR0TJ4KPpJtMxBtnM1MKio26D/yAD5grNOuyLBJYRa1apaM80C\nb3hxzYOfKPKQp436X1FZJ7H1OuRHpBqHmWejrJYWmnALvNV7wLkVVDvnVCNG\nuFeCaOJmc7eJuC5R20HYVr3XtQnqxz6UbPMC2BjfdIKbyom/RVWp1nxKmo1h\nettxz9AmsjhAQEeO/o+yizMGz48YnHEapYTIneFXcAVptSCly1zIP/4jx9WO\n+MyEDvFNwoAhtgHCqXEJtrhQLGexb6xOWCx2EXwjeEnPFpUOcLMsxdq6edNB\noKaEj+2inSE9KnoicqgaD2X+lyJXfwXOCZ6JaI62wVM3sXlnTt9UZY8XYH0R\n6kzO\r\n=htPD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"cb7c610ce117e6fe41168dcb3e2758d12900b277","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.1.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.1.0","@aofl/api-request":"^3.1.0","@aofl/cache-manager":"^3.1.0","@aofl/server-environment":"^3.1.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.1.0_1574393305352_0.2750948339237518","host":"s3://npm-registry-packages"}},"3.2.0":{"name":"@aofl/resource-enumerate","version":"3.2.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.2.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9223e9d082c9b03f871e5b88fcc55b1cb45d1909","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.2.0.tgz","fileCount":11,"integrity":"sha512-mpk8mi4FP9j6PF6aPniK/Ns8whKYVEQdJaXqWY+ix3A4vbbrfarOExh8YncgwlZO4+dT7VoiBGyaYqGf/NcNjw==","signatures":[{"sig":"MEUCIQDov/7P3RTgfFo/jBt1iYXTRte2sHSqNP3BPeUqKU4W8QIgJ35Xqcez8GFGHEC8PtU+chvQ2Huvn3yPOYnacANJ81M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd2jKiCRA9TVsSAnZWagAAZScP/jK2FsUTLrpc2xHp/btF\nx/ON8aqlCGoCjC3eXC3Lg7nyZvNHSqraNNEPEftHQqq6Bt+NxB5+Vpr908sz\nIOyoc9OnQW9Q9CKA2Thp7lG+Nw/jgFyXuCjLmKIbN2ccbNdWYKYCKn31qlzv\nsm90/RiJGU+i6/SXuAFUp2I2c5GsDxJNL8kohAvEUZy5TtLd7kZgja1XF4LP\nG+UO/PhemR2aKtudsjyJcAA66ahQomHMQ2Znhn1klXpOK/HuxTXMu29ffI44\nV+bWWHbhQltYoPFH7NoCU8CMCJbUNiKZlER39o+h/cxjgbq//GzGFgqDI0mx\n1A8/QgeZ8rEKjyUdnqZNoh6lpGR461mnO0ZugdzsdBjL9exqCGRFtzBnQJ09\nWPX7FdAy3T1PVOE84DhMSlNEJJuGjhI8dcrd2nwU2hcGMcFKks4ydhvuexL2\nzEL6OzWLmo6K8RtBcqulrbkybA0lzmZR0YcytSk5B1a+8GY1kEcB4Zc/N0GB\nqEWlDWZL8yheHezjOQK7zubsCFb/HNmvSbLYeLYNXZ+ygf6yfSgoRpKeqV+L\ncD21PolkG5QQC2ycZuD+Qdnnf/JwiJZmtcNlNb/4/iFW5orlXE2azaIjD2az\nh+V7qkYD4LnXmN1VfuhEO86wyccEhOfJyAznSEsiQgOPBtjOALntsrAKUku2\n5ii5\r\n=KBUX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"8275111725390a8f797467a12e045c905a78623b","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.2.0","@aofl/api-request":"^3.2.0","@aofl/cache-manager":"^3.2.0","@aofl/server-environment":"^3.2.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.2.0_1574580898491_0.9158544690370309","host":"s3://npm-registry-packages"}},"3.2.1":{"name":"@aofl/resource-enumerate","version":"3.2.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.2.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"f0edb626088fba2017e25ad2c9abf161565dc933","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.2.1.tgz","fileCount":11,"integrity":"sha512-L8WhUNvM/qHUt/OCeoMH++es+EyyWutI2rS1TOUqB4HLzKZBOdxP/VvkZ7a+UQgDQuzKKJ9moTpxgK//DUYU+A==","signatures":[{"sig":"MEUCICvXSuQdMyFYKfnjUDl/QWzLhOI1JXem1PNJom6Qrv/JAiEAi6OlKYIomN2q/dZv8c0FWwZzWXYpt3brQjhSm74FYpE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44590,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd2jlrCRA9TVsSAnZWagAAGf4P/1seztt+5yJ96ksq94yh\n730KKgJ0o5a7wYZ5DjmpeDLf+aG0M7IlJogtL0Wa93mmAYHt6O1nCzReXwbN\n6Jpb/XLjvSCMFe0bf6NlsF2c0Ah/SGnYeKCB3blKHD8xKp2ekuQROhyrgPS9\nCEdmHm7W+vdlGHhhysK7Tk9f5UNlNXmOTgQDn4tXUUUhYq5jWF0MbyMg85DG\nGMioXhNiqTHQggLb6MT7tOAuCXY1UpKdgkDzSyToUp9AfXf44G0oMx6wbXVl\nQBIJ7hESJy6LIgYj/EvCKt/AwXpdFUKnjsb1CZ+fV+lpclOeQOfG30APUNRq\ni0TXAfBqJvUuyZLO8ncQKsD0JD6c5UI4r4u2OXOzdR7Ym9hQwruKhXoSn7pR\nHEg60rjM2gqQxqlTiV9jviQoL4kABoaKQPtuFqnuTx69S7Al6ySg1PL7NBj/\nQXM0/6sl+QXQ2c2LEios5wfAtGdUirAHe4zutsBkZB9Vc2BOlI46Cv4RKvCI\nZgJxzkuS7VY9e+9QU/6neG0Wi0VkSAdF39HHHBvgRoWzPzzvzY3n+qe+WMxf\nqJkuSWiPxV95Evm7Jg46onbHxmS7FoyBeXcCfkdEztV6AzMUBIgKQHYzxnQJ\nBhPmAdg0bzm0Nx1/zhQPIvbNool5wgIn49K9jDuT81VyuPFQPt7P2RiVCep7\nm5Au\r\n=v62+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"a3a91753b98e4423d9fa5bc05d8cc8f8754fd040","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.18.4/node@v10.16.0+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"10.16.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.2.1","@aofl/api-request":"^3.2.1","@aofl/cache-manager":"^3.2.1","@aofl/server-environment":"^3.2.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.2.1_1574582635514_0.5080129426024897","host":"s3://npm-registry-packages"}},"3.2.2-alpha.2":{"name":"@aofl/resource-enumerate","version":"3.2.2-alpha.2","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.2.2-alpha.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4d969ea022776b5125b546f791b3d17bfa142892","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.2.2-alpha.2.tgz","fileCount":10,"integrity":"sha512-e5caw17SxzWBNw3ZAv+LiVOnhigXVCOXaweOZQ//d6FzroW6sgIdwLsg03U8UoX7vORbjd8IN+CPhlzX2PpLYw==","signatures":[{"sig":"MEYCIQCAdY5kGEYJL5wmep6XSzgUMKto2Wy4fM/RyHgttzA5XQIhAKXeVP0+vpNzYJXL7GIIr0L9A9DgdorDmNUzg4bE0OWu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44613,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHiRGCRA9TVsSAnZWagAA9n4QAJ3w9hreTv4536rsl74K\naXK9aHEbPMtJgIeXwsTH1FRtWOOVR4Jc/DOfb/Q6lzwbN3xlDknn6UcY9RYN\nYlJV0kyQaucCm8Qbk122JOGpCZXU+B82dbgl56G83sKdi2leQXSGrhh/6nE5\nFES/jNTx+mQgSUWDp24sRvd0OQNfyl+lB0wL+T6OHvj8ZJo0Krefql/P7xCT\nQ86Q/jfX9C8dY82HJ0EqWxO7QvLu0DK1KhSKuYrweYi3eDA8Ku1G5hr7EtwE\nvSQht3kkh170nm/FwK/uRsXxUsZxec0y4EbiDDxBiY9SEffnqeU6W4izkmy9\nMjPJ6Na/2OKLB7WqUye/1LWUm+akB2W/8IdRk/R79U7lLans+1l7lv0DJ5sN\nRY6W8Ly+C4SvJ3yOG0iKKvFVe3xFuwN8Wyh5wAjN+wawUpTmrJgTdX4ediNR\nWu4xnqGf9hDRVypVVUvdc4DwoWqcwkoTCHhwJNI6RXCVN0Sc7JLt5w3fWyOQ\noFkmFQbjXSdejhsHWZNFetSZgouUz+erhI1JxBHQICX904uB1DvWdgaxbB/E\nlw1T+ASxR9sYOoFc1vDoEIL0uUMxkUOjOhMk35zik6wfZWdgU/yWu4CxwAfW\ndQ4bKkQc5vZ3AWVTIep6HokmW2TEPem4w+gHEuOAxPsT7Xpm2QimfgxdnR9p\nWWbk\r\n=U88k\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.2-alpha.2","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.2.2-alpha.2","@aofl/api-request":"^3.2.2-alpha.2","@aofl/cache-manager":"^3.2.2-alpha.2","@aofl/server-environment":"^3.2.2-alpha.2"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.2.2-alpha.2_1579033669860_0.9354715937396842","host":"s3://npm-registry-packages"}},"3.2.2-alpha.3":{"name":"@aofl/resource-enumerate","version":"3.2.2-alpha.3","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.2.2-alpha.3","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c1ede3b643a9236acd3c4493e60c21f437af6667","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.2.2-alpha.3.tgz","fileCount":10,"integrity":"sha512-igMwS8bDs+wJl2RtUtxBRGr3bjb+3xHD1fggLMc+O0fRJYUYlFZRk8cBJPnhcH6e9WfkM6omPK8vZVwiWWoBBg==","signatures":[{"sig":"MEQCIBdpWlBkdnZI8iDM+POyUbVbOI155KZkU5SHT5cWShL0AiBM8nDLwes4xPmQObGVhzBQgpJUo/ZkwQE0ZR9fHpKgLw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44613,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeHi7kCRA9TVsSAnZWagAAUQAP/iQVuDA7K5qeAl4AheGS\nvkAWRDqvveD5zu1XTobu4IbavrIWVQDd4eq7YjhJUk1j5RjcXhnVuLcjhz/s\ngeuvvIKgDorXrNpu24YScqiOj+j7CNxjsbrH9m7FVKaMIc6Af7V5hgwXfu5d\nggQBuEn/eFr9R56YjVjm/O0eAz+jUX5Waqc0KLeZQFbIdVtHpiKp5UO2GB6b\nROcpFm/5QUoZHITIKPN3zaTMnVr6+EBAuUGdWLbVVHhUP/hGlZKMUj2dNGJx\nQVY5/RvfupkOsezJxFPhMdlMJbMtTf7FXm5AdMjELKVZP4xIHVAydD3zqGbf\n3AHBnUyrjZK7zlDy8YtMUWtLKTtiG65wKBAoghnNarxnyAIZwYU3vOxcgz65\nGyeJylLlYQTWRSxxQ31MXPsMPCWUg6MgPXQnuldU3t8Q+Dxux1qJ1tv1NdXV\nHmRj7wxXDw+TjXxWtCYbLxR4Yt1fw3UDdlb+uppfsISAcfootI4TEDCN1YB9\nyDZbpy2Ao1W514YUYmsJR1L72ZBF+fNbdHYTlMezrIx3hwV4Hqvu1MWBHS4a\n8rUhqJhzQV7x1r4V7oBzjkK2oqn06o5yLqE/sXAdjJBfNsMlJAxg1oRJZDIi\nYK0QKEt+Mcuj3Y4TSUyUNsFvMfbS15odRKJs78AHGIHW1IDN1+2WH13dboyZ\nK+fs\r\n=YHnV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.2.2-alpha.3","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.2.2-alpha.3","@aofl/api-request":"^3.2.2-alpha.3","@aofl/cache-manager":"^3.2.2-alpha.3","@aofl/server-environment":"^3.2.2-alpha.3"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.2.2-alpha.3_1579036387639_0.1444327105505785","host":"s3://npm-registry-packages"}},"3.3.0":{"name":"@aofl/resource-enumerate","version":"3.3.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.3.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"49a2b04b11cd600ff95ca96d601611931c66d30a","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.3.0.tgz","fileCount":10,"integrity":"sha512-KcztU8D51b16pRdbto+MOfKU9ZwdF+fvR1zKm/pnH87ofrrXTrQ5XI0x47l3XosMSdfI7rRKJiBZ0bVNLPq7pQ==","signatures":[{"sig":"MEQCIGC2+j5a05VOBLjtCzOcRLeq5H3E8HgKRRr0MEK6f3AzAiBBoBoqmGZ6gOPew6h01iYz+v5vb1ADDyV5Qllk6CoErA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":44565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeKNtWCRA9TVsSAnZWagAASn4P/2PoaAmGj1yti2SXD0RU\ny0yGMbTAEAxCXoohrp5ZBiyHI17MgswL8vTaTc7sv/Q1DWh8jSadl/JYf7jq\nJDmzMTtfGLYJl+dxFkL8pIZvHTafuaMKeu1WScNWCfp6NCo5EHfoKTJ1Rsbr\nKKEyKiUHkfYRPagwWTuZ1gDZ873dkpd8xghQHAjeJax5cd80ppOeZw6+vMK2\nyddxbX1OzPd0x/DuIRkqdzMNTpcNCjlkEI4y1xk1ZAFIQ+sRDiJwRYczE/Lx\nwJfhtIUKZ9Alq/iFFQ7o/Y/Hu4SIrGArz3UpKktIYy8FMoz/U/GreV7ODJ7f\nlzz0nWO+Vz53gELn5KHeOmaWuVEn6AJbm7fVp581tanqXEZMw5dxRmsgaeb+\nLH8ZpheCttuN3e9166Sb4ztFOL/tdF71PYbZ9MABlSxGkObHxd0HAEXnJ0AB\n1bP3zoAKhhn9NZfCLa9QtqFpVIZOBBKFudvNgu/DStqvUNYXZeoulCDT92KV\nGDkT4udxGiyKSNQgn6YczncH5/GZKrX3wN4S9D2GSPeXSbhLGQ3gvP592YPo\n81qGisZt3QIbnf4xCRTIYhRIK0+rTxSTBq7IkiL+atajWwqUFnv+lcsc38H/\n7PYd8OPcIXGiQLiwgva5pi8nn5sVPJiKRDzsVj/xFlJv4MSNQka8jYTbpdS2\nasGX\r\n=V1TW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.3.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.3.0","@aofl/api-request":"^3.3.0","@aofl/cache-manager":"^3.3.0","@aofl/server-environment":"^3.3.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.3.0_1579735894023_0.04725718578190685","host":"s3://npm-registry-packages"}},"3.5.0-beta.1":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d06a0bc2b1fdbc8da4544f169acd442600ba96de","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.1.tgz","fileCount":7,"integrity":"sha512-5UK0hSkU1zCP+J/sLRTZx4gay+8KQV3OBG+HeJizy+XF5inQ42K+tlpCQl3rIG2qXelhL+/j6VJntJZP2/sFow==","signatures":[{"sig":"MEUCIQDR7Y7gcvvcRiuNbl+km/rttkY+10sFFkaxWT+zhj09RQIgYRvMCZP9EletahyS9vvqzAZu+eb9l2d3RMsciZenxVo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUbi6CRA9TVsSAnZWagAA+Q0P/RwXDjiUeehNvUq6PVqu\nvO0GWX2WpFhqZsxlRCILoo/1wr1q9oxOTz2VuWqRShnOlZ1hN/7FAKQU5dDc\nsdUQP9MHFiz0bfr6aIYgfjLmG8NAYDTht4QkLHmzfZeaLj7UKTxIqDl9m5q/\nmB93XL6B6KMBnhdZPDbhlFd8Q3UN1HwYR6xP01AqTTqH/ULBdugEYAaYle5g\nAlmh4K2EAT3FE+wpPoH0GA1FPG6fXmwkIOtS6Cl1V3DyH4bztLA/nGFTu2jZ\nADPkJHU/n70EaMM0o/e50fJobhhWcY2rkNJ3Ewp4EpjuZbqQpN6lTsSOTqhw\nGh7dLr9c3V7OYuGEsX6vy+7UF+aTxkE4lzHXJEDqD7uJSD0dcpJ5OlKgc2Sa\n/ICzxtMpJEruQLOAexMi1BBatx82qjrXeO/+ek3CJ2lQwn3N8P9XLDNSaXeF\nLOt/JAlpIiE0p3sPQXpHsNhE5hFGAAcocedun1aQvsjOmqJYV+pkmgEe0EYh\nwquzkkWAKSoqGQfxu+yDkyA7aQ3LSmytbB7raehVMj+fc++SK808v7xfq5sf\nnDt34iZz466pU+mmzQdWwQAd4CM0TrMz1bkzDyUkFc9SfwHzBp/XoAoCltSi\nnV4JJJCI1Y+7uPlRSh+oKkGKJLLkaQHmey0d8dcPcEPWMupeJWWPwieXoWwh\nShp1\r\n=myPC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.1","@aofl/api-request":"^3.5.0-beta.1","@aofl/cache-manager":"^3.5.0-beta.1","@aofl/server-environment":"^3.5.0-beta.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.1_1582414009645_0.8988635521616204","host":"s3://npm-registry-packages"}},"3.5.0-beta.2":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.2","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.2","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"aa7f19189d9d193c765405c126c5f600f073cfcc","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.2.tgz","fileCount":7,"integrity":"sha512-u1nmI5FDs+g036U0gXz/zoi7FQ7lKhyiJnKrfPj3BjVYhI6eQOs8C0O3bjuRxwb0gVgnOfmux+lsD3bNw9BsLw==","signatures":[{"sig":"MEUCIBAvvv8C1SBu7VXOkEgpAifLKXyuE4fIkEQuLqbqhbawAiEAhu2OgUQLhJMm/2Q8LZb9MMxHCGOsbfOeDOIWpg1WVV8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUb7RCRA9TVsSAnZWagAAqBYP/A76xezCbHK+o/NJ+Bya\nO8TLAnz9/75Aeo8vEwp4/ojXyPr8KegUphMUmpF4g/0mM9ljVgJg2ovLUZI8\nXvWoiUDeOw3oZE/P4cGyWkXJyIr9imi9reSzYdwAqEQ24+l7xbBX5RTNr3Dd\nR/lvwB2IdM5Y9d7ZVI/Rii6Ik3UGOHSs4TDkwU4JhkXnFXo8CVtBfms+ECMZ\nkcfEYQYKgAv6VOucbjidUBqLj/yJSG+d7zi8f++yBtTcEkn8ZuOjtW7MBz7F\nts6rKAU4IiM7fw8Y5MV2XjNehEO8XpVBnSSJv3Z0gG9LnTnl6dxC+CXQCwiO\n9TBoxlHxrKEWmqcye0CDrdRF5N0uQWCtgU3XGrdATTo1FTJJFkrd2L52eNrg\nM7GqJ48wSVoakgvv4Pwyh4GDxhVRtBHOLReuaP7r3swAPJvi6wvQ8A/4iZiH\nalQ+gONiqpLm4WZs0pNYinjBqmVRV99LZrhIYEI3ZNZq4+BrqyufbIvzgof+\nplE39nluASIW1BciLprK/zP2WC+irgZ0qVQsGugj3m8/VcqMduLrWSBjrxzH\nyhmsJKlwZRG0mBj7fN8tc+p5e0QvnJ9cdHAKuN8ehTeaJUBZ+iGX3DAKY51R\nc8Tgj9MfLVnUiwi3gpzDKDB4CDM1qNPIoI8NJ31vtCgVNUsrBw0fB9t2K9Kp\nc3i0\r\n=ljdn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.2","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.2","@aofl/api-request":"^3.5.0-beta.2","@aofl/cache-manager":"^3.5.0-beta.2","@aofl/server-environment":"^3.5.0-beta.2"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.2_1582415569462_0.2777644335956455","host":"s3://npm-registry-packages"}},"3.5.0-beta.3":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.3","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.3","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"22877a4d9e8e0059e29e68c4b44d97efb27d395d","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.3.tgz","fileCount":7,"integrity":"sha512-AMkQzzSO0N8egsQAGJnB1wwXpUfjUNh5CD0b+EhOrAY+sZi7zf/+GnHh8MyddLM3WUINJzoNOf77pewbwnTMRA==","signatures":[{"sig":"MEQCIFHWiaNXbnblX1BF5rHcds9YIiT0AIjsp5ob+A3ylLT6AiBu5HsV660a8+0ra/Uf/Q/360LkR190HpTj5GW06hue7w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUcJHCRA9TVsSAnZWagAAja0P/0xHKyy5IrAmG/JMQqej\ngjPnicyAhygLR7hGeAtjT1OJPcQdIq/xzdUQ+jNg7m0vtdmakVEBwPv/11cX\nFn+G2VLnkw/AW7dHaYNSPczo3eEozfH6qrZM9lxnEyRqGoWJOmLgxJq24rJL\ntH7V/G+G8jcq5PLVMIm88trdEd7E8+FDwBypvpQaAdyX8oMohMmk75xrhUk1\nDYdxjiYQGe6IoMaRVKS2NnHJ+9gSQqf/qqL9uuiOScOjlablRhLu8wd3+Lw8\nbAFyVamtiRO4YaLdqOIktSJPW1/6QSlTjRBPZk25sN2MpzSFpmO54rWp68Bs\nOvDUwkjTv03EMv2Yjbrig1erdSNuvb6XqV15lPpMtCPGioyObRzh6KdASsBq\ne3FyZqke5fJpnlTsGexKcUnqMdC+nrRvUVCDk5Jjcq5EdjOuwDSefKM4YTKc\nr+0SjXgYEJ6reXWLclZaK/3Bd0TdKT3oCeiQ/SEkx5hadgj7UlZK1j9uoTrq\n7gp/vBLrdryz0cS/koqqr4Ii6nLUqab0iLbJtff0U9+AuA1R5GA0keVcu/Zp\ncbvl1o8ftsUWO8aZ1o0M6v2yhE/TTkpsod7zoUCthIOKnz28ff8z7ZAEpMOz\niUoLxGUSrtgsWDncHWHTjteDbMSKxHRBCkqhIO8ZOVMqYXq/uhJRTqnWBJeR\n4Zyw\r\n=tBUO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.3","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.3","@aofl/api-request":"^3.5.0-beta.3","@aofl/cache-manager":"^3.5.0-beta.3","@aofl/server-environment":"^3.5.0-beta.3"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.3_1582416454576_0.5941954605590996","host":"s3://npm-registry-packages"}},"3.5.0-beta.4":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.4","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.4","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0ca53b46c90e788ef8e92fe50bc58ca44535ed23","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.4.tgz","fileCount":7,"integrity":"sha512-495LW+PW3lmpaXtSQxa+U/ZG2YBktntiFWuKBoC+fcFdNTN44lxM1mlRMQzWHarz9kIZwOfGuTjSYdjaLLMXBw==","signatures":[{"sig":"MEUCIQDb8dsR2TGaUK6Io59VcqhL9NDmAYBYDX443gmJFZgGSQIgERXt16+Az9xv9hOCkRxIxMmgZIS0KSP/K5Ngb+THW58=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUdwSCRA9TVsSAnZWagAAxI8P/32YwziiSa0R5KcFAvwX\nNJpECHeYOqqbfuIhtFQdvwQHrZ7S8t91C7UEHMnneiEZMQIj75WNJbZ9myYc\nB5pYHexBwIHPbtJKUb/pL2/HJfbw78RezG1tiZUVEF3okVzmI0Dt/kbsgpFz\nAyNvvoX+zTwlojBDEO4ygWCgGbp1XP860mDCuB5oqBSue62VWr/LREhZX/24\nJXW5L9VUF/RV5qEaZm4XfDnDv93c2R7lJc+4mdy/1y4sLKQiB6uz9q2ldMTl\nKCHfiDdRP515zu5gADZOy0IhNcIjPUZNfmXd+gwJ8sUJP2nChgtlj3E9QaeX\nR3yli2QgHe7P6hTLFgN6L92muq9299S80x1jSNhIMN3ddvtn0xuIFKTDE/Qn\nkJbxUZT3g293yGqZ5xmpliPre+5DaJ71JshfpGcmmgig0ecu6bBpdWhhDWYS\n/Uj5KYBIDOzfSLsExtOHKHXnFZ35TMazDKouUByUovywL1H70npuH2DDbWVt\nGnZbaa5Mt4saAtRg6iZpuNoMH114WaoSOvXgrg6Fhgk928CCwCLEk4Yd6jJL\nn1J48ppN+tDRAAKCVbolzVQMf3smbSByGVl/1coTfBw1gB8WdRiVSiSdUnAh\nlpVVU9f1upp+hQFK7Hf8a/91RdxlUVAn1rcuS+3Cv5YuLAGsnsbIJhWsVzxh\nT5kH\r\n=6i3M\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.4","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.4","@aofl/api-request":"^3.5.0-beta.4","@aofl/cache-manager":"^3.5.0-beta.4","@aofl/server-environment":"^3.5.0-beta.4"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.4_1582423057574_0.949011756148253","host":"s3://npm-registry-packages"}},"3.5.0-beta.5":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.5","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.5","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"e848e727d550932b198f78474ffc078b17eda6fb","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.5.tgz","fileCount":7,"integrity":"sha512-3oCK8HTuxBW9kczqvN7LRrMXGuJiV8PI3A/ZKZP6EByB49pc/qo8/WHpeNTLGwNmvKT5NlFtrjeRQJAi1z3mdQ==","signatures":[{"sig":"MEYCIQCW2giiNZjUHpZzrg7s0Abz9ySek3ePIvcHhis10RR6hgIhAIOpt56271ZNaag+kd5qPiVdbFQ6M8abP4F2jnJkdXXj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUe0ZCRA9TVsSAnZWagAAtgAQAIaMA7Y3nP/foYOP6Cgu\naGOmq+eIkhHTCU6ySrNBWvAA9g+8WFH3pmoHyJnzKnJoNlL2FafpoJ5XJQao\nDprVHC4Bdw3jhZFigN6IOHAUe2RLYXRcDm09FjbtxPsB58Z9NBzoM6lecruv\nfF3L8N0JDPdmIygpVT7EeeWmH2+wXWzrJtMoazF45W+6AHsRcNe4EcTeRgPR\nwqqZDctv44y+xukSEr55SaS0X6RR+EYb9GD4J4h6Y8fArNZH0+YNv+cLI0hR\n3BnEjTOsQvZYMvGgstyDIBc/XHzHVwLGKXtmfKz4PEvv7VKCBRINPpTUiGAy\nEOtrdYCELzNCkFGIrUJWXmddoRGOl90RDh00RI0d0kFkBFeSX3nmqqPwEZ4j\nE9Sr4Inee0de929XOVB8gff/2//7vIq48KnPFObiaRyyPM6i6XyYQF2fZ18u\nwQdLHLL1Idm4+dmqcT7MdavHzOEgVL/wkS67B7uWh3BxLyOIPwvYi3npMi1T\npFpNlQE7b3eov2rkoOCAGgJDGUVmPXcrCdYFID4AbRj1eT62wiBlhoqJdXRl\nh56W4i1ZVPXU9q3RVgfTXKFtHXIOHpyDQbzDIdAIVCHcEdW4GCKBkR/cHEAo\nrb/Nc+Rk1qKwoJ/HTzX7KVPjRL7f4E9+stksHgcogK0jO91UhQivRoRsk99t\nOrva\r\n=QOnR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.5","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.5","@aofl/api-request":"^3.5.0-beta.5","@aofl/cache-manager":"^3.5.0-beta.5","@aofl/server-environment":"^3.5.0-beta.5"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.5_1582427416705_0.5196133861616374","host":"s3://npm-registry-packages"}},"3.5.0-beta.6":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.6","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.6","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"33e0d7e151e0f3021b706d5c82c654c1d299f6c9","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.6.tgz","fileCount":7,"integrity":"sha512-veoCfUGXMB5YJLAB7rJ7JdS5m75U606HpUqlsi0/0Ubvk4sX5nujT7Pw+SWg/m5ktce6UbgW1CRf+sUZdzUIYg==","signatures":[{"sig":"MEUCIC6dmit08fjfSBBzuihE0xqDzkHmPYyiBNJsuaoRfUdgAiEA4yAGvPgxmNrucPNb5LHalXCYSqKNm1xmT9tcQh9KLUQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUe7mCRA9TVsSAnZWagAASgMP/joZm8sHf2YlXD6Bx5mI\nQDrwVwj8HpTpRExxHR5SQLyCdtiWKqQwf96hBCVRDSYYgoTttHB9GfMXuUQ9\nd9kfYq1CBxx31P+g4eX5T9oQaGeN7GpqKX6UEi9BuBqCVz87KyTU2IiPnW7g\njm15Ob+KJTQoFFILuca+vtMd032aL2yUnQh6yF5i6lLlJ8Xo+EXaeKiyWf3C\nmtyz6oXhuNrngHqKUSfP88TJzjQnv9qAfc4xIio68kUlsM/g/TmE8ka+EiwY\nEVNcAHUdyMc4WjaGytmDeKs5vaLYIqgQCZFft7va05PxqHTGbNNekEMtqDA+\n0DFjpj7dYjtl52VIUAUrB4kxri7fvMcS6pNC6r0Tdi4nw3+vWcbo8L54RV6M\nUsa1TdfxuVVo5pafx0ghPVEAVRj9khstb/fp1BzawekCtR9huMoYCurHSi7V\nWYyGuyBPFT5CpIUQywgnfDCb1av3PonUzaH0jxmNpPtSXNh2gFXcty2pBW/6\nsAJJERS0fOoXTMq8scEVHkjWYPfAtI8n6qKzsqKmWXUO9lN4mJKcTKCbl3No\nt5OioKveEMP2mgF1tDxA34j2m0IJ5N6y5qhqFNg70NZAp6rbpGzENn+bkVEe\nuy/9MoNCL8N+vNKq4caF/OGKL/iF00vNILjOMBpM/V8TrqKIgXC7ThqW66tF\nPhEk\r\n=XI4Y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.6","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.6","@aofl/api-request":"^3.5.0-beta.6","@aofl/cache-manager":"^3.5.0-beta.6","@aofl/server-environment":"^3.5.0-beta.6"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.6_1582427877904_0.5503103793154123","host":"s3://npm-registry-packages"}},"3.5.0-beta.7":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.7","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.7","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"691bcefe2e406acbbe8421d6d4cf99c4340d5de9","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.7.tgz","fileCount":7,"integrity":"sha512-tQypNqDz4D2gsGhy5HKkR+PsqAXBozfklz8PY+DvU82wHQsHkQTC+FluMGs2b3f2HOAwy1Va3jbBI8RSsWLyRw==","signatures":[{"sig":"MEQCIDL9jMJtUVrgfFbXH9m9whVlQRV6k9dicTuRsEd3eBQ0AiBm6rUyaIdXf27Eabg0Xn5Z55MJO/AB0By1GK4GOKR1pg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUggqCRA9TVsSAnZWagAAHNQQAIfPDL/nHlbVIUtW2EcV\nIdnGgUlXjrnNOcpa8O2nH2JTmmdjyXwELCCmhFO+MB6CY5GTFu+3knKhKXLF\n8qyvaftlbGXW8XN4PXifDz3z+UACmeMYTAnjwR/ca5xqtzO2qPlHZopkfOox\n6zqqKfD+7m1esrt4h2ARgv2V/cubuterxxv6bB3j7FdDeI/4PKqjiUxyaBUa\nSiFBhPAMaSE3mPQY0TJgdKaSl0/6FhDJi9oR6Mzj5aJjAFiES07leyrm50KB\nB3rXOa9xoJoi6nafxL6knQ/aK3Nn0vP9/grSTVi/e7W9cHNFmVR53an1uJ2E\nve2Ow1j5z52Ns8KeH8HwvBeFLxxKX3wNbfMNjyYQ3om9Hede5O1ijyYUeSqA\n1EW3cm1fV7KySBlJ2QKD8xWxsvoWRnvPogrNnAgwwP8pVk1Kx1zz5yPMH4KG\nOcIpkKlUZcVdzuIDqP+K7J2CVprl9uxIxSJ1jaDFPs6OSS9Dzph847jsXH/v\nxRZEqmgZgfzsERH9/HxQCRsE/HiwQXJufzkZ6s73uU69TJTWNGKziafMsbhi\n6lR1xPcePEQI6YJSFfZEhURcUM/HBccuL4Lsj7Pqj10J4N+Pd+aqiltBaB+L\nICUdntIEIlSZGW/UOOP9wap4PQTg5AkPn+PqYSzyK5QgVZcMm4Wid1r6LlsD\naJha\r\n=vGQK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.7","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.7","@aofl/api-request":"^3.5.0-beta.7","@aofl/cache-manager":"^3.5.0-beta.7","@aofl/server-environment":"^3.5.0-beta.7"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.7_1582434346197_0.39329129116915507","host":"s3://npm-registry-packages"}},"3.5.0-beta.8":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.8","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.8","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fd5cf6622cad41e0d61a4ca65757b08830dc3432","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.8.tgz","fileCount":7,"integrity":"sha512-pP+3u3kGLMcizJ7Ng+mjY+zeyXVX/+6iHNmM10PkPXaTsC5mJtT6I7Q+5LX0J6VU01j1sx1kIaxjHJQy96Ax9A==","signatures":[{"sig":"MEQCIA4yfOlJW+lO6yZJx40dez/tw7yBH9OYNFum5FROZQ4QAiBClnEHg/ekzd7KAhlz3bldFCULkhS0Ps8U3pn6OFHujw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39319,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUgjiCRA9TVsSAnZWagAA3sAP/jeik9oaf7HLPJL/uvUD\n4brCOnjssuuM/slHwmkvHmIRRLP396kpd5deeTClL371XPfsmvohCB3sYFt3\nNBLck2Kw0xz2xE9Jdb9Sb4bGLuCUnor52004p6WARy9sGwxgH2CqO1BrpBfl\n/nCMdP9ZXr8QiWskvZ9msVR6zqa353/9DZSH0E7MGilQFmjm0ACvBYKeU66Z\nkShsCSQ/1Vpx6pkpToC4Icfyk/i12UG55Fas5ry9i2HzKqkQdFSy5moyzNa1\n0LaG4FBbANJ5QVE6AU0fc+N+MK/uUvVBLH/gOMlDKzECPHrxY+3xA2YsR78/\nStnFuT8crbA5oAKWCBx+Lkqtp286Mk/hROH806VN+PSoHABy95BOKTZS4OrU\nSLAYjel7iHUokTaNbs9zJKnHmtH8++3W4itdhgcsnoXvvv26/Sv24F59oQVq\nrdPrgPa6Hcv1wwpzl5pjTMryHNaGMmXPGEL6ZdKC32oi4lBMlp/mgE9rJ1+v\nS/KQ2z1l00LlbxHJwfZ/nab+vqprWHEiDeFiO49viyoCcfrgYSYEz1/P6xdF\n6OyRchhnZalHRXQC/i9ourJCUfx43+fmRngFZ1SFMG2rXVW4fAv8lHznRlo4\nwa4dRD2m7YzpgtX/mEarw9YaywN6vzmbD2dcMYyhMC4FSr9J4G4yKUFpdwIN\nbCGv\r\n=oH7K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.8","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.8","@aofl/api-request":"^3.5.0-beta.8","@aofl/cache-manager":"^3.5.0-beta.8","@aofl/server-environment":"^3.5.0-beta.8"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.8_1582434529932_0.38877793711487385","host":"s3://npm-registry-packages"}},"3.5.0-beta.9":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.9","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"43ef89490e28701f61bad286f558ecb0de1d7dfe","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.9.tgz","fileCount":7,"integrity":"sha512-9gXVH1OMenEneIMYiWqUAa7Beu7SRpljSbZXBinV2PdOqqM790/x1QvOGqyNtFZzSF9YokSz9w/ad0mhs1DUjA==","signatures":[{"sig":"MEYCIQCWMpU41fTjhqVMz6bdV1ZtE6K1mJ5dQbu3LMvHTYvoOwIhAM5Qhd2wugefMYAY3fpSf3pc97aZyEgng6gh/aCs27Af","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21873,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUg6cCRA9TVsSAnZWagAA3j0P/3fqLPlNEutX+kNooPlC\nX9SRCPI42HBrvlET/LMGWCS4l/bdi2tg6SPHUnAIGDmZY0GZQedf6vHi28yS\nX2SuS7CLwL72+CgMT5zeZ51mpx56H2PU7V6KU9ftHMPo+BN+my+pVAD4L6Y7\nce61u7+g9U+pCL1F3aX+tnbnEQCmmuzcKyY+Xej5MVxd41GEY3G0xA9YbWWl\neUW7IeRQB2mfYyE9CupcxIdiJsIu1Fic/wdfHnxoE3pdmOhDrGNdzgt9EcwT\nf2+d6LzxM46l2q5RBHPjUkkExpnylQVyDPk/ZgsoGkCI4tq8Cj4m/AuLUu4K\nU/Jg44TXWJdSgQPPng0LyAMNU1i+kSk1oW0dK+OH7KcdZ9day95a3RXTfYHa\nUgCB1qtzPMS7UmV2Ut06NlZL7Mb9681268ES3RA9E7UOXf45kDRb++u2yWs6\nVDzMlbi0T4GgUQomLH1iIjlpG78dUJ2JiPDCT9viwOlUP1dVLE2YNLAa5m/+\nVunL3dota9nvqq9P3EmBFpdPyR6jef0v7QRFv7oScgeQIJ7nEyAyn8MaBc8x\nUMsJoBaZTNSJ1RfSlZ8ewePGQ4szhi17+4VCxUGmM/dGSNAbV07TMRW1bpTz\ncsJSr2zRjL40ry0sXDePCH3FyIonRFCs5gvBsV4M1U2tf0ioYO77VucwPlga\n0vIa\r\n=a4Hy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.9","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.9","@aofl/api-request":"^3.5.0-beta.9","@aofl/cache-manager":"^3.5.0-beta.9","@aofl/server-environment":"^3.5.0-beta.9"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.9_1582435995682_0.2991608592848187","host":"s3://npm-registry-packages"}},"3.5.0-beta.10":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.10","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.10","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2a096268e4f33e04f7a0132d8ed7cc069a2d85c8","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.10.tgz","fileCount":7,"integrity":"sha512-34ZUXkL4eI7yrF2tn3O+BHyemi6hGUWbr4O79dJlHgDbpTGtWbXSLXRcjGSkf+KMv88NL707CSEnq5coITYr4A==","signatures":[{"sig":"MEYCIQDygFiPBYt6HlvGYP9gcvUgZdSelIaKR7MMbZKEjcBHlQIhAPR8w4XxBKSaN49mvHRyxqWvU9qbUeIIz475granRwoK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUhKvCRA9TVsSAnZWagAAvYoP/iuojU5naf9ZoUeyWwL+\nGEARtCDbPtUFCnXXIQKj0OaJ2j5BhociyqpGpS0ix+PX9m+tV2Fbka0oLGEC\nnPv1f2K2IYJ/SvEwI6znjtHVf5dn5E6Hp9Yf1RLqOr/4z2AaNccdiT1mC92S\n+5zHDo9ska+9y5vV+ezMHi/ny0ugSODd8WHAWdpSgAw1E8zSgHMzeysIhrNb\nax4XQCuJfKe5groNV+PhRMFkgDJkpnf61en0os7KNMjpVDyKUM+sRRi2rLrA\nv1ZLZu/oISUQaRc2+l28UxPRpMII7xPwrrUGebfNsn058XqeVsyrXtYZpFfd\nfjUTRQpboB/1Orb5w28FQoSgYb/s/MiLQGA+s2v6M4Eign4C0CVGfIWNOZf1\neA/kqT5Mzp8NdtLKg+vS4Kt6e+29SOF5ht62zHXs2d9kTCGgJ3GtWMkaP2bH\n7XQmysBNIvhbOyQ2ojvg7TJ7fxXMkhARQ0X+LE1kNLKb0y4YgdxmVTZlU4Hn\nuntBkyfsiAkqqUrwIUyyQEHNYeHE3DDGdFGOpANo6EHoXfd6ZKbYkm56fQUw\nzLa01wyZMiFAIDcbtShvyywvjxmRjm2dG+PTAJsfklz0e83G/2j0cU/zJqq5\nJxkxSApSMZp5wVs6720QLtQ5XnOufkJblg94ARcyPOq8EoMBUmJqrd3y592m\nrEx0\r\n=PEBW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.10","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.10","@aofl/api-request":"^3.5.0-beta.10","@aofl/cache-manager":"^3.5.0-beta.10","@aofl/server-environment":"^3.5.0-beta.10"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.10_1582437039231_0.03468983862731778","host":"s3://npm-registry-packages"}},"3.5.0-beta.11":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.11","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2ea7311622bf1c6b91b2f37c02c3a474214f08b3","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.11.tgz","fileCount":7,"integrity":"sha512-ZHZFuLnNj4o84p12D4oQjiq6lVpnv7iyIqSqAEADd0163cL2XH5rhTeBRlJbAiJtCkIqB3A5+xb6a8zYFWqMLQ==","signatures":[{"sig":"MEUCIFMfE2GTKITiViN9zlma426+MyVerHqsrUaLtzS63pkDAiEA5lNz0KTUQE8UnbBhxuA/30sa0EcdinwrNZ6psKxwQBE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUiu3CRA9TVsSAnZWagAARxAP/35ZvtDq7Csf2aVlAQv7\n2pGYLuLMQWShd/h7QZ/orS9/JF4Icf9Cj6BOVz1QdeltC+6Ceb98stq8TStP\nn0wyPog49MkhlxpWLCeV30Pv8ngc0UeBLJHp1ELVwPuKNHH/i5vdkfMaNVJz\nnAevMVNHdNLN+oQsaeQfr0r7+ASsh20RIoXm0pTd87EGRPidJUMaBCsuxY4R\nYgxWymtj9Tnw7NZGQpvGRbZ7oYNzM25TVRgsXnEoJfFcPfAsCJ0Sk2NI7YqF\n/v3LM4nkGt0zQi3V6rXUpoxWumsEeYQL5EARoCdYdji9EsF3sOIHsxWGJVz1\nyXUgUVYrAT5x9q3GrE3MZydlK9lDpEKVUZQHD/ERV2tMgJz3LGxJjoMqtSEF\ndy4wHaOmEVOGPf1Fan6Ujz26G5kzeAHCoXvVWlq5JL8KvLbq8h7moKQUpCDe\nR4SUkRyWLC2o0w+lgDEdMw1Z+qMbcRER0c46E/xV1/gG2xmwLrU3SL4RgapI\nNJAL/k7P1mkQ+BNStdB+My/jSTo+yqsYY7R1cgzV1f6Um8ont4/vcgTEuqyg\nl+UTnBdUp93KQGGRA/Fz2I0241bVybNRO8CHaKIlkERLsYuhq0KEJ67pb4Ad\nmB5FDwnNbU4OjleasWdvtCrgXI2ixYeKsvfg1em8zcddDeorc1HZnf5jmnnw\nKX+7\r\n=ZMGo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.11","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.11","@aofl/api-request":"^3.5.0-beta.11","@aofl/cache-manager":"^3.5.0-beta.11","@aofl/server-environment":"^3.5.0-beta.11"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.11_1582443447046_0.5814534109057066","host":"s3://npm-registry-packages"}},"3.5.0-beta.12":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.12","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.12","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"befa6db3362313711cb5280e513725f74f67a8d7","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.12.tgz","fileCount":7,"integrity":"sha512-tUysf9k+aic/TSP6oB7I1UA+dYx+17TIFsWevuadI+WddFQxolniADJw3sf1olfGzTn2ACvIwK/LveMCzVJkCw==","signatures":[{"sig":"MEUCIQCCe7FAHS4OKcURjv9Tzc8hHNywdhgGOS4G5kJw1F/inAIgDSV/jtu2Nj0Kf4axn0zaJJIg4gainuO3QIgFvKSsFLw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUj8pCRA9TVsSAnZWagAAX7oP/1gOsKr+ejf+GJIOCEVY\nSD229tWwu7WO7Cv6yv4EogAvUV+VHTTWnrfDH6Nw5oDVe1A99HFqeSq7dXOx\nMhBYXwB9z7okxVe61rfukfPlDyN7U+C5/aEdhYJdVowQYkQjg4RxmeivbpXF\nRPu+J1/7SRkwFY+pyT7G+RZmI78d029zYHBgaK/icjmROMIqGs9o0sR9esXI\nQ0SuQOUWaS6zhuvQcoHW0WeLi4CXPUbTSjt0wowtvhWv8WLPDgX0MvHJifIr\nYx2qvj7OlQYu+mHi9+/71PLn6XA6WRwIQ9AuvmFRWI0/cnopVoqPD5Gzn6uQ\nXtJRaPXxOt7lTq1ffLUNaT3saKo2grKtAYTUkAfr4LhQ8yqHkY9fBRDXi07S\n16l7teTuBSxjMMJWaIP4v8TtCF4O6DqmWjnJbV7z8STFZ4Bkk6kC6oD5mXqW\nsJ5yPbilmarG1jibHUPNuTotzai6NCmAEfvAGA9nkaps6gJ/5borSp1Nd7aj\nO6qpgnk+fSdBZnVv5f/oYvdSjJw4++D22Fgp2krIPJLBVLuQXc71qEA01Oar\neRK3Bdk73eMLQWDe2mZqP4Lliyq+jxlnbx0rscbjeMDikM5DTjNePIZRIKlb\n2YDlPsC6cduA4Ik7LZOuW1bBt0vbsyL/g6VGC1O4uRR9K6W0x5ibfOzLA3jv\nIDSC\r\n=gmS9\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.12","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.12","@aofl/api-request":"^3.5.0-beta.12","@aofl/cache-manager":"^3.5.0-beta.12","@aofl/server-environment":"^3.5.0-beta.12"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.12_1582448425169_0.02005287026026603","host":"s3://npm-registry-packages"}},"3.5.0-beta.13":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.13","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.13","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5588ca81ee01549ae581784425ff46e43e825b79","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.13.tgz","fileCount":7,"integrity":"sha512-mRUcpYI0Vu6x0ohrJVB7qZ0LsojZb6cuM1FTAZg2IOcWNq/PjiJg7mdH3fBzp54ucMGo4YJdPKzL97DMRW1ySA==","signatures":[{"sig":"MEQCIElgGjjzJ1Gyoq2/Nw78cPimjsYLeQLJjhu06EHCo284AiAuECATnr9mVwvV8uM1V53m4xvngrpRboOpGJOqBEV91g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUj+eCRA9TVsSAnZWagAAoekP/j6qp6ys2OQrtUqjFbDj\np9C4xThbfd7rCVSHqamzEyltI7VMULAdS0xgmjnNB3P/hR9evZWMd29KcB/Z\nfz8hvsUn6ccsaR7fd5kFfkwOnieM0uJz8PJZNsznECM4yqerrtQUhROsW9LQ\nJZpoNPTqZ7nFpZx8dY/804gwc0vsudMjXYD0spmGhEN0rYODk1GasCke5xsN\nCtHReVdS+4lpcfC+UqYhYcAWFJIip7Er6FUdgeDLNv74iiO/MBUYdJMZuk5C\nm3J09xcXFJncyNdKX5+Dbl7aXJx0WuX56YbVJyGJX5ThHfWF4Bw1X5cH2CzD\neiXOvOM8aqihqT5/UFJY9hWvjoouzXQBrjXFCGdM+BztTgNLvk3n68/luE+S\n0Y9sSGzjIx40VMBNyZxiIAvTNDTSHaxPgX1LOjHiEdCbxnqVP/Ypr2/BMPWP\ntawzsAIOayccJDQrRHMApkShAh6OZSp/WAI8aEJQHvXlVzMn1i8Q+C1z7dhA\nhZa4cOJ0vc59aFpS+qbpIQXyPdvyvbuDX5V/HtnArgdib2TVpjrqoBdPo6Ma\naw1OEB49wYkkMGyb+F5/Fp0RzXEKXu/LfkQsn77JqmxhgVx4LHlHQ/tgmDbP\nE+ccJ9p2AuMw0OBu9AYOfBpUgT5e0ZlSrIpfPsdKGHywoHdKwrliNIq+TF1e\nlR6n\r\n=k5Jy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.13","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.13","@aofl/api-request":"^3.5.0-beta.13","@aofl/cache-manager":"^3.5.0-beta.13","@aofl/server-environment":"^3.5.0-beta.13"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.13_1582448541874_0.4507516538812779","host":"s3://npm-registry-packages"}},"3.5.0-beta.14":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.14","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.14","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"607ab938b4a9232f6bced8e841fa90d5733c339d","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.14.tgz","fileCount":7,"integrity":"sha512-3m1VmJEASH3KPRXudo3NjU3/V7YoYzeJXMETbx5hFYqmS3C3kQXbGmUdARXpqp3VEKeKil6dQ/uXv1gfH6ts7g==","signatures":[{"sig":"MEQCIEM2C6OVEtT6yxDM1R0RJh2TD3LTj3wJctzPED3TDIKxAiA92QdZUo7EOYFevbx+SM6a58Wj8YrFH+7usVxCvwSbsg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUk00CRA9TVsSAnZWagAA9mEQAJ4eSRooXjz/3prMSv/U\nFszxu6dSwPJA4kAFrC/MHspbf6L9HzcfE2lcryOKbzKfMwhW7AbRItMo++mp\nFXncKcAQ1f7rikYsQOGGVVuZRXCynQwV6lJKRgW2CPADgDYWqC0mh8WwJrfF\nM0DI7twNV06PvmrgyrnX0vT5ggWC1Qm1Wy/+eNfhcLMAnGlu/sAcZH1pFBVL\nsh7vGWSRaCA0P8DgR8wDqlf+6mDIZa//gN+Rttm8gRKN6QtZz1W/NSEvkmqB\nOWBMkQRYAxDrXpXXgfW2E7+pBo06BxkmRXkxcDzxqRtokG6KGGOfqS9Aoqeq\nXmJdVS8XXTp2v652WghF8XOZXNHTYiQJxSAPHfoCIc1G+lbS6LOKMq2qYV5t\ncNz1okzmMK70LO1HJkc+s52k6k53sks7mtut7MRKLrOaiwZQluQ4S7Bmu+/P\nB57DwddFZfE2oX3oXVi1jYJvnVimGBFGv/0HRPIZRPgIdPqeOlv6HiM6782X\nD4tE5GBlW4noyScWEFOM5w5M5N+OoGkYvmyzfse5LIAWqiEEM0qV2sbiUrcT\nA63m2HeiNvfFmcl3NNXp/OTUomcy4HB8Fq+y6i2cH216Ttpb2NOGdXDty3wd\nw/8ebaGvBf9ikreeYRnQNiksbGTWsUkdFM8K9DslHgycBMn+XkIajxD+cPcs\nxSpb\r\n=akRd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.14","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.14","@aofl/api-request":"^3.5.0-beta.14","@aofl/cache-manager":"^3.5.0-beta.14","@aofl/server-environment":"^3.5.0-beta.14"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.14_1582452020252_0.3178728374267974","host":"s3://npm-registry-packages"}},"3.5.0-beta.15":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.15","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.15","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c2bad81c44d39526568f21f8936e27856b833707","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.15.tgz","fileCount":7,"integrity":"sha512-pgOHzS0XLw2w6/xFiMy9i7sgRX1y4CxkHLr75CVlygY+D/W4OdIYIyBC9AemndZSBAMg8ixWnUX89CxRp2sKOA==","signatures":[{"sig":"MEUCIAJEROuwv7MwQ0Q/1q1Tmg3W1tvE3yv+xlLmoQNlnLgRAiEApJ21rhN3FDNctxQrHkfwKoIyT9ANtXY3jn2dmnrSAoA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUmbHCRA9TVsSAnZWagAA2nwQAInRisWMJaSOZJMe2jTL\ntiIl4/eLW1eau6NeFcHFSUgCpsatt4JA6oRyuflhDpOGewvcNXp5Uyy2LBn1\nJNXy7HPZDPg9TZ2WzcN4Q0OgqQge/oejvpkP3qczZUTVmX4FRhmCo6UDh8dU\n0QGFKMMwituISMX2d+T4kUYLF7qlB9+x9e3Rv77la7t45QrVkmxLKSblVdyW\nD0xsOXafPxA3mXQm/gp0typ95Z8JLtUi+Yn7pUvZoOdAQLiB7DSOIPPTnVl6\nTylxWcPsPXJxkXeM5xhh0Ua3un8+lmCEkqy/yVUwkVeB7ZD1Ch97mXBb0PzX\nBFy7E8HCI5VL4SX1GN99f5FbO+ySAKMfWE/Bg8AFA9rL3wMBWx7fFPnhgxuz\nWI35aesAhiR8mTpbO5mp6dfe9KHEOHr5jXZ05DmUMFgiDfZXHr1kNadr5x87\nmDPEroNCTi47vX18jETMe1CoZnIhJ3o/ZUb7K5/yaupRGozF6VB2xqZz+zNs\nOa2/v1iD1zKK1DzGyYkupIcNAOHwMKd5WLCMP9qScTR+KYM+ykwm5qlD3hVm\nQqstW9QZa+5iN6RGcJQWYEmSyUBOHaSdimg5dQ94M00p2TSE8mR3/1WrFNiy\n7kVHB4GETZ/K2RbegDozbOlQgoFm9QLijBsdvCDQ5JPVRSE2apNQQf6LPYpz\nsJKm\r\n=HcFl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.15","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.15","@aofl/api-request":"^3.5.0-beta.15","@aofl/cache-manager":"^3.5.0-beta.15","@aofl/server-environment":"^3.5.0-beta.15"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.15_1582458567358_0.8910533390565205","host":"s3://npm-registry-packages"}},"3.5.0-beta.16":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.16","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d281d3f18e3d48fc80cbc9338911ddcdd990d793","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.16.tgz","fileCount":7,"integrity":"sha512-Wc6kLmSThMj5iNWcZXrj5/cRS4MflWqAmDVPM409V8BytpsZGGlnbUkZ0z8BbvzvJPQQvibPuN5GOQ91JUvwNQ==","signatures":[{"sig":"MEUCICd+XhPefQigKj6tnfK3c1V2y2tCi5wjNAZfmYLlS0XOAiEAj8/Rkpkhn3QD6PtqAL+WIdqulFfpaw0CIYjSi1A70V4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUmj8CRA9TVsSAnZWagAAzP0P/iE8Sp+NFuL7McCLJ+fD\nuj0rNSdxfZjUigpPUNjKtV1gWs7JXlZpYJpZQsr2nfdzAvefmzMl50x55UwO\n0yykKcpSRnk/hb1pSaj89WsZlCe4w85fbKo25EnkYB7NeRGku7IGUertbDe/\npXLQXuxnQTSD+jzk0K9OHa16XaENp5VbryF6ZIpeLTOxLI/uM0DgtH6O4xMP\ndY3rAWpAvPzBYQ5XFoVawcM6zOb+YVEKO2OVB77vXZrDTp+IqYMvyAv2eriq\nFjrGaDhNVhvg8/CmGqyzVXMtkDbhsJGqH7UijVWrdldZ3JqYQi5XvI9hmK6+\n7YOLIKhAnhX9CM8CkIjboofkpBVScOF9EaiKYk07e88S/O5McvBQ9Ie1maWX\n8tFSPurFjt3WQvOkIyBwZSYu6v9I5QLLtL0/bPPVaoSrsfJHfM24SGivBZ7v\nBbG4vHWFLKWI/qC9ufH7G942pf/DpPrfHkFrpXijXu5gA53HkaB8K9n0+c4Q\nasbzICV8YV+pITkPCj1FSqN9btVQ/ZNXOtphLac6UveQjC3+v9ChGhigt480\nlAwzlDHCJiuGiqOH4WcXyVc8zNSPu6JUJXRfKu7lSnGSF6xp4N55WqtZ+qOJ\nuVL4h9FbW/WN4QhssY+2nFBpwilQFHzfXnhW8MYmdWDU0ImVLIgnmPK2erCh\nViPE\r\n=kFd/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.16","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.16","@aofl/api-request":"^3.5.0-beta.16","@aofl/cache-manager":"^3.5.0-beta.16","@aofl/server-environment":"^3.5.0-beta.16"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.16_1582459132329_0.22479245071835674","host":"s3://npm-registry-packages"}},"3.5.0-beta.17":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.17","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"0a847d86565dbc31ebb049c2f96422fb4f8c2002","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.17.tgz","fileCount":7,"integrity":"sha512-tZkzdUfcjbuPGo0UgtbsA7FjZC+spdRdFmovpFadKQEI2wsqJP1dzO+A3Eu2XXi13i7Zt+jTNPnYa8ac8xTejg==","signatures":[{"sig":"MEUCIEdlaBFpT4oW+bBP3yhlI6EwBYIZRM5J0NI3p/Wf4S/XAiEA8x36xU/+YjOAV+997SrEVSjKT9U3oVOK9Cfk8fUO2eY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeUmytCRA9TVsSAnZWagAAcbkQAIbH5Hj/Lx8OFJfsmkrk\noXP8INra6WxV3Vi3TU5gDqAjLQk8UcrTWnoEhtkRwQSQzP1ZVdaAXUvwJXzO\nyCj+AgoqjlIphcoCslif4dfDl/dz6c2y2HEHmXFMsRvLFVEsKw/+NGE7xhzB\n7k3cmqu4oISBK4rqP3kfTl/20RmF9eZFqIc+tz1eOgq+lNt5s/RjZXebQc4s\ndwquR90dxTL/JrZ6soQz6poCGjzZAP5Tf+tHeAQcj9RD4tQDYs3xuiMFbPsJ\nWhjjEeJtRwMu0BeLr8jZ5O0PPmL+dw+TxC3JC/HIm8ateE8cbkj7imCSGouq\nN5Dwyeqc35JAmwFmh6/lMrn1XgvzonszxXTQZLDtomCiqWbgtyWWGGhM8KXY\nJBkT8GsSByq6GnGMAWZ+7RCo2FkcUi8nj/9xhG5W1mXgOzcruOnqc68Gf789\nKNCPGl4fOg8deMA/ZU7TEDRWW5jvvgvEkcjqpaI8OuuX26UpqgkAWsD0humd\nC3PfKAt33wHx24+IuCIrHOZxYFQksAYYqAB8oUjpT7/MXZo4KTCRSc6K+MUO\nFz/M5tFtOR0Y6FPptbkdowsZ6yxtIJMt6eiW4dJ7O17w/1Y5uyky9ENx2Rs0\nATTsGtB4nRcv9i6xE1frEOKv1kjIRZG/Sipbgy/7XijLe4n1bFAKDRgMtD87\n46po\r\n=3jir\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.17","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.17","@aofl/api-request":"^3.5.0-beta.17","@aofl/cache-manager":"^3.5.0-beta.17","@aofl/server-environment":"^3.5.0-beta.17"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.17_1582460077256_0.7356027302373291","host":"s3://npm-registry-packages"}},"3.5.0-beta.18":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.18","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.18","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6a1e8fd6aaaece375e0d35b8c1076df159e8c593","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.18.tgz","fileCount":7,"integrity":"sha512-PkrJin91RmVXnHdUBPlaVeNiiCRAtNHxUygJGXne9BxzxwEwa6QzLY9IEklwQsgrV9Dxy6wrT55n1PWgQxKe0g==","signatures":[{"sig":"MEUCIEcjdFWU2vZ0DinD/J73STzA9sDsQ7INBo1jVo1Oe5f/AiEAtbQpOIVfiu32/9cwItafWY2AbPPfnRYNwTytJFvG28w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeVJu1CRA9TVsSAnZWagAAOXQP/jbFXzRowJcOY6ir+4wE\ne5EOBiQcnOkyQc/42Lg0zBKNmyHl1d/0lnqyxAFkLg/8H/mbAfVzBzlrDkNe\nqNBgRE016DkMRH20TyFh21Y5S7K1g5okvmBi7jF46I16/qYuUoFfV0yDRq2r\nqhjIxQMWVDZM71lzZH3z7AMUG6llM3JLHZFb9X0s/OjgOITgyKDYWgIpq3by\nvhjhHnrgkpDS7b+kxMg2/rsnpI6WDvopfqM4ur0z0IaGHt1yr5uA3Q39DIpJ\nKbN0l26dWvCwtfcB+4W25Nj/qmuBKOcgrX0Xr37G6NMzl8eNYsD5MqgdX1oG\n0XmJwevsh0GZf3woN42aE52VAQsWHD9AvS87Mi/KGI5osM5lmVz4LGQw+S9o\ndRfRTUDjlg6WKLL4k3E3UWIA/Uf02p9QT69CpeDDeurDFLcO7fwg9oQDdjA1\n2n5QC1r9lWZOE4v6vntbGlMMO0jdNQhE/E8lnZ2jB4sdPDVBVhkJnHG3jXk+\nQsVVF4YG7cJC27AUwnT9DkhdA0t53GH+7uQfToHRhPpoSjXY0PlyQN5/XMgM\ni7FAn3gKUWZffZ+LtMe54Rh8nxu6fk5QG+JAh0QPrAJAwMOcery7f/QcpYON\nYA4rD/dPRiKptealhBdn4PrpHtUinsx7Jt/T3nzoEbjit/g6PUy52ISoK2Dd\nc0/H\r\n=Hly3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.18","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.18","@aofl/api-request":"^3.5.0-beta.18","@aofl/cache-manager":"^3.5.0-beta.18","@aofl/server-environment":"^3.5.0-beta.18"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.18_1582603189204_0.753806848800118","host":"s3://npm-registry-packages"}},"3.5.0-beta.19":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.19","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.19","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"caa97e6f0492ee43dbd1fcba357e6c96a1f9a932","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.19.tgz","fileCount":7,"integrity":"sha512-XlyEE6U2ddYHzi0FNvjzcWAAen/9OTqMxz+3CxmCq+Sv7KGEZgBpRfWw0uwYQZzEuzFhKZOi0sm4ZGEfTvRGhw==","signatures":[{"sig":"MEQCICU2Uf2tBHHFoC4bwTkWWn3Pgu2/CE9Kc6mvujMYsyNSAiBnhKMNlK+qAT0SKQ7/JbbPNMBQVzlGdMkdYHFIKe009A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeVbReCRA9TVsSAnZWagAAefYP/3lJxvQeKl8xtX2MWxws\nfPbnxJGv6r2paKhSgi70S5LImu4/6HmeeLDIltdzthHzabQpJWz9uoAqyzVV\nxdwjaqvjks7+Ip8UHANe24oGAJeiMPUJaC8a3WEKjsyycUaq8tjW9tTADYxI\nj0s0zEsACTFLaOol1nHy+/GH/7WyNw/kyhlNuvAeavu2i+/yAs5Y0cFUOl57\ndU0TrYHub4gbmI0ahm2xX+v6rCTm3xpTYGkrceaAT4ZFRWGkm34JH+cZ4s5w\nyk0lPA02xFH+UXojxrlvRCsg3XLZWVo+nUZ5dRyrKQoN877dvGxvpCqfiiGs\nja8ArvXBGfVrxZUCVg/bXro5VZbZn/np+MB9otQESKf/kCnl3KsA0i26Y8RY\nI1pf6pnvr5ARLRhQsyNrWJAV8X8LfKLVX4ep0R3hl6LjC/RZOkoMQmA63QZW\nW7631NfF4FxPDLGjLNPUCBt/Eui4ZjzubdV7jwUqSSUe2JbwKbMfk5rPNBQA\ngOxj2lLQHJ4SzKeR51L8crga6am5JP5UGcIN6FRCvBez3Hat92YukdyfzdcW\n+DNaYdaIv0YiDyq7UVWE1LVEcUtPBLv3n4S6iuObB65Z1h2vU1oxAk3V+MRb\nv5Ar8OYiCHWAjjary7ybJIeW3F9Ia4uwlGIrn5T8TEFwTMO5ujUwjeFhFUa4\nPlrv\r\n=aiQo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.19","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.19","@aofl/api-request":"^3.5.0-beta.19","@aofl/cache-manager":"^3.5.0-beta.19","@aofl/server-environment":"^3.5.0-beta.19"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.19_1582675038055_0.9331290196551241","host":"s3://npm-registry-packages"}},"3.5.0-beta.20":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.20","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1bf3f09e885145b75acf31b9a45cfc183cba7021","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.20.tgz","fileCount":7,"integrity":"sha512-9wMEc+5RRgamimDX8vM4RTLPTePWqXvSfBHISMjXD6AviY9VIhh6aEyly85hItU00mCohVmUNS8JtMMP9x6WSA==","signatures":[{"sig":"MEQCIF9yfbxgRDhmPYDZq7excaRo5tG2WrEp6rKeFG0bAjQvAiBX8ZDDmdzpM452ymJ2dpTkxkZRTPn0b/eDEAIeAgqQDQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZVNCRA9TVsSAnZWagAAP34QAIXjtfB+WSL1hvZ7Za6Q\nIijK29nkG/9LGH3MIi1Y/yHAqDodyd+RQ9GyezOUAZev2R/jboTlDCnoPZbd\nXMzt0ySlehZVUGwBOMCbPmL17/CqtJ7l/d871WTgDTaVypLiC4/OIZ2MobAW\nZblo63eSc1qinfWKk+Ad/wugSyK0+v8KwGQpW/5zeYoKsewPchDU4ubLgAWk\nxfaQ0nePB+UOkIqgO5+JAln7mxK/0LaskYQq4cmibJFFxfzY7RDXVO06gx59\n0NuYL8uTDmiJBB0lfcvr+i4QECSEcN6zuH7NdEZSWGljgancHS+i8jn3Ad1D\nfUdyAPkQoliixQadMmBhy6ET/d/Wp9QDJMz5Fn9lom6WJFjQp3qMoo/rt07p\n4SzZkcmfsHy2g8hVTMbAmmZCOgqfE5utkzCZONRG0tDXm2VCqiqlY7OEuKJR\nZLjNaFC4WdGbVH5LIA1v/Y77yo3XbZzXVu7KwsTb8HffeRZvhQSZYstHAdju\nwJwoNVwvcvC01cCVVnZFgyZRfMDR8WdKIdo4ra+29zHdzCgg9T3wbhoKkTKD\nWk3vCPMMY7+jRI+nuUehGkb37cPWmbYenbVsndz6CQgZRWj19okGJfBUp7Xi\npJH3/+b1rYDowx9Hr9Dto4MYPzYOStnUnaHmP7HQN8NN2OFfcXIZaPLJQC+/\nRbST\r\n=kg3I\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.20","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.20","@aofl/api-request":"^3.5.0-beta.20","@aofl/cache-manager":"^3.5.0-beta.20","@aofl/server-environment":"^3.5.0-beta.20"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.20_1583191372891_0.7420786976085161","host":"s3://npm-registry-packages"}},"3.5.0-beta.21":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.21","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5efdaa847636e21b48bdada0fbf84c0c3cd543bc","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.21.tgz","fileCount":7,"integrity":"sha512-g63dwWCpl969arV8ynKVZJ56P2xiqZAOBdLJfRqepMWYczEBSzMoIB6DHhNWiYIZGxLLdcpg16F3LEE7XFJaFQ==","signatures":[{"sig":"MEUCIQDf75KNPFVSJv1czxBRf8MWx+fXCUD3799dVMtEyxz0GQIgf+w68CT77v2VYC3EBT0bxePg1E3SwoM3zvGxCC/AfKc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZZTCRA9TVsSAnZWagAARf0P/j5evtAbVISrf9Npyq+X\nMUIgjyQljqR0zA2QSToZDsTat6C+s8MeC+RkpGDyKGIIgZpmULsC3zO8oYGW\n94qmWmrjGcJN4OuxeIywFqL6d0ArDdOhDcGc27cwWJOyflmy5Nh7/7Sju/hz\nel8RNmhv1Bja6eE9K+otGHBgQzjiY3lk57UttynajHJuh9+x1wodD88L/t80\nCj5d0VYiu0PqAuZbAGANNuFVvdt06Je5nTjaRiKP6RsyzjubknrTlJaszMsL\nNMXlJ/1Cgde9fXEOFnqQlr5bKvXQoaMtBsehp7ZkHbPc5EbXNYSB7w57TP1Y\nzVYcx7oGMFvXUSrF16lyyPCWARE/L9glulgmt/9baH9c4/HTdl3d/BWV0XQ0\nw9wJvTx1M1qTTmnDHRyIdFVLexMMnqNBF+bo3lpL9eeZBhXtYsLHVrTfzCEO\n1IrwUauEMxMPVyaiy+MqaXG0Ut2yuFkK9ArDAvDcqIz1Aj4ckD15a7tKLoCJ\npvoOBEMHfUKqchRpOG5HeP7slra4xsCkRMqviv//aPjyrc+qb2E83/VTwiy9\n97MFSSyEC5kKqqEZLOOswJV+GM5N0HOeh3xx1eKQN52BnwdH6UkcBunb/+fB\nAz5bqJev02IqMA7VUtPhLlfgsD9PMTaBpTjbP8IBWJ/85u8Zolix/gaAv7ND\n7NvG\r\n=vwOQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.21","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.21","@aofl/api-request":"^3.5.0-beta.21","@aofl/cache-manager":"^3.5.0-beta.21","@aofl/server-environment":"^3.5.0-beta.21"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.21_1583191635217_0.7017568605601658","host":"s3://npm-registry-packages"}},"3.5.0-beta.22":{"name":"@aofl/resource-enumerate","version":"3.5.0-beta.22","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0-beta.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"45fd61b81105e51f739da4195c0a6c3e22a5dd11","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0-beta.22.tgz","fileCount":7,"integrity":"sha512-mMXDSVqH7mHtYRyWC2hLoGC8cik2xFc6Vw3pGyB+YbnXPGxpR/ETUxQbIIW5nLkLl4Zpw3zK8Q04WdnSsBuytg==","signatures":[{"sig":"MEYCIQC2i6/pDt/XnMnktXr9Xx96SFtzSvdecXrsLX4+JRnnhAIhAKiXHIrTQ2mAH1t2/fZTDqMDp4oEMMMa1GUgdkTGXZrO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZnhCRA9TVsSAnZWagAAE9kP/3zX9QsjxYoPQvVicqWv\nOsd6qnUQ70q7b73TSABl0VTuKV2ts+RYoEQKxeGucNLwb9UIc2nl12rIge3k\nGUfvFz4N8F8cu55TnUx5EaF7w85Dm3GKYh1ZkRKmzFk+/kvhozO1hYu3epWv\nYavvRGmmaejzFJHPCrwQ431plHcidP9ScTIJuq6ZMRh2XCFIjAKTr8SRlrnN\nffRvxO6lS/tSlIAaL5FLYxJKrDw870GttQF853aBa/BalD3ue3HnkI16mZyf\nv8PzJlgGiKaS0W+OQrPL8P0Aqqh+34d62JlWrSAkDdKAkOCDZvY4xMVXMC0h\nG74/8UI/hVpZL+k5XYozUWoZKraz+a7OP8axU+Oh4rp0xBQGXnJfnxnxV8rp\nTK/X40P3sK7idRO110V+n7YCelFgzlzlXqKimIyzerpK9DNJfOtAIQbhUVws\nik8UmG3yi4Us4dt/QxVru9IUIlTcdDuKGqOK+tXm3h4agp29TeEY2SS4GqsE\ndpvpl3Dn5pbsmfX5rskz1MQrLGtursa/RjTb2mJUcFruZx9g6SOI8+7WpFfS\nlFSNw6BzjsIGytU7o55ZmxhTS07WlYvl7I7fAIuCurwi8GDsYZkLZa2bmwk5\nq5xnwvocbvarJQWj3cg6BSMxNTCqvmezB4HNVGvsdozUluY08w3IHgt2+W0n\nk8Dh\r\n=VG1r\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0-beta.22","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0-beta.22","@aofl/api-request":"^3.5.0-beta.22","@aofl/cache-manager":"^3.5.0-beta.22","@aofl/server-environment":"^3.5.0-beta.22"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0-beta.22_1583192545287_0.8499960312573531","host":"s3://npm-registry-packages"}},"3.5.0":{"name":"@aofl/resource-enumerate","version":"3.5.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.5.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ad040b205d12b1498df183b8347ed6cc01c66a8b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.5.0.tgz","fileCount":7,"integrity":"sha512-uO3eHp58zxLvLcBIYy0JF0igxF8YehlC6c5FkPVY0MFTrXa1FM1eC14HoV3VPL9o0C/GOfIfE/98mAc6oZ4V6g==","signatures":[{"sig":"MEQCIDDWP+ZqpHSAMjPtxYIp2aFUQqu90ezfKAXlv4v+Txg1AiA/xmjWqNlZw5uRlGxLhCB38YPs3qsf/I6jajV1jO/EMA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30511,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeXZ7BCRA9TVsSAnZWagAAGJcP/2CsHMiJ3niEDm9r1BDk\n4l5EAZ1qen6/tnULvr0REj944ddz5Fd6GjhS3k0v0jJN1052ejCBI+mGVxOC\nI1mAjy47guW4ggm0OVbcm84v7vS1xxoRh2IIyuPBZ1ih03qbKyvH+z1B+zc0\nNqdSI72iyYFIyLkTGHHpNErqOMPCDws5Jvnyx3o400whSSAyECnoasRRrldK\nFxMiTrBD60obZWqRJWjbeQ5L3rnvJPpTu6Xm64DprivhGTfa8xqFM4v28B9W\n8cBtxFqHDGvGZ4tWf04jUKPJNCrA/p7Su8l/mjKCenmuA1AnF9dPSzwe4buR\nN1pQs3OK+vZeNxD+rCPO3pb0AzNsaTkF3TXxzaPpepBXozIbFksJQKDxhefX\nsi+gOapoPsgXb/MFuwCUunWTBohU3Am/1AOQN4/yeX97k8k0/YxrCHEMiacV\nq1kCQoiHxu/LzOS+1Hdod+Io42qOjwWGuKTRqR8q0F1rbvrMBmjAzujO2UWz\nxVa262uATC9FJGR4MkFiQlRN/mTYSz7OLFgaWF/lfL0h0G3sPDfP5HSbqT/+\n4iGTnx23dXLjyKtlixu/HCMc4dqhLn/shdnAu/QVjnR31jI6+unH52iofo1O\nylAw/Xx38Sih4B1E/GqDu4Vyw0X5c8BsuPVIETWUrUrTkW2zZ2eaJRB9otyo\njjDY\r\n=hjOU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.5.0","@aofl/api-request":"^3.5.0","@aofl/cache-manager":"^3.5.0","@aofl/server-environment":"^3.5.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.5.0_1583193792619_0.2418494693177795","host":"s3://npm-registry-packages"}},"3.6.0-alpha.0":{"name":"@aofl/resource-enumerate","version":"3.6.0-alpha.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.6.0-alpha.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"145958b116d7630c81fb57e16b979336bc72d159","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.6.0-alpha.0.tgz","fileCount":6,"integrity":"sha512-9DIZ6AGQVtFHa0gpHLqdvaojsv/7pjCD7lUid3qjUGwcKhKl/ueQAVKnl/CVWFL7OdBv7NXscg2TU//coXNENA==","signatures":[{"sig":"MEYCIQChAcuGNHxghQ3+Ag9ApE159tHfaNA25VCjZyccsowBVwIhAIOYcbdverSuc9bf8uL23uwSk9FbEqRrzCkkjizUgUiE","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28631,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZTiBCRA9TVsSAnZWagAAp1QQAJtq2/oMRadnm/izY7a6\nx/OpdIE8CAulLOEzUgoFJvgk4h1EzjAitEa2AQU0F5tJ1g9LTzU5C3OpTaWc\nTDmvWJT2GIX1bJ7WjC/qDAljNRItnK19fqz46BVRqZJDRdUSCEa6bh3LlgYn\n2AMSHIr1AV7don1Uoi0aHgqFBsEaiYExGeCYIJ15lTqKtqnTyKrhik0IvorZ\nvRm0D07pFznXLNUlYt5e21fO0LBo0Q7onvSEnPAXfD89tK6ueVGTBDZX2fUZ\nU4fwJ4BrtKgvNowzq4O6Pzqo3pct90Wo1c/kXfY9k+njtYKKmu7vGxPjqbSl\nvNGemI0uwIzHyaUSZyqvjPz16CiBXk68f1rg+2oCnoJ077+dQuSqmyvqJ7Aa\n7q10DbihjeIF0mFoF8njRUXVK4I84hw74UzZ9ub+hRA8QISRKckxrBqSwhTJ\nZnVhbp2LKW+A5T1pfOhhJUM5HnR8jNUkBEDCrxiMYvVAbM1RZROuC+Y2/dbs\nd/wsWI8a2AzhMIk1EuJmKxvIFxFeCKxDSI1kS3Bti4r8jrlKomvpQI4wP5E5\nbt3FWd7XdJ8SLbPqVKsTndcIGWEvzXk4lxJjWCycveOlJs4Hxdtx8l73RySj\nmt88DczFhYEmUDvGft53a5fQiP11UVDCyaOlkna98kH3Mmc40qkgqvKswE7S\niVJp\r\n=XsCs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.6.0-alpha.0","@aofl/api-request":"^3.5.0","@aofl/cache-manager":"^3.5.0","@aofl/server-environment":"^3.5.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.6.0-alpha.0_1583691905401_0.8355324875448531","host":"s3://npm-registry-packages"}},"3.6.0-alpha.1":{"name":"@aofl/resource-enumerate","version":"3.6.0-alpha.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.6.0-alpha.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2d76ad40f24f2fcaaa1a43e033e1ba0368c9464f","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.6.0-alpha.1.tgz","fileCount":7,"integrity":"sha512-PVllkQriTkRsa8bWNWehb6de5IC1YySAQNPWO6X6PVUvpKMUJvEmmGXxhs9gQ/T9UOn9Tjvl/ovGjCRoMGWVFg==","signatures":[{"sig":"MEUCICJuQ0qqK7XsgbL095y/Sg0gIeBm9/ZacQbgeq5Dfaa1AiEAlmF7vnrgAubanhFezXaKplihxtjFcF4q3cScOkMN8Pc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30255,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZTrmCRA9TVsSAnZWagAAUIwP/R4fqSq8Adiyu5hEW5yu\nerh4JiKaDOWnNcussx3YtSSI5V8W7PXqhbnePXJLL9UD7eZXC9N7ByYy+BlU\ndYeapNmtqR1e5LWrJu8nktnDdaEyhcMM9KSlAOI6Gc4tMagqXDcicSTxqxoE\nVpL23w63oGvlyilmCPEWXfssesyiMJbUs1ftiSXtY7ICIKnVcd5ZW6jT7QLF\nxuvj1vP9jt9fqm1OuewTnq1ZNbnT8rsdSsmsuC8bJeUDqgtQybvomKQPf4tA\nhVz7ap58Zv1seBiWrETOag5u/7FYnnEw8roZgjRi8XG/S6CBwJAeg/hAao0n\nD8IGqFYm6dM/LYq7TyYkRQ0rkGbIrTEIZQ2lyzFg7cE8V7FMX9hOxZB4DgLj\nRraViCKPjKwEGtz0Lc/UdSB9BVjLQe3lpSytD94+ukQmcPME2D9F/a7nRsUb\n832SwDQCCHbVTy4nadqloWfThMBbx2QiAWvibYWsJ4UGKvkf+AJfZM2cS4eI\nvgsMPzUfi+HR73vAhiRM2Dpa2lEXS92CmIHAYwOPTCXaNacJsGL7kTR15ztw\n/QuQHHyUCqJiIu76RIb5RmhtZXARtzwVKF/C5K5NFSixzGON7yxvMFMG5xwI\neSv6ehb3ufVtPqqt4qcRez2Bv2q59y72iGTcDGZY/NnFE6MT5Ub+CrNrF3aW\nRbA0\r\n=ZjBo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.6.0-alpha.1","@aofl/api-request":"^3.5.0","@aofl/cache-manager":"^3.5.0","@aofl/server-environment":"^3.5.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.6.0-alpha.1_1583692518462_0.5501127012581699","host":"s3://npm-registry-packages"}},"3.6.0":{"name":"@aofl/resource-enumerate","version":"3.6.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.6.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d29ac7b167844aec96c6ded8ffece01fb47b9f1c","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.6.0.tgz","fileCount":7,"integrity":"sha512-ac08sNkJmh8p6HhIqbu2hmuMKdz2how2qV8X+/gz6KN+AH5cM36huPoyeM/ylnK9XxEpwOy/g8qsvClEB79HEw==","signatures":[{"sig":"MEQCIFPCKkhjiz7b66oPFCL9Ib3lEgplHE5XogIOQucKNhTuAiB7kyhFOs8kaS+cC6EcjnLbt0V6YdOigBJjMlZIuQ2MTw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZUIOCRA9TVsSAnZWagAAq5QQAIL8Jmp8WtLUyVteduiW\nN/RlWl999Ub6pOaN1y0fa1tvohQBF0rLTB1IenI3qk7fFQfYHGkqoUTFN2t+\n3+B/QGA67NTPlduLlOFt2Xxt0660jyQuN0Mkj5Q0F+WbgivaYR9mSzGgQTKy\n9s18HrYEqpXfH6AAyCEG2rpGyrWxhnh3xvf9hHA3nmNvoifTu+1Dxxz3yuuR\nl6OrMOVdTG/YeWZZGOdOR8dYTe2uwp70buT9UTxG8XaDpDKQUVsuuPcZKeta\nm4IIro8gkOySR381yJWhCMgsxdJKCgjTYikKq+bwb7DVpgLudsZO8Txc1aHw\n5WFj74WL1c45iSK3NUOA5DmKVw4JfKEcgfuRhWhbPHDAs89TNtnxBpFdMgGE\nrhoVGtXmwK1mSquXImOAk8DM8EpGBrfj2x42p4+473Jj19ymJ4x2M1heyknm\n1VGgroI7zK3sS+HhPpXuaogALlCXEIO9HFCKLY7fYWyP8AMaAi6uWfsJi9Yq\n5i+ErBc5nmC/o8ni3hoj0/UG3zcU7eGeAu3fZe6PrDempklTH3nvcAgUv2y7\n8A2I97jQ/0JlDvpzBzI+QduKkvM7Ceq9jneDKMJR43ajTS2oUkyJvBsvEan+\nefkQy/tDpuiZwNZ5zfeZ1Qzmw6apJRT4aTSaENZn66spdRD4vgt0U3gPsXyV\nQTIx\r\n=Jxwq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.5.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.6.0","@aofl/api-request":"^3.5.0","@aofl/cache-manager":"^3.5.0","@aofl/server-environment":"^3.5.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.6.0_1583694349700_0.030211864533531863","host":"s3://npm-registry-packages"}},"3.6.1":{"name":"@aofl/resource-enumerate","version":"3.6.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.6.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4daa042dd251c48e10c1f8e2d2db23fd36cd1407","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.6.1.tgz","fileCount":7,"integrity":"sha512-YTSDrd+VNNa8BJTSHIp2LW4+arlSL9mG0Cqfxv4MkK0B82y+KD2dYAb6DFMOurjahmDjkLG5NJHNNZQ2wmEsOQ==","signatures":[{"sig":"MEUCIHCtXtVgcmBVZr0Wv9DKZwRrlAY28ImYBrl4fpWgSipZAiEAgwKTLjBe+busyq2SzbRfN3ZmXozTlCTGffvFP681UwM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZ9+5CRA9TVsSAnZWagAAh7QP/1CMiLRCY2UQTOlJfzX1\n6Xiei0Tbjq2oZ5aObqrMbMNGMhQiVk7+R/9ZV7MvSf87jgwL2HglYakxRpq2\nmbB7faOrA6u+4lHe+aVMVYrEFR5Tu/HIg7a30vJ4VBuzTELkuuyI6yCh9e6X\nmYq4juSumEYR4VhRIbHSZ8lavbU3YebsA2fJSy8OSUe2VnthFkKVGL1o/oj2\njysCqP6V+TKx4momMtRmc5mHAixQLcjYvtcsHZ3vp4c7a9fUrbbZvl4f11sy\nfvJWYun4CPOTut6uKQ/lWCbdltJKsnCvAFq5+I/NBBeMYAnKkQo1ut/TuGr3\neCOcaRCeKtZZzvvq5VGQvXnEbUbnwmEi6o6el7Mocou/MuYKU0Oh4zZmxaN1\nSS6yjzlqZKQr7ksOJl9/4TC9Lxg/ksvNGhrSZAqB5kQunShwNeEiI4ZN4S1v\nahzIqBOAiaX94J/Dcjio4MQnyR8ABLfQO79Af3Un16Kn+TYTg2/b3zJfnGEf\nCj0QHXekeOTJXaM8wIRv23I5JGvfilsPGYZsceRClpfdSwE4utp0DzF5AVhh\nU1j7niB31SI81lrbHj7wQdT2tRtccCe1zn9A1zpW6aMK0CeNjU4LLMfIO7Nv\nAPRMBbgsrINCLw2SYQtt2WhovlrjRynF3diEq3jXeSk60ONpVyksesroUrZy\npSki\r\n=kx+E\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.12.1","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.13.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.6.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.6.1","@aofl/api-request":"^3.6.1","@aofl/cache-manager":"^3.6.1","@aofl/server-environment":"^3.6.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.6.1_1583865785536_0.7254917245319854","host":"s3://npm-registry-packages"}},"3.8.0":{"name":"@aofl/resource-enumerate","version":"3.8.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.8.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6a72758d4cb56c35416f84c6a4c9ac971b32a201","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.8.0.tgz","fileCount":7,"integrity":"sha512-VjNlyjeUcZ3ilUhq3poJ54iH2VSD3AJdL9oSdfVX+msnVt8ti9j7g5PqTG8wm6GuBYOzIRsfcRmQx1bTYagylw==","signatures":[{"sig":"MEUCIA9rnqd0A/rkuo0lePCbVjH2NrHPwjxDMQblFULo453XAiEA6lpIK7I1uG/oA74LK7eo8qHazRNwKTiVmILs2TuVyx0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuvbSCRA9TVsSAnZWagAARXAP/RzW+x2TN0O5fpoH6zMb\npIBVsqus3uDGEyK7HIaYahWAyNf6fa1JGUL+s5DvPJoWiSGUleV9Fcy9MtU/\nsOrErSf7boRVsGPakHFHOkoIcaGCN44/5i8nz5LkoaTIEWHMJzbtSyeKt+df\nfwQ2pk6xldzU/FWjWlRLiURsIiIhDXjfIAKqnTiksM/A1mdSYKe/UuDHMLeh\nZzV8vIMatRBt/iXstWWkL/sECvZZeiexYmU9NTr7FW5okfZlAxo4K+OEnY8j\nU8v6Fl8YTtZRhzLRc/9lfTgC890aaIwnVjxyaQ6fRuFdLmdInrKAHzi0ARrb\n+L3wypg3xIWgx3cgImq0v49VrfIcYYriNrRXWofFQFn5BGN3/pylLWL9OdRC\nJsvRt9f/nugmpZiW2CQvEYi4DkcdppNIjsDuR5ZiWf5KDIpKVcRkHaUSMVyb\nXx3qhcTolYiMxQd+vLIINnnhFcu4zJIKR/aj1AqFGYa/nihYwvkwlWEgpCPd\ndUbtdVHueF4xMZgqHAOePsS9zJ221DK6vgHRHJ8lQbuQSBHYFo1ZvWKlg4Fy\nKmm7eIv9scAG+g+5Vc8G/mQoo0cAVEqKPE82K0m9SJaAGFpKVhm5tf9bCpdT\ng9QhopXHE3SEBX+F/MFrTdzh8Bc32v1prVOIZKDSdaiIBj7eYSSgKo1qwVrY\n5AOE\r\n=2Oph\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.8.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.8.0","@aofl/api-request":"^3.8.0","@aofl/cache-manager":"^3.8.0","@aofl/server-environment":"^3.8.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.8.0_1589311186179_0.5181488487231773","host":"s3://npm-registry-packages"}},"3.9.0-alpha.0":{"name":"@aofl/resource-enumerate","version":"3.9.0-alpha.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.9.0-alpha.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"8577a280ff7b1dabce1e84838eed47cd0d726880","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.9.0-alpha.0.tgz","fileCount":7,"integrity":"sha512-38uXf1Uk7C4YhFp5bi6dFCoVwVLX7ukus1amrxmadJ49Ik+Q3qjrkhvR1WHWMLgOz73tWuzu2kKNE8XCFctDDg==","signatures":[{"sig":"MEQCIDE5kLunYSBPHsyeWExpJaXByc5NBp0CozPA310p7mTeAiA3BHH1YtTJt1i1EEyV8XP8ahsXeA7QA6WDjYGo59FOrA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30287,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuvlECRA9TVsSAnZWagAALMsQAJNBIN+IAprPUcMH6o0A\naPJoILhPFIyodxqkdr3ksGgzKAvoHjEfpJbU5FPkndeb9xKZrKkZQUpXUMVj\n/EuGECah7cPS660JotbJoToXwp98FLmMBXTKtcAyPCjYoFheljsV42ZgG8je\ndrfczOZISYGGZykicI2Ygho32EFaIeJi3oMWQJhcxZVTuaNGwnsWe/tTVTUf\n7eEV9sRflpEVbACWf4lk2s0lWb25cY3++P9H5IatwIeU7Z15CJV359ry/ofA\nUv2mSZbLQ8tDHQcV2+NqUTYACW1tINeLqcZjfby/kFMoQG/P5JkSjm4Hgb3R\n+sqOlGVRVIxWiCvwlKaQtDY2yiOo/fJ6D5fzQfY9A99nuoDnWNhxbKmGVkfB\nWUNS8zub3hSTKiH0yCRic0g2Rh0dpv9HecTwH1tf1qsXKP+B0vnAZepVUWM1\nhdxM0zgmTHt3grbPuOlDVcMfTkzALTjlavcAxj7G6oQ04mUy1JDvQpIcPghI\nOrFyIM9hCDOlCjnPfvq2RtWxstCp0Y9SsGlTLeMHzGFjHREXkNWTpJuusY/5\nWpKRk872/E9vSC+FYL5N9BtoZlmFXbVRSGXwF+V/4MMrJOKE48ALDUr04T32\nvBmIdnOdmUXW5l4r6OidvSxlrHKyCvhxm83o1QV/1h70fbqhir187bK/NLzb\nZ4wH\r\n=fCUO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.9.0-alpha.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.9.0-alpha.0","@aofl/api-request":"^3.9.0-alpha.0","@aofl/cache-manager":"^3.9.0-alpha.0","@aofl/server-environment":"^3.9.0-alpha.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.9.0-alpha.0_1589311812458_0.7131751864033091","host":"s3://npm-registry-packages"}},"3.8.1":{"name":"@aofl/resource-enumerate","version":"3.8.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.8.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"eb0883d259b4d8d886d8311bd4e9e71e53f22823","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.8.1.tgz","fileCount":7,"integrity":"sha512-eziL+8rUTlLOWLFZgmWBz/GsXvVUP1J/h+MJ8mCEQA0l2STsIfOBOJs+mnrJxAb90oXMmyWSBDfS2YZIIabrZA==","signatures":[{"sig":"MEUCIQCJJVaXcA7T5nkrSH5tL1Qbd38Bxeq9HP/nZsX3YvnUIgIgY0aMZJky0AnGRsT+qPfLyEOA7+p2covWSwVG4Thqgzo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuvvRCRA9TVsSAnZWagAAgxQP/RcZk+pcQREhRXgcQ1lA\nqvSTYsHjETy3bzhzjTcAlSIx0359X48IoLdwCIT6dmyJdJmKGe33JbKSUirV\njh2yQFjp7XI9mYdcNjOd2pUmt8y5u74juIStjheAXtg0i3liltBz3OENJqdn\n7wBTkNKWV/VURhtTG4Vvwd0EOWKE3Dy/5WOWn35Gd3To638nnceUyr7m/zri\n89WB+1TTOcR6khpFzrA7QRABlZKLDrpV3YCtYofX1CUBOnl+VL8C5IhbL6xY\nhZx9tv6vE38QTRwhQEAfg+g9UgnRVLczT1S/pN9L2sR1H+zOEoLfTbB1ssWZ\nUgs2E2OGx0FR8DSTrxQL9I3HYzUbYTT5EIkiK52iBU688+rbNiXLTag8K3Oh\nV+GXoO67GXdfI6ghOFCi5e63F6uPmiwiKWRol/oIVsJd9BNgWqAJdhxiy4eT\npgo2io/TsJ55lQXmBb+LVYYpsCZPPN/DhDUEBKqSIYdp3R/Fe/lwdOhglSKu\nJxYDHmM/gL4exNccfhZsdHnGjUYjvV64SvRFSNmERTryADXmvpxiIktGWNBf\n57Hmgi2eZX9lRkF+W9BrWNccu23OnNbpWC19FDjuAsE/RBHivBHVdQ3lW9QL\nVrwaA/XvaFE1ckxVlHZRGayEJolYHm4myy36YgcnXaK22bb9Y1p7uWxryjWd\nfwnt\r\n=ykgU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.8.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.8.1","@aofl/api-request":"^3.8.1","@aofl/cache-manager":"^3.8.1","@aofl/server-environment":"^3.8.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.8.1_1589312461930_0.31495728230581","host":"s3://npm-registry-packages"}},"3.9.0":{"name":"@aofl/resource-enumerate","version":"3.9.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.9.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"57a0b48a2662033df4b869714103cef6f7af0953","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.9.0.tgz","fileCount":7,"integrity":"sha512-10VjL+u83mnkQCua4PMT2zhaQebq0Tf0uqfQmYFA/lX+7H7iTnz0DnrYSPLKHmjc4I0RO9Ao8HK1xHkqZrXFUQ==","signatures":[{"sig":"MEUCIQClxoUs3bt/quJmA/gwQYb2Te8ZR74So+SuNNHvr/Fs6wIgVhF2c8hZ8XSba+LxX32M5MRJlYtkRHrUWeAlCpV6/jM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevthACRA9TVsSAnZWagAAeQcQAICZ37S7ZzIOy0MjAS+i\nd6IOgAxhwwyp1ifxDmdMBIihW3EF6AgqpsdEO6y6Rps4/wPa26qdzCdpejDw\npsOIGdJvxFLou1RwLurjVUWHmhW9iyKhd06hL4roN3GBeY6gWxi6fBe8Ei0F\nYy10VhCHpahNqnpLJWnEnrEZsLF3LAj9jJOJYuPyP4UmXfkbqiNkN8ZmOOpk\n48nHEyGh64ZFsRDhSOAKgFp+T65a+E7xrlv1BFhafU0H9LrrCWAZPu2lgAY+\neeImxhujQTFU3BZfghV6fIfzhAV9PVJ181KQpBJN8dbIYCa0CzDyq0e7LMTN\nwx8EnDbyelLt8VY4aBiPOryA4TH5OnSTqo2aQXKD1VKDspTA0qMHQRUl2sDI\nnipKRSl9hTZjS/hEOLaVuYDL9cuPA4kGctiITwTAEF1W1HhrG3DyqVfoimtN\nSyDTqf8jaJ8uG6bpZ6GVbhSRZX0R/as0G2CMUlQQPhjrgY6YXJooCp7+1tp8\nFtzZaTFWtJq8Q84N0vELqU/8q4vEgiXEPAKHUvnlQ95ROQ70dhkkuvsYZJJP\nqQjEsYEySgwh5lXS2IkdjAiW4tc/ZAWEQIHzErvNqWrDOsSFELwClOVK6kYo\nKoXrLG0byrU2A0UyZYjuISLKF1YFUuRi9cExkC0zfN9lt8p4EK42ScqT0+OR\nL2aK\r\n=shB3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.9.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.9.0","@aofl/api-request":"^3.9.0","@aofl/cache-manager":"^3.9.0","@aofl/server-environment":"^3.9.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.9.0_1589565503815_0.8046108714931461","host":"s3://npm-registry-packages"}},"3.10.0":{"name":"@aofl/resource-enumerate","version":"3.10.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.10.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6b7491ee78fa27010284d909405c62e4233b1f90","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.10.0.tgz","fileCount":7,"integrity":"sha512-VfsANB9Ga4/gFeZEdysD0ixZ80XyTyDS9zV2OsDT+Db0u515lzQ3act5Gs4r0WmhasKFIIuG7mrVUKiznOMCqg==","signatures":[{"sig":"MEUCIQCJDwtQcx02WIPZtKe4EShGKSvJgVsFKtfTTK1ypAplUgIgcUUjtahDxvH+ZJ19Upc3kF1n6sfzHRRbBFbGyMcs5u8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevwZ3CRA9TVsSAnZWagAA7hgP/jrmZyAfl3RYOQ5XR81r\naqVHoFAsJ84r0qd2Ywb7ETr9WOILzZQR7J9NcGgSixq/KG6OG2DNbd1tOZEo\ne2fi7NJzSySrUEhSM8VeqMsgiLcnc0xR8QzVYbjRpVzE06DHUge+rcxCcNeg\nHJ7uLOWjM/HkYy7A2na1d5tgfepsQgBIuKZe2ZI2dLWJ0fwvMppJazzh3CQj\nwNk7Bsr0LK3zXsAb7DDUIeiD4HYStC638gBqmuwRNMobvco2FGXyDlNFszdp\ne70vQ0mlq6AN4Of+hcu4QEO5RX25TzjxxvUxXg/F5yRmm7qahZKWNAyEYMpC\npwbnbStA2Klst6+6Wj7a+Ga8lEv7BqqhvlOzL3oy4T2ryDKMntYAdGb5lSH/\nC25L7HewI/RxA4Tn1HSXNzX7zNkZ9pSwajTg9w7qUdQGEGpUkwH/4ALiVflX\nlQS4Ki1glCmBLbnnSbYkQCuEcWFCl6k7xoYDwm2x5ITV9/b4aWw7fqhNGytP\nZ6B2EhsVGysgf3L9zi1QI0lD0bcKcdElvSLio+0ntF7wCY/OYRqTiMVf256c\n4bGi9yJna6NzPVwoLw+XxYOSZT81Z0iQD4RZ+mC6rKcGdiUtum/ep2Z4Y3nc\nBigz5zgSVojXlMocohTQ3DL0MpU1jFyB82eg74V3CtM0d5jV+lxnsPuevnPS\nf4id\r\n=SKu2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.5","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.8.0","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.10.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.10.0","@aofl/api-request":"^3.10.0","@aofl/cache-manager":"^3.10.0","@aofl/server-environment":"^3.10.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.10.0_1589577335258_0.669191694352494","host":"s3://npm-registry-packages"}},"3.12.0":{"name":"@aofl/resource-enumerate","version":"3.12.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.12.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d745086dca9c63dee9b69878fcbbd023bc5ae07b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.12.0.tgz","fileCount":7,"integrity":"sha512-kLoN4oOmBA+8Zjy6znzYq1SiXExoP32X4ngyEMN+6OZQe/oVopb/IydpQLznQXULWij748AN8/LNpUkGu12EMg==","signatures":[{"sig":"MEQCID0rL1XbvZfo3Nzw7BI9xx9+TdhOvyIZ64JhuZcuDGa5AiBhCB75mY9pqWxjXv849gVEsML8hjByL1jB6oAMYmobJA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgB3L2CRA9TVsSAnZWagAAqbQP/iiZ2m3rLh6mO2MuAAex\now6aeBv/ydFefi2VWIArCOVB/3DWyBuflv2ShsvK02TJOeZWp2isgcVKP/fY\nMln/SgJFcjdh+h7SDb486bxloTdQIKRhQ4qd5K04PxhL4Q3FFQqY1KY3k6wk\nfKdmq0i2P/ebqoBEg+WRHsVFh+XS28o4bsW50d+Fat42vSuDeSmLEF1jYNz7\nO+0zj2R1OhRgduhI0q8JI39qq8FRpAl4C+4Z9N5wmPnhYIJCxuul4MmjX47I\nmFI/MjAtRCJM+Ch2EnUAbSeB//KrvWPjlDgwk5UQ6PFOZp0fuRzhsd2NmDMS\nqKWiyQUJlpVT5C+n3C0wyA54E/LuZAMWfHpLwxP0r6Q1RR0WkaTrbIPjxLqh\nWY48ARXhd0AnB6sD727Nk6vdIJl7OJGiouGSe4xvHl5YWQ14CncatOL1pZis\nnHU/alkz2wcIWWqBNuWYmKZIZ0Yi7sZDCqHFAdWX4osh2WZXu/BPbQI94ALn\nA7kHGPffSI0zac482O3q+m1wV3PKHyOKwaMByLfN5I8QcEe1G1Dr2FCMx23U\nFt74MS21f0DGRPkOCGAaAu+70fcW7UCKn3tvEx4oLssU8yDPeoV1qqrDT08W\nxDhnh0Ze5OpoM9+BwTLWIX4XW6gzWCXSU3d7Auav7jqIinFYgPoYvG/AzXbY\ns7Ho\r\n=Tqev\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.4","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.12.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.12.0","@aofl/api-request":"^3.12.0","@aofl/cache-manager":"^3.12.0","@aofl/server-environment":"^3.12.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.12.0_1611100917906_0.6659122655700402","host":"s3://npm-registry-packages"}},"3.12.1":{"name":"@aofl/resource-enumerate","version":"3.12.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.12.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"55941c4b7b810b0fa49fcc4b16bd069cbe8c98dd","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.12.1.tgz","fileCount":7,"integrity":"sha512-C+5+irkjRk/k/oMhhl1bp4qv/p+2xOrDEzjkpfij6freRhhL8GSRdXZ1VhoSCBH6aGLFvMDvxhbBkXplDiF6xg==","signatures":[{"sig":"MEQCIEF0Nh2NwZWxMmxA0ggUuf6CdkwM29aQA7TRA2Zyu1icAiBwmIKPiEJvhR/NKeIuYSLj4zZvZNl/oElJAJp4wDMiYw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":30245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgB3WICRA9TVsSAnZWagAADL0P/iR9Zq5zEHllgcvrLTkj\nNEayOHSPcjl4M2NwqXVW84BnzaHVrOTWnVqTG5F0Nm9xOW7zvMOw0Iug8QgB\nkpdZEHikPt62JMC4TPV4bLuMsZRYMKSFEZv1fCSQBZKngfItmMdHJZ0Td1jL\nQiRDCSWMtMai+f6KTAZprFpxtTsKnOrpVd5PlczyNPhHNR3qHZdxR7MeqOlG\neFaq5pK107gJ9rF1CZ/bzDwKG1xjHHGPMIbk1dRRh37N3NWfhQISnFrRESq5\n5uZx8TFlck9qMsYsNSnGOWW7zvIg+urw9R97fimbXuLPd1S6zQcq3jlx/OuZ\n9V4UJLXXKnRtoqYSxsC+LiNIN0p9oTJE5QCZxI/C7HKgIVvTkoXJLYLYUNwh\nRSmXM9tgo6npCn+OV24KdzCdfg+xv3kF/8yZ9OZh9Xqht69+2SK+5PWq2fnO\n0E7s6Rd6z1reHaiI4PC04814bnledPTxaWLEQK/lV8mjKpPmjwtULlBaWK0B\nucTgCi1TZoay2OLkXDdAlihC+O/aBiLWydOEGKjTybhSpI+qfgevbvIaOyhM\njPL2LgjrxALGnEWUwQu43ozUBS234us46Mg8wD7WtSHEZr7kq+OxXBodtr/x\nTDtiiNTOInpSUH1lRSAVVVOqY42VT73XhLnRVA1J4WM6vXgqfmKqQMqbAlws\nx9JU\r\n=WnK+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.4","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.12.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.12.1","@aofl/api-request":"^3.12.1","@aofl/cache-manager":"^3.12.1","@aofl/server-environment":"^3.12.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.12.1_1611101575634_0.19252894944254995","host":"s3://npm-registry-packages"}},"4.0.0-alpha.9":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.9","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.9","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"8ca35b959604b3aab1315b86f894015cd4c44feb","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.9.tgz","fileCount":7,"integrity":"sha512-U4CtO4pTJzU+lsuHIn4crRkCldLddBgiWqHxTqGtb9lvDW5uT6nKqI6mi46Z+byHXZVERRuOq0F2b5hlwqzAwQ==","signatures":[{"sig":"MEYCIQDMi0hoVBuiwlDG0y456R+Jg29LBR/qSyKTt1Rs7QAL1QIhAJ1yKUcPAcYNZ7GRw25ikCWqGuPaJfsPqazG+SvAOTQr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28166,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgDdCRA9TVsSAnZWagAAgcYP/jaM98a3D5Oz8irvU/jw\niz1NU/hYk7Hz6ikJgXUrph17Gp23Gu+Qqosta8bZmZTmPjIwjNzAW9XnA63g\ntDtyxe+sgpOVnCGRqq2gWv7uf2cEhlO8iGBAjFsR/JvWPJbTgip0mNXqVi5s\nsRGR1TeHAGenWEV8Fx0IREd7GmDejm8Nm8OTOZejFxkmzOKtc0fvRLJU7J9W\n8IhBSGKMYPwkOzRbJJs1SoKj/WVSy+/knum/eFHDRd6vH8SMakF4Ex2T1sUe\n38WBSTEWehE6Am/YNw1u0XJwvc9xIp/FC0NO7mKj4wJSHhEtwLV5jBQwO6bx\nKc6NYJyuVtAMibQXD+Y/0E9uSpBGP0H3Rwr8yDr+9gpqiD14X/5dgqedaCRF\nT+MQhSSrIXUPySponFSKiUIW8dcfTNpXv7NEcko5lkQxwDk4DfZUuA20uUqL\n45vB123+8veDdMhCSnMGKojsdLc3ITfTwLBEIEtOplOyABVIkZVMKpz5rWx4\nK/wBw+iWju+jQpkQWhRDTylPpzFNzmJ6BAoICYesnZXSJcC5EoaD9Apx5kPJ\nMySmD4kv1gXiyaap5cgOnCDZ7gEOWdqEgKsaQFmUAy5Jpxl3eGDs4mgY1ce0\nQ6bU9fivMY4VqBkgIWPV38g7s2snbSL8sTSIAqJA4kF/02MErguTMLbSaFsn\nnHAn\r\n=3oO7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx @aofl/cli build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx @aofl/cli build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.5.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.15.4","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.9","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 5.0.0","@aofl/api-request":">=3.0.0-beta.5 < 5.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 5.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.9_1612316892804_0.6622510359716611","host":"s3://npm-registry-packages"}},"4.0.0-alpha.10":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.10","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.10","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fbaaefe69f55a34513ffcea9f05acbb9d4192482","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.10.tgz","fileCount":7,"integrity":"sha512-/3jjL4Xpn7rny/Ep4xcCiodFiPfuaCZmFqQ+L3Saoqtuhaip11wRgnBNvGxIPVGsr3sHsWZiUncgRb5pMQnuVg==","signatures":[{"sig":"MEUCIQC+fgbVV51ZXnk9lp/wwGY6U+o9bTWlbxAMekxb0dm/vgIgAi9Xi0Eq8xAGy1zwCGTvExaJSOLH+aH98CEGnowPdjA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28140,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGgLFCRA9TVsSAnZWagAAd8kP/RQwvfWbgag/DZr0/uw+\nMsHKMaQgFDz//CKWk9jzSu3UJR+5ln7GEftsu/7CziocWrv+7kEjbqM1UtJW\nH6BTyDYxX8bC9c4NTTPbshx62XCV+G4qpEVWqdY2f8zRCJ6c9MgC0p9TlxcX\naPRNyrO34zLf/eug3+5RvjsUS11WRNw68Q6BU7aSUUnhk54LKXIoANAAykAA\nqKFaY7pvvUslgNDTNYcZH53g9fQns+Es4g7rHN6uqbNCxN7LyhN8n54C0059\nOz8feeu1SYQAauPaFqoNgYMqz4piokhf1kJUegGwoooSa2S/YqtNcf/AXNZs\nB8GgqyLw1tG+a8/a/YkgmbOuO5nzYQrY0MGlD/i06vtfCmjhfy7WgtQfdcMG\nnOLnGsoXfTXjUMDtAwIm1oO3tRfI840AFHPOV3bizm/y1c/jDIKYHGcsp+25\nDy3yeFmQxJ8+lM+RPmlirBsF1KSa6SEfTxsdF3qy+nKYBYlj5HN+cJdrT3+B\nL8kOdxjlNR88C6XL/xNYvZkaCbVeW0UplCRxgk59SyBiMqPAm0BEpIYOLDRC\nXU5hQ22jU07x9rhKx9ADTBRiN0KSKqxDH0o9uVHkdtCDA0pMhtXqwJjGGbNn\nqkOYRbBJVgPXMZkdAea1vt9qWpKLRludiKVTOsSLeepNW1KksCzmRz3A1dZH\n+7nL\r\n=ZINy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx @aofl/cli build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx @aofl/cli build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.5.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.15.4","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.10","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.10","@aofl/api-request":"^4.0.0-alpha.10","@aofl/cache-manager":"^4.0.0-alpha.10","@aofl/server-environment":"^4.0.0-alpha.10"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.10_1612317380945_0.1520590746779189","host":"s3://npm-registry-packages"}},"4.0.0-alpha.11":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.11","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.11","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"61dcc2d30e72b8c5f0af2d49495f8c88a43986ae","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.11.tgz","fileCount":7,"integrity":"sha512-KYx1REMEMRgy55c+Sg9GLF/SFsuhhxYkRQDQStecATsxhs20V1FEJRXD3GDkYugQrzSUwX5PY68GN4wwGbU2LA==","signatures":[{"sig":"MEYCIQDFdneUVMNFa6dGPH/BUJ4HOvZPBKjGLBP2LG1F3Pq5rgIhAPhgR1yMJ4NTH8VxZuNRpemYn41hskzesD/IEE2cQ5UC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28140,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGglZCRA9TVsSAnZWagAAhsgP/jEsKkjawPn62Zvc16Cs\nliFGqmfIIXrhc9IRRBZedkCxWW/yCsV/hgGhkTSSZcn7QfsJjdqiqWKgt2CY\nqlI8x3U48qMAQf6BSq6zjEx3wsclO2iU/GPXTITz+62mcZruigBtDynCCiRh\nbs/POXxlW6+rZwb2YR0qTW+anNGyjGwrR6CimNqisK0yKyv/o6juDAiuYk9T\nI7vClMxEliidi8whv+5nmsb2Go0NdnIBNmuLjwymvJv4rl6onbhbKIBFfb6E\n1lsLwBH5VpghjZOM1XOIUGFkbgGqSC1afTggTPGlPweqP7PLTy58yY3+yBbJ\n+A8WeJdLsK+HXgP3+CIG1edHXgwSWYx/mHdW/UV9Fa9QQwhgGc7N1IVjPaFg\nJurECcPk4lhZRf47kT/t0eUtxAvyZOBVHcIHTf2XliDwDNZl+9GCjv55s063\nz1cIOt9ubI2/0mRK5DAQLrE/qeX0JP4Gg63lm8Nk+nw0Ld3dVApVyPOmOZp7\nacFAGX0WtEoTVg/3bjiKNzyJLMbTgvkemjpckxdK717Sq+Opk74oWHPhew8z\n+NOjJh5cPb+goe+IyKJhsbEb0OYVGZs/llzvnOpwEerRc4QZjeoroZ2yVcn8\nlgWjUTelmaw+c/yTShon6yFEXjrvODljNua0L5xkUcpCg6WTmabC2/57ZbF+\nyt7/\r\n=QIrV\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx @aofl/cli build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx @aofl/cli build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.5.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.15.4","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.11","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.11","@aofl/api-request":"^4.0.0-alpha.11","@aofl/cache-manager":"^4.0.0-alpha.11","@aofl/server-environment":"^4.0.0-alpha.11"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.11_1612319064619_0.7098558507289456","host":"s3://npm-registry-packages"}},"3.13.0":{"name":"@aofl/resource-enumerate","version":"3.13.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.13.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5346abe6d229176afbfea8f0af0a926dd80df31c","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.13.0.tgz","fileCount":7,"integrity":"sha512-CGArJdhMco5JQ+Xj6IoxovRQ5sTSDVHUnttJurdHS9Sk/u2cXhT77Qbbgej1N3Kmr05LwTLwF6CICneMcwfTKg==","signatures":[{"sig":"MEUCIB7uuGHrAC5riv1TCt2SFfIx+6wO7ovpzpefcIAbk4a8AiEAyc3a8Qs/YGSCd0GMvl9xGAiP8QJxROk9LAGkJO7suos=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":29902,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgODYuCRA9TVsSAnZWagAA/iAP/iyXTmZTDLMIbSJq9Ggz\n3IElpkb+2Hxf+K7Rq1ESua8BkU4gM5An3To5S5izwtYyJid0+3ktn3Gnz+Jy\nXqAN+QZVo4ogP0ftfpvQG08UhWmGzEyChpsl/YbcMm6WiFQ7rObYfcmToDEw\niXjvPNX47ZungoLJYc7CKP5FVAp9SHOvT8Kjr7msnRQMqAdv2EvhXKQZ9Vqe\nz3fWYmD0aieTJrd8ojvirm6RMF8PspbUqZTSLW7CbPi9hxqN4OjC9EqGbZOS\nvXpatGh2rVY4R2w2m/989l8SXgI0fG8B0cI8zvrJi9OqPf5yEaXxAxEkM6aw\nwZsfuG11YVaKqdO2QDweWdQFbatCAj7ekm0s7/ZnL4xQRB2NKew1Xtj2KlUD\nvTxoqxoJy1qbISdL1p/0IVRWazv4P2IQy723FG8GjLS7aCWGCQ3iOHUjoEJY\nqUfq786hmeP3SittZlThLhCXW5jDD4gBozIn/qn783n6uLc5ZK/cPUOpjASB\nhsuR5+lhI0rIaQVNl+uSWwU+aSbBhpjSWZ1V7KWVIZMdrjGv8mbw18b5r8ND\nFuhnR7TL1rtvaM1/4bgTxwnJ9wmvrg6LeTaxKKRF4dPIguXNhjc/ZIZbXxZt\nfF4g2sXDMtPm2gU/S3dTJl1I2gg+4rRST8zyYLZfFC99PdnKD6mXf5PPCgb/\nrVTF\r\n=m573\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.13.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.13.0","@aofl/api-request":"^3.13.0","@aofl/cache-manager":"^3.13.0","@aofl/server-environment":"^3.13.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.13.0_1614296622334_0.7407588240088943","host":"s3://npm-registry-packages"}},"3.13.1":{"name":"@aofl/resource-enumerate","version":"3.13.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.13.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"376ac7e8ad04383ff5cea90bd260de89b11a98d2","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.13.1.tgz","fileCount":7,"integrity":"sha512-bhzH5nvwu03FPNIui4YMUhID4Mp/oIn2h43rWsvVqEqdis+KHn53WD86MaxGtnBK+REjhis3jrxnH7xpXowagA==","signatures":[{"sig":"MEUCIEw34IXsb1f349QrD5ziMj5BWO+oMry6IoVTbtEv+QdxAiEA+eAxgHlyt/3E33zYweFQiy9Z2wMQEU6xwJOeHN65tgw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":29902,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh11qzCRA9TVsSAnZWagAAT9cP/0t/8ZDJFURdeCB6b5Gp\nW2+hHb6j4R/nDJAGZ8WWp/H7q+T7KC/tRUe6ECM/qCGT9yCgKQ4iOP24jEQG\n09O/TnFM+7+8gxFrd8z+g6r7gg3a6Aerm4v0e56apjhoFlGBMqYGkcecgqse\nddRiOFtXwcPFQwxizYmUWgpHPoqTzKxC3tfQG01km9GxoKTEgPdWYSidVoO+\nJz39pQSk4TZ/51s7v9AMxVYx3a4/l1p5NyFkvrmOV/LS2CsjiaID3Enw+eOW\nZ+n9oDsVekEUScmTmU4MjRQV95fLwSxWBmzpP5EPFSjRUB8KIpwfmtpNtpqk\nTH6DVBW20DP7rm+nBfqUKaVeE06FZ9j9M1fQ6eVtWmMzQCxTINtrDmpaDYij\nCZrvDOb23tQOoTRrHY13t1vaDKDz4pYYTLHSx8owLQ+54QR5vkC11Df3sBGs\nEFT9j7CcUS1emTME5J9evGwomfbi3wELLuXqmSr9O4nVT4p9J7rAkDxzn50z\nPECP/B7ewx0rrkUdQokcWIyOtsVBvGjWT6MgOD0oY120CVC45pQgzI3mj4zY\n4fNnRG7Tvppq+m+m1VeoEoq39XXqBTHAVW+52pndTXVl7VihAmrW5qNVhuIi\nD1bRRTSRiJsljLjHAAbMjdeeg2P3CqZ14coDIvmOonqnf3N1hUPxrekcFapr\n8DL5\r\n=6eTj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.13.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.13.1","@aofl/api-request":"^3.13.1","@aofl/cache-manager":"^3.13.1","@aofl/server-environment":"^3.13.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.13.1_1623800935019_0.29439342776032906","host":"s3://npm-registry-packages"}},"4.0.0-alpha.13":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.13","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.13","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fada098ce356484ff3633b98d15f3b76a57a117d","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.13.tgz","fileCount":7,"integrity":"sha512-9igAEyLHdXGA773W9Bz6+Z6OI2GXsARkwZfmZxgGRIFcVcBuMXulT4OVm5uM2dDfO4hpdlN0gSbG0J1OWo9YRQ==","signatures":[{"sig":"MEUCIQDxfH5+rSh6Dbq8Pmqy/1aNzv9WVc49Q2pmWZqRcuA39wIgEhaxXEGNP7Y/7g/uKECaQKCEjfRO0fl1hm9iHx/Hed8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27168},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.15","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.13","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.13","@aofl/api-request":"^4.0.0-alpha.13","@aofl/cache-manager":"^4.0.0-alpha.13","@aofl/server-environment":"^4.0.0-alpha.13"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.13_1632439936894_0.9086773872065146","host":"s3://npm-registry-packages"}},"4.0.0-alpha.15":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.15","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.15","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"29d3ef26341cdf6ae93ea98f3c40e909ab2f085b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.15.tgz","fileCount":7,"integrity":"sha512-zjtHn5mdKruyVEN+MacUsyOt5zcQmEMTTTECFQFyXRL25fyw0E3cZeLkWFDp/jNBu3IBawquoQEKMkN/JPWFUw==","signatures":[{"sig":"MEYCIQDQgwB2pbCBVg/nt6MTetUmaWfT6Q/8Pry8CRBImdBbZQIhAJyCJFWK/YQb/pusAdRx5ItMAfPRCi5mrBy1n1tmdY53","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26821},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"7b448cf64b30502883b3422662a9480ea25f2d60","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.15","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.15","@aofl/api-request":"^4.0.0-alpha.15","@aofl/cache-manager":"^4.0.0-alpha.15","@aofl/server-environment":"^4.0.0-alpha.15"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.15_1633539834964_0.5550920723684893","host":"s3://npm-registry-packages"}},"4.0.0-alpha.16":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.16","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.16","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"a20aabde254d85e776f13328115417111a078328","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.16.tgz","fileCount":7,"integrity":"sha512-jGOYQjMOmLahA+q2L+zbMsZk7TSCjwKxRFW7A04GlOMO/ZBpLyhQU9zZNDKVTHYD4bGFtMAkv2+KQnRHb0rcdQ==","signatures":[{"sig":"MEYCIQC8dGeNyWEP449AkdpVbNJHLxTxOXxUI6hrMTHnkAhrGQIhAPyhmp98A+1zP1iDcgSaEzhPwuCwy6EPHPjPUZcQMfFX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26818},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"7b448cf64b30502883b3422662a9480ea25f2d60","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.16","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.16","@aofl/api-request":"^4.0.0-alpha.16","@aofl/cache-manager":"^4.0.0-alpha.16","@aofl/server-environment":"^4.0.0-alpha.16"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.16_1633539910732_0.2772178261480498","host":"s3://npm-registry-packages"}},"4.0.0-alpha.17":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.17","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.17","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"474a6446666b6fca8ceb9844a6320f1a42da9156","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.17.tgz","fileCount":7,"integrity":"sha512-NEI6k2+2w1OMzObrKnncg8Yro60Atsmk0QE+b3wUBrOlHvXFFJ+ssZvidYCNDXjxxVKMOJ7czYeGd19T+1sx2g==","signatures":[{"sig":"MEUCIBIaDOW2lCl5w+l0qNvjZUcLxGITESICmvxavCuN62s7AiEA89KPuR4WB/9UionHt7hHS861E1SBaRrdYS8JZ8ddi0k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26818},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"c7b3ad6feb17eaf3721a5528e86a31ddfb350ef3","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.17","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.17","@aofl/api-request":"^4.0.0-alpha.17","@aofl/cache-manager":"^4.0.0-alpha.17","@aofl/server-environment":"^4.0.0-alpha.17"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.17_1633546053780_0.7327606672636184","host":"s3://npm-registry-packages"}},"4.0.0-alpha.18":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.18","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.18","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"dfac85e120226ce86bfd45ca505c4d7119b95feb","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.18.tgz","fileCount":7,"integrity":"sha512-F5OA9QtKCx0FGFz9q4BBluHvdIh0QdcxlTf/9F6x8bGtfTafOp+gpTywYKxFHwjafBaor4Uwc2Axl9wOLBWyEA==","signatures":[{"sig":"MEYCIQD2FvSv+qsHX1YR7VJQ3/grdaKwfo+j5vCGairMetGWJAIhAI5qH8ubC+5VPq1FksDvjYKPuwbf4fFmutvksusJnPFX","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26818},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"3971875a8be8fc1e4ed7f6c737cc9aa1653e049b","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.18","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.18","@aofl/api-request":"^4.0.0-alpha.18","@aofl/cache-manager":"^4.0.0-alpha.18","@aofl/server-environment":"^4.0.0-alpha.18"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.18_1633563635496_0.8113577000485166","host":"s3://npm-registry-packages"}},"4.0.0-alpha.19":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.19","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.19","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"010e306833ea694838353944201f86377deca89b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.19.tgz","fileCount":7,"integrity":"sha512-E8ahAkJOw0miI4skNCnFbRatIr/S8SaNDyoxePKP8V0W4yJjza6bpUIQCMbRJ8uWxrtIybTMwj1RXTkDUd97/g==","signatures":[{"sig":"MEYCIQDEpJnreGu38oNNArKX1T0y/wvwn1cjBWLROSCNl62quAIhAMw6LIM6C8O76OqJJRsNZ6i8JPvlWywe6UHefSFDLPPj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26818},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"79369e766cd4fe78098059b93d1cbd7bb5dd8830","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.19","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.19","@aofl/api-request":"^4.0.0-alpha.19","@aofl/cache-manager":"^4.0.0-alpha.19","@aofl/server-environment":"^4.0.0-alpha.19"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.19_1633564051162_0.8125330551073837","host":"s3://npm-registry-packages"}},"4.0.0-alpha.20":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.20","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.20","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7b90daa638d5c8338f192ffb3ae419754efb523a","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.20.tgz","fileCount":7,"integrity":"sha512-ZTyifJAcqq27v4ECxzngu+2cdS2UfbmbmaL3vx33hlscnI8Is6p2d7ygT5NBEPt8IJ/1+WRWvwmgxXeSfrS18Q==","signatures":[{"sig":"MEYCIQDixBHUMFYBlXmvZEc4HRKPglxl/EnbsDk7AnBL5/62JgIhAOYKij5KiJBzA51Lp4sPX73fCda1H9I0KDQUf4hX2kHG","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26818},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"398f195bda4d61023d6d7889598f5688c276f1bf","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.20","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.20","@aofl/api-request":"^4.0.0-alpha.20","@aofl/cache-manager":"^4.0.0-alpha.20","@aofl/server-environment":"^4.0.0-alpha.20"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.20_1633564498403_0.48922215837930194","host":"s3://npm-registry-packages"}},"4.0.0-alpha.21":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.21","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.21","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"68d22926ea266af9515f0e7fa2afbc93e2834638","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.21.tgz","fileCount":7,"integrity":"sha512-dbxTbmhp5SwK7Kl97zxYcE6Yc4DKaZyNlgeflLwXJAQeW8GyJiMB6FREr8HKxsJPAWxsbsz8qq5tvezgvOdenw==","signatures":[{"sig":"MEQCIEC1xzHlMXU/iwHAqWhM16PCJ6FMDd5qy6N0H1xKTjTGAiBSvrLgTcdBQn0qCeXUZs4v3Jibk05cPHsaPHnFnXL40w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26818},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"398f195bda4d61023d6d7889598f5688c276f1bf","scripts":{},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","@aofl/cli":"^4.0.0-alpha.21","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0","@aofl/middleware":"^4.0.0-alpha.21","@aofl/api-request":"^4.0.0-alpha.21","@aofl/cache-manager":"^4.0.0-alpha.21","@aofl/server-environment":"^4.0.0-alpha.21"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.21_1633712762454_0.28531652948421327","host":"s3://npm-registry-packages"}},"4.0.0-alpha.22":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.22","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.22","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"f59f87fe8fd67fdf135634f6f7be822cbd56b3c8","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.22.tgz","fileCount":7,"integrity":"sha512-RgK2Nab8eX1ih+PrBi4MMkDlENBAHGkGwlmMywHNKhGOhaeX4Rc6bSRyG8R7HPUoRuhHq3dJ14zz2o50yP2USw==","signatures":[{"sig":"MEYCIQDWNbTHWPGip7eDnvD0gcSXWQYH13r01b7fYlnKNHpT8wIhAKavWbU2Hd4M5pLPFm0oXJLi7+n4ebnkqSWn5Ik0yJa1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"289b7f60d1cd721d68cff783afc623c3f51cc2cf","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.22_1633984756598_0.13146592717687366","host":"s3://npm-registry-packages"}},"4.0.0-alpha.23":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.23","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.23","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1449ef6b03812de1a072c9850fa884952ec20059","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.23.tgz","fileCount":7,"integrity":"sha512-lZt/UsC8aOGjorUH9NGAuykuSZG36U+rSWgbbXyERjgWHkxfPE5HnG/G7EpPKqbNQaJACRIactz4T2815/JUeQ==","signatures":[{"sig":"MEQCIBzklGVYeAhlvhhPgihjoEvZ5y4rycmJMhdZ1QdGDB98AiAa19V1Si2rps063HjDe3OQ3GsnhfnNcOeYfV+i2gkUVA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"a2829d023883e5cc51126ee549f70629ceae8e8d","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.23_1633986433623_0.8772239398541639","host":"s3://npm-registry-packages"}},"4.0.0-alpha.24":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.24","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.24","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fe36c1e93416cea9e58081cabd423ec7c728235c","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.24.tgz","fileCount":7,"integrity":"sha512-L5biSwPLe3ayhVQliM7XOi/QZh5o858b9uVPx53lSNomZhq7pPcMA0IV8D0DlgsRfxcFUhItDT2M5dzR1k8dUw==","signatures":[{"sig":"MEQCIHEKLQwq+o4fOlp4R3cLNDkvaEy1/0VYwxUDAiHQMBJQAiAYFlKOuZ8ATp0wStSUHnnVvg+hERO6T4LibAFaUuP3vw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"a2829d023883e5cc51126ee549f70629ceae8e8d","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.24_1633988804066_0.7618698743477064","host":"s3://npm-registry-packages"}},"4.0.0-alpha.25":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.25","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.25","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"1316d86723bd70efe24b9ef1717e776453d096ec","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.25.tgz","fileCount":7,"integrity":"sha512-yXcoiIVL3c10RULn1ZUXHtGGdwHiocfWbR93nBiexuhJK2SWT7yRiShC+kMge/S9GMkbPhuSFWqnJzclwqTG7A==","signatures":[{"sig":"MEYCIQCWA3VxxMr+aBX4Jt8OE51PLI4aXmc8Wce5NmUBOgf7VwIhAI8yH0P2pkK09eW1J0GqZXT3oX3EQblpLKgefIx4wezA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"8e4d611be609be11acccb9135091aadd10134e8a","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.25_1634001637899_0.785982899172365","host":"s3://npm-registry-packages"}},"4.0.0-alpha.26":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.26","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.26","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"7cdf84eb5f4a43bc28a0be3cfd33b2e1bbd02492","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.26.tgz","fileCount":7,"integrity":"sha512-TPKYMUSWxPkHmvpdNiEyOdU+FnxrZIhb4InfzhdqX4m6L7O4ULeftylP23PGPUmA9y2bJ2NtiAYJ8tta3QPABg==","signatures":[{"sig":"MEYCIQCkANeHbi6eGaS3exFIHmwnrcWrPCgLp6lQS/JVh0/YZwIhAPxwuaK0HBBVdly834wefdvftXrPDayYiJlLUwsDf/Fl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"bdd06521b3653befa1b4c07318cc120a700672b2","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.26_1634002460211_0.8427900244115378","host":"s3://npm-registry-packages"}},"4.0.0-alpha.27":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.27","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.27","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"4e265a98e95e7db481d05bd92cd4ca7578118707","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.27.tgz","fileCount":7,"integrity":"sha512-FG2Vms2OPE4akhiGWyFnR2byJBwoDjEGOQC44aC9eaFCwp0Ay2+Cn0fDSXQ8T36HGGsNHZDd+9GfIsvAN37Mkg==","signatures":[{"sig":"MEUCIGN5qfH05KY3a9l/Pe3rS1AFKjwc3lrDsIW1liY4bg37AiEAkLKo2bO1COKiTap01fy2B+UG9zPjf+4w9XhPi9UH4wM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"bc755f21b39459dc3a8b57ab25075a22313bc107","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.27_1634151980273_0.6031880484654664","host":"s3://npm-registry-packages"}},"4.0.0-alpha.28":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.28","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.28","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"82c9a640d1db4245f25997f3025d9a04d7a45788","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.28.tgz","fileCount":7,"integrity":"sha512-Of1XErLX3S9bpfw+lPsLfUjzmK6eItWusgDYVZhsYVF15sGZPGCUnAiYx6dRy4UktaE7j5vesAqm5CwwWXgg3w==","signatures":[{"sig":"MEUCIFsXqC9kGPHKIjeVJpjsAJS4S+llXJDsZVQpw/Y3hn/nAiEA7erIGqmXTwvmhdvE8wS6Yel9Adb5LImG2ocaXeuQ8NM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"7dceb248f691c3214f73ba1d048f26b2653bcac1","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.28_1634163492504_0.27657653304852725","host":"s3://npm-registry-packages"}},"4.0.0-alpha.29":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.29","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.29","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"45af242ac97a7c28aa6fc2ae6b638a8ec230efa4","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.29.tgz","fileCount":7,"integrity":"sha512-FWaLTgUsH+bHnI7ShPoJd9OGu1sSQyWw6bVUnRICUQ2KEBUDc/ScTx17T4TONAzhrQUP//UGcBkezEHsV1vVfQ==","signatures":[{"sig":"MEUCIQCLP0/bsGzNi31mjHJuxMtjbiZ5uwXUz8ncAtehPJLPHwIgM2zggmZlDnmDjeyNEog1fMp49ZXUecUY46UaFHtv23s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.29_1634319346203_0.633415900756094","host":"s3://npm-registry-packages"}},"4.0.0-alpha.30":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.30","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.30","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"ad9b01cc4a94471f9c0749be3bd527d39c9571a2","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.30.tgz","fileCount":7,"integrity":"sha512-ij4T65qqivJ1h41AqvhOrInYseX/6FCEptfGJi+fabWrb2HFTse2BmIARpq5FtSPdoh0KoeTkQBeZd9DpQU18A==","signatures":[{"sig":"MEUCIDZeR9ocSahHzb14JDPsdIxUh4ozE3kR8pGyyosXh7bBAiEAqjAjusAgHFQtaeWfK4bEI2PIwnvtCfQvvNb/s3DxRlo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"13ed83fe4429533b22fd669328dd6c8829dffec0","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.30_1634323852636_0.25916539451105014","host":"s3://npm-registry-packages"}},"4.0.0-alpha.31":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.31","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.31","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"c1cc857fe3f24399a3d7cbbaa818a3740eeb678e","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.31.tgz","fileCount":7,"integrity":"sha512-DeX1XhzrJ2iqkspzISpD06PBSqHr6cxWHhAuw+ymGWaY2mMvv3Y5F/XzXUkbn6qIFLCJ1xkdzyOSid9PmddSYw==","signatures":[{"sig":"MEUCIQDaIO7HNDwMeM3e54zxUT1VP91Wr0XT0rq68SqoNp0pBQIgG34FjejZSDumHiRu0AfsOfuJazgHUZZHSwYsV9hoQJI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"5bc1713dfbc60e5029713b6ad88a4a9fd46d3413","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.31_1634324114604_0.7872242081577054","host":"s3://npm-registry-packages"}},"4.0.0-alpha.32":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.32","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.32","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"892796c6b7d2c40353d71b4cf3de6564e9bb102b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.32.tgz","fileCount":7,"integrity":"sha512-+2koCvoh+22YjsQxQB1O2FCuFRjPfIuyHv5i3SSeuNlK/nD5bOJzpFVcGc5knX3TljxanEaOZxN3NZoiTz3GvQ==","signatures":[{"sig":"MEQCIDXuovmfi7AaChi2TfEkZ63etvP8R/naw3WoyeTT8zT4AiBilaxJIWjWXhY0qjkVht0VOQljZ6IcGqB+Pj4hGowPaA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"77786a7e5219aff408e59d051e8380ca1a63021d","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.32_1634326777222_0.7543841922956245","host":"s3://npm-registry-packages"}},"4.0.0-alpha.33":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.33","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.33","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2c9835ddb3eec81070093429b755d9da527a329b","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.33.tgz","fileCount":7,"integrity":"sha512-+guzsuR8xCNk9S3X9wwuEdh48pEiXTHMmPRD8/YfP5Nq9WabLNSECWy96N8PO/wjZgqsmiqDUPX0BsJRC395/w==","signatures":[{"sig":"MEUCIH8RSTW4LHHc5i3d3yDh7dr/aB6cuqahqv6yxVpc1iJZAiEA4/zCHTV9B22XLAEdsOXBhY+w9KZe4SQ0pOhoO1mNa68=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"41b432602965620ce989f21e02748f53f69f7ea5","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.33_1634326977749_0.3023256395210263","host":"s3://npm-registry-packages"}},"4.0.0-alpha.34":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.34","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.34","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"22fb40d4c5d72ef26b3514c25047fa74304e3217","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.34.tgz","fileCount":7,"integrity":"sha512-EmDSbY5KLw6oT/t8GsC30ewDYyh2uVBu1qdTQ0tKBOXx1pZsVYc8xUxtJfo90ZDRhF4BzWJWQj6IpXvcRPp3Sw==","signatures":[{"sig":"MEQCIHR66hYtcSGUwvP95SWNzIGw2hFv8GmGOhnm9ngQbKwPAiA5H/KzY/LnIEHADbhC2IgbeqpvjZkS5DGrHUjfF8V86w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"1b993e65b04444692f40eaecfc3dfbb29d50d98b","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.34_1634327583316_0.596928918044968","host":"s3://npm-registry-packages"}},"4.0.0-alpha.35":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.35","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.35","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"5ee5cc046d4a7d11e777e009aef027b8d38ae6c3","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.35.tgz","fileCount":7,"integrity":"sha512-3O0z+0iIg/wStSEvuAwUPN+TNMoBb0ZlLJRqOPWUQAEDk1mM59nN0LTwOGDAXkyP6EN80HvowZX4HskVXY5Y9A==","signatures":[{"sig":"MEYCIQC6+XlkYANjPmuvqZ6VU562n7X6ISHFm3oPX7mR82TSHgIhAKN8gcjeKGnvyqaW7HA+TnyigU50NzhyxUsJpEA3NgZS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"5a6a7f303fc21acc73b55413f38f534ed4bfb714","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.35_1634328005181_0.3878255144527496","host":"s3://npm-registry-packages"}},"4.0.0-alpha.36":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.36","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.36","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"6709d4bc942b22e3662382a4227b6172be9a58f3","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.36.tgz","fileCount":7,"integrity":"sha512-VMFUTVCrVhy5OVB/GYwtsZO4uz7xfgp0Y0MXyqwv/SIpgwue1MxjWlKW1b2eyHjFpaetmV0j4zFkzcivZEysrg==","signatures":[{"sig":"MEQCIGSVqnUegN9jOwGttk96CNx89Uf7ksU5Psynz8qg1/dtAiA6ejnvyHMpaq1BzQyWwlN5h+LwG1K0+Vi+VZMI/cusHw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"24aeaf86244b6f9f352b26d04fd9976f9430bfe7","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.36_1634328204961_0.16032160834038178","host":"s3://npm-registry-packages"}},"4.0.0-alpha.37":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.37","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.37","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"f8e53459e567ceb6a955e8297433aafd7bb12424","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.37.tgz","fileCount":7,"integrity":"sha512-14zfx1jLibcmMAjhv/S6KBoxghg2V18WsNsFwLXkqo7l4h+YZw/gVAuZsYqwiALoYRkpWbq8Kq1YiDw4SilC0Q==","signatures":[{"sig":"MEUCIFz2JYeIoCGDKS/vTP7sUjDCd61i7Np4pE+knxMpEe2TAiEAxEDcVkqqi0E3NO4pE5V3zyoLAAZ11D1+LaL8m4nbRSE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"d5e9c5a7ef77e315b759fb5bee226aa3bd3aaffb","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.37_1634328379144_0.8584058943514248","host":"s3://npm-registry-packages"}},"4.0.0-alpha.38":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.38","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.38","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9732ccd2f61cd039f56e805af5811089f3fa9946","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.38.tgz","fileCount":7,"integrity":"sha512-FhwTPFx80c2F5fWErKWofD/BzNF6Nm4u6mHH6xZZXCLKDb5iXgkqdrvkKuz/dfwrOOk5UMn7BaJYKRYUBpAT9g==","signatures":[{"sig":"MEUCIQCkXMuQ3Kxn6Wu9Y/Y/6h7XFsDPt+PDmU/QrCwRVaoIJQIgPqPBm3WQldhQpZWd71ao9Xqw11z6U0OpnUkKknMgpWY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"91457836070b2b300b852a461787c56ec880a85d","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.38_1634330758374_0.3773743746538749","host":"s3://npm-registry-packages"}},"4.0.0-alpha.39":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.39","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.39","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"211fdd550959cef140d18aaad64c001f98944ddb","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.39.tgz","fileCount":7,"integrity":"sha512-jx4hqqEBCSCUK7/yyfUhd3Ktir4uojMxrCQlfzHcqR6BgizC1DFA8S1OxGiD0xslKAyZqVix5TrKo+aXRwobnA==","signatures":[{"sig":"MEQCIHmF3BZECHk9d6OMzi3lJrrTsiGMaeSHrzJ2GsQslT1iAiB2Opq/+JZfcXf7vb0n/nMX8Cvisqa4fREAxO+j/kMfcg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"f4c22e986eb7eb2e564e469dedb36c65858bf5cc","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.39_1634332196046_0.9429961348715092","host":"s3://npm-registry-packages"}},"4.0.0-alpha.40":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.40","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.40","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2d7f4c0266b240c04b274f0fb2880aee15dde173","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.40.tgz","fileCount":7,"integrity":"sha512-FKd+RetJrf3JsMsMGD6B1xEGxUA7vk9x2mj5wBVu8roGcmD6QU7pN7k7RvgFYPgRRg+pSU3G6tiMukxWrkM8kw==","signatures":[{"sig":"MEUCIEx9I1zjDq298mAMgQHLYRLB+1380NMnlmtCrA5klylDAiEA/Z3kbQ4fMcMk8wtTOo8zIoP0AJhG+Fz+H67JuJk+/c0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"e93b1f585c2cd94383438abd74737a856ca68a77","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.40_1634332790510_0.36901176659166457","host":"s3://npm-registry-packages"}},"4.0.0-alpha.41":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.41","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.41","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"2548c9c04c2594204bfc6591b50ceb01e1ca32fe","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.41.tgz","fileCount":7,"integrity":"sha512-HegMAWyqeZP+SlPAO5pbYBjAHyBeFgtUmvSONsCzxnQrWR0P9vHQXabLKjFQ64Tyvsansarplgf3Uwv8FP6dzQ==","signatures":[{"sig":"MEUCIGSrGN4sX1R0q6rpih6xFe6ADZjp0qMaIfnB90b3glUNAiEA/lsYBogMOwtsWIPgdi22BzWQP62QgxhdbYF4lAcOue4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"cbd55bfa3cf5e87bf7b5f27b3d9b6efb34e3ad85","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.41_1634582055304_0.15077584083734585","host":"s3://npm-registry-packages"}},"4.0.0-alpha.42":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.42","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.42","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d6967ab6ae727789437da39624e3ff005f65eda3","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.42.tgz","fileCount":7,"integrity":"sha512-45AhPP40fTo5dRA4zPoFqwkVhjDc7I0sPUCbfCVVoliA9S6/7HG6jYMW7JWIuKAZUS6o8cSrTLmUlLkgQEgpQQ==","signatures":[{"sig":"MEQCIFCEiZsRCXxbMC78rA7P6gW4fjkq3o8O7kMFZtGZsL47AiA5W464rZ/4csejb/zhchj1EiDNEo1Om/OijWEZHBCc6w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"f64d10ec558694ce4c2d4e8b0562d4167f8e28d5","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.42_1634586022311_0.7624663592084748","host":"s3://npm-registry-packages"}},"4.0.0-alpha.43":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.43","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.43","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"fbe1821feeb63f8dbb4498acb78895e1a6f94710","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.43.tgz","fileCount":7,"integrity":"sha512-f0ysyY/rR7diiPr5k4l2qb4uh2SoIZF41SCLKmCQhqS4qDqReF+Njzj0D5zLzBYFuOeAPhD51oI5z+37usR9YQ==","signatures":[{"sig":"MEQCIHVBJC8yfb0vZzQpWrRKkPwFWF4O/BLs3lxN4YwlL6mKAiAa7A9L1OSdoic5zVmtKXMgON9n2nrK7TZn5DZ/CGdsdA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","gitHead":"6763365b38cb5be764e669a3b568be9f1cc4cfed","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"7.24.2","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.43_1634586278227_0.5003882533913699","host":"s3://npm-registry-packages"}},"4.0.0-alpha.44":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.44","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.44","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"d4885a18ad3d8d076e6fe5f5f172c17428d249d3","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.44.tgz","fileCount":7,"integrity":"sha512-U/bKU0xTFN80/Y2kschH3UJdfD4+MWm7S8p0zQ7n+zjhd75ATl9UJeNZiBctkGwWaOASABuvO+D4+OzSr1sCTQ==","signatures":[{"sig":"MEQCIGucB8MhmDkweAKNB2vV+ZA9KyYO+AGJ0OhQEmeMKiqUAiAs8fcOKCeL1y5aK7u/k4NRE0tAYA6nSRAM7eA6F5Vkag==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.44_1635874764321_0.9420227910933963","host":"s3://npm-registry-packages"}},"4.0.0-alpha.45":{"name":"@aofl/resource-enumerate","version":"4.0.0-alpha.45","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@4.0.0-alpha.45","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"974c5939e0dee397d1db4bc50732b2dbd0758f34","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-4.0.0-alpha.45.tgz","fileCount":7,"integrity":"sha512-RebQAmlezBJ2Z6Yl5HseWjbGDfIRomWrjSmCosGJxy0YdrRnil00xpZ9jnCxN5ivPBovgYUNibCh7RJIZJXEDQ==","signatures":[{"sig":"MEUCIGjdtfpq0hUl7JPne+Yf7hqAqUHcFPpJc6j1EY5w2TwIAiEA6femCMRXIVtv+Loi3FavRJFb71QE5GTT/fzwvomyHCs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26581},"main":"index.js","module":"index.js","readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","browser":"dist/index.js","typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"6.14.11","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jsdoc":"^3.6.6","cross-env":"^7.0.3","tsd-jsdoc":"^2.5.0"},"peerDependencies":{"@aofl/middleware":"^4.0.0-alpha.9","@aofl/api-request":"^4.0.0-alpha.9","@aofl/cache-manager":"^4.0.0-alpha.9","@aofl/server-environment":"^4.0.0-alpha.9"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_4.0.0-alpha.45_1635876943517_0.7888283214814138","host":"s3://npm-registry-packages"}},"3.14.0":{"name":"@aofl/resource-enumerate","version":"3.14.0","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.14.0","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"9f5d9588ed6b1bf479b7eb682ee6623cada7ffc8","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.14.0.tgz","fileCount":8,"integrity":"sha512-Tb6CGEHPyW3pSIsV1ASv3NQevtGDedF+U1Fc+zn4FDjNPZC149eLkBNA0m/+U8cDDsOe5WLQYrEjh2SKnGV21g==","signatures":[{"sig":"MEUCIQDxX0hQgf5fePf0v0mgf5VfloRFOQJBvfQn54RQhMt+iQIgEYsxQpssZk50P/KgSdOQAYLZGls8AG5jKLxFNZn2lt4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM8/fACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdEA/+PTY6+16cgvjFI5pGbQUrapDlHNcii3gjkjft+9SmQi1t5u5f\r\nVtVOi7IKUaYyfFgyU/8OV2HQCHSl37kbX7N9L3TyDmYSfosI0rc3JDF3W7vg\r\nPLOSRalW4rruUPYzDFdHs2887E1iqC4orbxflpqFfjeK8h0cTht+v6pc4w1e\r\nUOI0pcH4FsZDyhd15Db+W/n8Pm4tF99LM15oGP+ZaBdDSTrgmWcaC7l1cCgj\r\na56sS9y/uiJqPmigqj6COQoAerB80a013d7/aw67MDgXPkj1iAX2cAuWG7KE\r\ntRt1P3W4EpyJigIUTIjaD22TKjpYlYEL4dtCNke6RNUs67rP9/slvNcU2W8c\r\nARqRJ+C/oZbK69MSYNaaKZLPLRlpbxZEg/a+5TRKfugzGjBI1pjz4pnUio4W\r\nW4w60t1QvqqaALB9WvTqwZQCFSIqMVetgyT45qyuAHDASXoSIzzG73wWeEqH\r\nbfjOsi6OVitb+u/Zu2kXyqiTQnRRNDw/w5PpXDsPVhJwcMEl4neF4Pkx/wrA\r\nyYMAgAxwveqcqDZe2AlDFzvg9u8FKtAx60TD+azEXc5ZEVWW64tSztbLv0lQ\r\njOBFotuI0nphiWe0H+t+J4YJ6dhdQB5zOANwN5zhe7uhwCmxE2tx+lux2QLI\r\nfo+LUOCEfEq1/+KDLEPY+XnEFIbFxIf9WiM=\r\n=mbu+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"01a200342c31c108d1ab1039ee4c972f2ee63fa9","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.20.1+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.14.0","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.14.0","@aofl/api-request":"^3.14.0","@aofl/cache-manager":"^3.14.0","@aofl/server-environment":"^3.14.0"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.14.0_1647562718903_0.9872756715005273","host":"s3://npm-registry-packages"}},"3.14.1":{"name":"@aofl/resource-enumerate","version":"3.14.1","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","_id":"@aofl/resource-enumerate@3.14.1","maintainers":[{"name":"alexdinari","email":"alexdinari@me.com"},{"name":"ariankhosravi","email":"arian@arin.io"}],"contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"homepage":"https://github.com/AgeOfLearning/aofl#readme","bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"dist":{"shasum":"aa5302ef23a9b9b1e5adcefafe9ebaeaa3eafb69","tarball":"https://registry.npmjs.org/@aofl/resource-enumerate/-/resource-enumerate-3.14.1.tgz","fileCount":8,"integrity":"sha512-TWIW1R0VF0fqLZjUMoR+otzmjXoT8EPykLfn8xwaQEr5BcK6RrQ1ZTtEwlumMi3WQ/MOaD/rFpbHDBn82qK7lQ==","signatures":[{"sig":"MEYCIQDrzF9E2a637GKM2SoAK9hH4YgxEoq2uFwLBdQeDvhRuAIhAIsup4lll0BehsNYjjPjdHBpK+saQAXu67ABqHvg6Dnh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31040,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiM9bTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr14g//d9wNW1jwdvq2vJ8djKGucis9k5aKDQmEOfuTR8TUN4fva11m\r\nKos4Utqi9HV/J0xTNrw2CTZTeg+3sCWSZQ2Rz96bXVw1B0bNgGTPc4n6B1Qe\r\nro6XlSFrSPq+07R7DF6X7k1TpTwCP2wCy2FreeUA2H6EuOTcQPEteZtr6Vek\r\nwYYMaI3rsahUU8ztpqlTjc6dSxtmYM5ymPY7TZKJDYuJALdXWTrrL/KRV23v\r\ndJ+ikyFuopRLnCTmy1fZWYdlmXyT+8kBvgNfXjn24QdIUPEQvy8k1gq19wUm\r\nGgzZnCvoQVV5V+F9IDWISRnsIvriZoCYGajapSnN6kmjDtHAhlJFIPQNLuxw\r\n6aQ/CVVUuZ3KdfpM2T6NAszRu82cN2R+YP30ziIx6URHH4KO7zpkSTXkuLyv\r\nvw6mFVMXm2SlEtkIS8mgt3u/MAeMG7hBlUtHTHqQm0xkSFjLPjXAytD5TGdR\r\nalS8bmT5GZMl8bIO4dtqQi6JYkR8uQFXZgrKWKqw4+CfxwvPb462Z0RaiWnH\r\nDv7bEVo9bTEYW5HXmqjhWa178/BYaV+LmQkiCZMuC2TR358tnDxws/VsgwAb\r\nnppT4xb/9yOt2Pf/k19iwG4tFEJi3k3tDrKgIPPO41U0dYq7PDC2Tb42jHgd\r\nD/AZiHjOB8qiSODK9FIAkBkHksNULq1lSrk=\r\n=sDqS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","module":"index.js","browser":"dist/index.js","gitHead":"65857163479f835ec51cc1e23ec01c45eab43008","scripts":{"docs":"npx jsdoc -c .jsdocrc.json .","test":"echo \"Error: no test specified\" && exit 1","build":"cross-env NODE_ENV=production npx aofl build","build-ci":"cross-env NODE_ENV=production aofl build --debug","build:dev":"cross-env NODE_ENV=development npx aofl build","prepublishOnly":"npm run build-ci && npm run docs"},"typings":"types.d.ts","_npmUser":{"name":"ariankhosravi","email":"arian@arin.io"},"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.20.1+x64 (darwin)","description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","directories":{},"_nodeVersion":"12.20.1","_hasShrinkwrap":false,"devDependencies":{"jsdoc":"^3.6.3","@aofl/cli":"^3.14.1","cross-env":"^6.0.3","tsd-jsdoc":"^2.4.0","@aofl/middleware":"^3.14.1","@aofl/api-request":"^3.14.1","@aofl/cache-manager":"^3.14.1","@aofl/server-environment":"^3.14.1"},"peerDependencies":{"@aofl/middleware":">=3.0.0-beta.5 < 4.0.0","@aofl/api-request":">=3.0.0-beta.5 < 4.0.0","@aofl/cache-manager":">=3.0.0-beta.1 < 4.0.0","@aofl/server-environment":">=3.0.0-beta.5 < 4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-enumerate_3.14.1_1647564499603_0.7175617737191173","host":"s3://npm-registry-packages"}}},"time":{"created":"2018-01-26T00:52:45.403Z","modified":"2025-01-18T00:20:50.863Z","1.0.0":"2018-01-26T00:52:45.403Z","1.0.0-beta.1":"2018-02-01T01:10:53.281Z","1.0.0-beta.2":"2018-02-16T00:11:47.014Z","1.0.0-beta.3":"2018-03-10T01:18:39.871Z","1.0.0-beta.4":"2018-03-18T20:39:05.485Z","1.0.0-beta.5":"2018-03-29T01:31:17.293Z","1.0.0-beta.6":"2018-04-06T23:35:18.794Z","1.0.0-beta.7":"2018-04-11T17:20:22.038Z","1.0.0-beta.8":"2018-04-14T02:53:58.155Z","1.0.0-beta.9":"2018-04-14T02:56:08.747Z","1.0.0-beta.10":"2018-04-14T02:59:33.783Z","1.0.0-beta.11":"2018-04-27T01:14:05.256Z","1.0.0-beta.20":"2018-07-25T00:14:55.547Z","1.0.0-beta.21":"2018-08-05T07:44:04.329Z","1.0.0-beta.22":"2018-08-10T19:27:45.777Z","1.0.0-beta.23":"2018-08-16T21:43:11.886Z","1.0.0-beta.24":"2018-08-22T22:34:16.843Z","1.0.0-beta.25":"2018-08-23T19:30:24.196Z","1.0.0-beta.26":"2018-08-27T18:28:02.098Z","1.0.0-beta.27":"2018-09-11T18:09:09.579Z","1.0.0-beta.28":"2018-09-28T00:36:13.934Z","1.0.0-beta.29-dev.1":"2018-09-28T17:34:46.024Z","1.0.1":"2018-09-29T23:11:58.846Z","1.1.0":"2018-10-17T22:34:06.579Z","1.1.1":"2018-10-29T19:41:51.175Z","1.1.2":"2018-10-29T19:41:59.969Z","1.2.0":"2018-11-06T20:50:04.944Z","1.2.1":"2018-11-18T21:11:14.671Z","1.2.3":"2018-11-21T00:18:04.709Z","1.3.0":"2018-12-06T21:01:12.310Z","1.4.0":"2018-12-28T02:41:48.923Z","1.4.1":"2019-01-07T18:33:35.470Z","1.5.0-alpha.2":"2019-01-17T22:54:50.215Z","2.0.0-alpha.1":"2019-01-29T01:54:09.378Z","2.0.0-alpha.5":"2019-02-26T23:15:39.614Z","2.0.0-alpha.16":"2019-04-25T19:58:00.596Z","2.0.0-alpha.17":"2019-04-26T18:36:12.119Z","2.0.0":"2019-04-30T19:32:05.291Z","2.1.0-alpha.4":"2019-07-23T23:10:27.457Z","2.1.0-alpha.9":"2019-08-18T06:17:39.959Z","3.0.0-0":"2019-09-17T05:22:15.256Z","3.0.0-alpha.0":"2019-09-17T05:24:12.833Z","3.0.0-alpha.5":"2019-09-20T06:32:51.642Z","3.0.0-alpha.9":"2019-09-26T20:58:37.085Z","3.0.0-alpha.11":"2019-09-27T06:49:39.560Z","3.0.0-beta.5":"2019-10-06T10:05:19.685Z","3.0.0-beta.6":"2019-10-08T04:49:45.151Z","3.0.0-beta.8":"2019-10-08T05:48:18.379Z","3.0.0-beta.9":"2019-10-08T06:11:45.975Z","3.0.0-beta.11":"2019-10-08T09:42:57.481Z","3.0.0-beta.12":"2019-10-08T09:53:47.600Z","3.0.0-beta.13":"2019-10-09T04:13:28.893Z","3.0.0-beta.14":"2019-10-09T04:33:09.678Z","3.0.0-beta.15":"2019-10-09T04:50:51.191Z","3.0.0-beta.16":"2019-10-09T05:06:05.992Z","3.0.0-beta.17":"2019-10-09T05:25:10.957Z","3.0.0-beta.22":"2019-10-11T04:40:54.638Z","3.0.0-beta.23":"2019-10-11T05:40:03.246Z","3.0.0-beta.24":"2019-10-11T06:34:50.817Z","3.0.0-beta.25":"2019-10-11T07:34:52.755Z","3.0.0-beta.26":"2019-10-11T07:49:14.519Z","3.0.0-beta.27":"2019-10-11T07:54:06.458Z","3.0.0-beta.28":"2019-10-11T08:01:09.913Z","3.0.0-beta.30":"2019-10-11T22:58:50.329Z","3.0.0-beta.32":"2019-10-14T01:08:45.090Z","3.0.0-beta.35":"2019-10-18T06:59:19.152Z","3.0.0-beta.36":"2019-10-19T10:45:58.334Z","3.0.0-beta.37":"2019-10-24T06:08:02.868Z","3.0.0-beta.38":"2019-10-30T22:52:31.554Z","3.0.0-beta.40":"2019-11-11T22:31:23.439Z","3.0.0-beta.41":"2019-11-12T04:55:43.148Z","3.0.0-beta.42":"2019-11-12T05:53:52.730Z","3.0.0-beta.46":"2019-11-14T21:58:23.746Z","3.0.0-beta.47":"2019-11-15T00:48:51.633Z","3.0.0-beta.48":"2019-11-16T23:36:09.472Z","3.0.0-beta.49":"2019-11-17T03:38:01.904Z","3.0.0":"2019-11-17T07:06:15.479Z","3.1.0":"2019-11-22T03:28:25.509Z","3.2.0":"2019-11-24T07:34:58.646Z","3.2.1":"2019-11-24T08:03:55.641Z","3.2.2-alpha.2":"2020-01-14T20:27:49.960Z","3.2.2-alpha.3":"2020-01-14T21:13:07.886Z","3.3.0":"2020-01-22T23:31:34.278Z","3.5.0-beta.1":"2020-02-22T23:26:49.816Z","3.5.0-beta.2":"2020-02-22T23:52:49.572Z","3.5.0-beta.3":"2020-02-23T00:07:34.755Z","3.5.0-beta.4":"2020-02-23T01:57:37.748Z","3.5.0-beta.5":"2020-02-23T03:10:16.896Z","3.5.0-beta.6":"2020-02-23T03:17:57.995Z","3.5.0-beta.7":"2020-02-23T05:05:46.372Z","3.5.0-beta.8":"2020-02-23T05:08:50.042Z","3.5.0-beta.9":"2020-02-23T05:33:15.807Z","3.5.0-beta.10":"2020-02-23T05:50:39.405Z","3.5.0-beta.11":"2020-02-23T07:37:27.167Z","3.5.0-beta.12":"2020-02-23T09:00:25.266Z","3.5.0-beta.13":"2020-02-23T09:02:22.013Z","3.5.0-beta.14":"2020-02-23T10:00:20.395Z","3.5.0-beta.15":"2020-02-23T11:49:27.487Z","3.5.0-beta.16":"2020-02-23T11:58:52.435Z","3.5.0-beta.17":"2020-02-23T12:14:37.349Z","3.5.0-beta.18":"2020-02-25T03:59:49.298Z","3.5.0-beta.19":"2020-02-25T23:57:18.214Z","3.5.0-beta.20":"2020-03-02T23:22:53.008Z","3.5.0-beta.21":"2020-03-02T23:27:15.381Z","3.5.0-beta.22":"2020-03-02T23:42:25.481Z","3.5.0":"2020-03-03T00:03:12.740Z","3.6.0-alpha.0":"2020-03-08T18:25:05.548Z","3.6.0-alpha.1":"2020-03-08T18:35:18.633Z","3.6.0":"2020-03-08T19:05:49.922Z","3.6.1":"2020-03-10T18:43:05.663Z","3.8.0":"2020-05-12T19:19:46.270Z","3.9.0-alpha.0":"2020-05-12T19:30:12.637Z","3.8.1":"2020-05-12T19:41:02.099Z","3.9.0":"2020-05-15T17:58:24.011Z","3.10.0":"2020-05-15T21:15:35.502Z","3.12.0":"2021-01-20T00:01:58.092Z","3.12.1":"2021-01-20T00:12:55.811Z","4.0.0-alpha.9":"2021-02-03T01:48:12.961Z","4.0.0-alpha.10":"2021-02-03T01:56:21.098Z","4.0.0-alpha.11":"2021-02-03T02:24:24.830Z","3.13.0":"2021-02-25T23:43:42.656Z","3.13.1":"2021-06-15T23:48:55.195Z","4.0.0-alpha.13":"2021-09-23T23:32:17.050Z","4.0.0-alpha.15":"2021-10-06T17:03:55.099Z","4.0.0-alpha.16":"2021-10-06T17:05:10.893Z","4.0.0-alpha.17":"2021-10-06T18:47:33.951Z","4.0.0-alpha.18":"2021-10-06T23:40:35.646Z","4.0.0-alpha.19":"2021-10-06T23:47:31.312Z","4.0.0-alpha.20":"2021-10-06T23:54:58.540Z","4.0.0-alpha.21":"2021-10-08T17:06:02.587Z","4.0.0-alpha.22":"2021-10-11T20:39:16.784Z","4.0.0-alpha.23":"2021-10-11T21:07:13.777Z","4.0.0-alpha.24":"2021-10-11T21:46:44.231Z","4.0.0-alpha.25":"2021-10-12T01:20:38.032Z","4.0.0-alpha.26":"2021-10-12T01:34:20.356Z","4.0.0-alpha.27":"2021-10-13T19:06:20.422Z","4.0.0-alpha.28":"2021-10-13T22:18:12.711Z","4.0.0-alpha.29":"2021-10-15T17:35:46.352Z","4.0.0-alpha.30":"2021-10-15T18:50:52.778Z","4.0.0-alpha.31":"2021-10-15T18:55:14.733Z","4.0.0-alpha.32":"2021-10-15T19:39:37.427Z","4.0.0-alpha.33":"2021-10-15T19:42:57.916Z","4.0.0-alpha.34":"2021-10-15T19:53:03.482Z","4.0.0-alpha.35":"2021-10-15T20:00:05.338Z","4.0.0-alpha.36":"2021-10-15T20:03:25.135Z","4.0.0-alpha.37":"2021-10-15T20:06:19.296Z","4.0.0-alpha.38":"2021-10-15T20:45:58.509Z","4.0.0-alpha.39":"2021-10-15T21:09:56.142Z","4.0.0-alpha.40":"2021-10-15T21:19:50.635Z","4.0.0-alpha.41":"2021-10-18T18:34:15.458Z","4.0.0-alpha.42":"2021-10-18T19:40:22.473Z","4.0.0-alpha.43":"2021-10-18T19:44:38.382Z","4.0.0-alpha.44":"2021-11-02T17:39:24.458Z","4.0.0-alpha.45":"2021-11-02T18:15:43.667Z","3.14.0":"2022-03-18T00:18:39.066Z","3.14.1":"2022-03-18T00:48:19.763Z"},"bugs":{"url":"https://github.com/AgeOfLearning/aofl/issues"},"author":{"name":"Arian Khosravi","email":"arian.khosravi@aofl.com"},"license":"MIT","homepage":"https://github.com/AgeOfLearning/aofl#readme","keywords":["aofljs","@aofl/resource-enumerate","resource enumerate","api"],"repository":{"url":"git+ssh://git@github.com/AgeOfLearning/aofl.git","type":"git"},"description":"Resource enumerate is a special case API call that returns the interface of the API code in a single endpoint","contributors":[{"name":"Daniel Belisle","email":"daniel.belisle@aofl.com"},{"name":"Micah Blu","email":"micah.blu@aofl.com"}],"maintainers":[{"email":"alexdinari@me.com","name":"alexdinari"},{"email":"lorenzo.battigelli@aofl.com","name":"lorenzo.battigelli"},{"email":"alex.dinari@aofl.com","name":"alex.dinari"},{"email":"it@aofl.com","name":"ageoflearning"},{"email":"jie.zhang@aofl.com","name":"jiezhangaofl"}],"readme":"# @aofl/resource-enumerate\n\nResource enumerate is a special case API call that returns the interface of the API code in a single endpoint. The response can contain server time, paths to resources, and other information based on application needs. An advantage of this technique is that it eliminates the need to hardcode paths/urls.\n\n`@aofl/resource-enumerate` accepts a config object that defines the path to the production api server.\n\nIt also supports `before()` and `after()` hooks. See example below.\n\n[Api Documentation](https://ageoflearning.github.io/aofl/v3.x/api-docs/module-@aofl_resource-enumerate.html)\n\n## Installation\n```bash\nnpm i -S @aofl/resource-enumerate\n```\n\n## Usage\n```javascript\nconst resourceEnumerateConfig = {\n  apis: {\n    'awesome-apis': { // api namespace\n      url: '/apis/v1.0/resource-enumerate.json', // production url\n      requestOptions: { // options passed into fetch\n        method: 'GET',\n        cache: 'no-cache'\n      },\n      developmentVariables() { // return an object that is passed into the develpomentConfig function\n        return {\n          host: location.host\n        };\n      },\n      stageVariables() { // return an object that is passed into the stageConfig function\n        return {\n          host: location.host\n        };\n      },\n      invalidateCache() { // This function is invoked before each get() call and it controls whether or not a cached version is returned\n        return false;\n      }\n    }\n  },\n  developmentConfig: () => import('./dev-api-config'), // lazy-load dev config\n  stageConfig: () => import('./stage-api-config') // lazy-load stage config\n};\n\nexport default resourceEnumerateConfig;\n```\n\n`[development|stage]Config()` export a function that takes api namespace and the returned object from `[development|stage]Variables()` and returns the path to the environment specific resource enumerate api call.\n\n```javascript\n// dev-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/dev/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\n// stage-api-config.js\nexport default (apiNs, {host}) => {\n  return `//${host}/apis/stage/v1.0/resource-enumerate.json`;\n};\n```\n\n```javascript\nimport {ResourceEnumerate} from '@aofl/resource-enumerate';\nimport resourceEnumerateConfig from './__config/resource-enumerate-config';\nimport apiRequestInstance from 'apiRequestInstanceFile :)'; // see @aofl/api-request\nimport {getServerEnvironment} from '@aofl/server-environment';\n\n\nconst developmentRegex = /localhost|192\\.168\\.[\\d|\\.]+|172\\.(1[6-9]|2[0-9]|3[01])\\.[\\d|\\.]+|10\\.([0-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.[\\d|\\.]+/; // localhost or all private ips\nconst stageRegex = /^stage\\./; // match url starting with \"stage.\"\n\nconst environment = getServerEnvironment(developmentRegex, stageRegex);\nconst resourceEnumerate = new ResourceEnumerate(environment);\nconst serverTime = {};\n\nresourceEnumerate.before((request, response, next) => {\n  serverTime[request.namespace] = {\n    before: Date.now() // record time right before api call\n  };\n  next(response);\n});\n\nresourceEnumerate.after((request, response, next) => {\n  serverTime[request.namespace].after = Date.now(); // record end time immediately after the response comes back\n  serverTime[request.namespace].delta = response.serverTime - Math.round(\n    (servertime[request.namespace].before + servertime[request.namespace].after) / 2); // aproximate difference between server and local client time\n\n  next(response);\n});\n\n// making api call\nresourceEnumerate.init(resourceEnumerateConfig)\n.then(() => {\n  resourceEnumerate.get('awesome-apis')\n  .then((resourceEnumeratePayload) => {\n    apiRequestInstance\n    .request(resourceEnumeratePayload.api_url + resourceEnumeratePayload.endpoints.getPosts)\n    .then((response) => {\n      // do something with response\n    });\n  });\n});\n```\n\n## Caching\nCalling `get()` will cache the api response by default. There are 2 ways to invalidate cache and fetch a new copy of the resource enumerate data.\n\n1. By calling `get()` and passing `false` as the second argument (`fromCache`).\n1. By implementing `invalidateCache()` in the config object. This function is invoked everytime `get()` is invoked and will return the cached data if it evaluates to `false`.\n\n```javascript\n...\n'awesome-apis': {\n  url: '/apis/v1.0/resource-enumerate.json'\n  invalidateCache() { // add invalidateCache function\n    return Math.random() > 0.8;\n  }\n}\n...\n```\n","readmeFilename":"README.md"}