mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
ce7dc2be92
Adds support for running npm package lifecycle scripts, opted into via a new `--allow-scripts` flag. With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run lifecycle scripts attached to the given packages. Note at the moment this only works when `nodeModulesDir` is true (using the local resolver). When a package with un-run lifecycle scripts is encountered, we emit a warning suggesting things may not work and to try running lifecycle scripts. Additionally, if a package script implicitly requires `node-gyp` and it's not found on the system, we emit a warning. Extra things in this PR: - Extracted out bits of `task.rs` into a separate module for reuse - Added a couple fields to `process.config` in order to support `node-gyp` (it relies on a few variables being there) - Drive by fix to downloading new npm packages to test registry --- TODO: - [x] validation for allow-scripts args (make sure it looks like an npm package) - [x] make allow-scripts matching smarter - [ ] figure out what issues this closes --- Review notes: - This adds a bunch of deps to our test registry due to using `node-gyp`, so it's pretty noisy
1 line
No EOL
30 KiB
JSON
1 line
No EOL
30 KiB
JSON
{"_id":"retry","_rev":"86-e0b404512644d6041de2ab2ae1108a79","name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","dist-tags":{"latest":"0.13.1"},"versions":{"0.0.1":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.0.1","homepage":"https://github.com/felixge/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{},"_id":"retry@0.0.1","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.8-pre","_defaultsLoaded":true,"dist":{"shasum":"d47a1e527644e131e8f54785452ec7cd410808fe","tarball":"http://localhost:4260/retry/retry-0.0.1.tgz","integrity":"sha512-b90A2rOTdhGMWnNmlUnimSOFVZtt5+rnRUqhL9Ce79E15/teiuWZPl81Qoxa7UOTyah6azAoXE8zZ6Z1zyZ/Xw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGoKP+QRE85MyoXvjh9f+dMRDXtEDtpWI/c3KnJjEl0ZAiEArMSYHFYBblxduyRZiKK+e4nw1coXagrBMgjBoDmH+As="}]},"scripts":{}},"0.1.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.1.0","homepage":"https://github.com/felixge/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"_id":"retry@0.1.0","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.8-pre","_defaultsLoaded":true,"dist":{"shasum":"e97a7b06a889a62b3f7ea16003f52a699c3651a5","tarball":"http://localhost:4260/retry/retry-0.1.0.tgz","integrity":"sha512-Q6rGTLzxPPcCnPIbk9/D2T9J7r+p1VP37lzyqZuueUfGwTSqs0zU4GArXAP2oVbuJ47hlvCmdQjTKiSv1uoCIQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQ19M1e1yNzWRSDAGtOtZ+NHX8BW3rqHHf6P1FiH27bAIhAORvEooeSK5m9Veiz1Ih8FVV5N1eB8U2z8xXgXWWDD2D"}]},"scripts":{}},"0.2.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.2.0","homepage":"https://github.com/felixge/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"_id":"retry@0.2.0","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.8-pre","_defaultsLoaded":true,"dist":{"shasum":"9598e6667c197772ea24ab5fc9e5445c0a4ac9a5","tarball":"http://localhost:4260/retry/retry-0.2.0.tgz","integrity":"sha512-5l0EEBFnDKOaUt/FXkp/enRH/i/HwjMTDYcLcduZidOzJfS3tQNPm0Kz23F9lHWL9XJbmdBrvacFGJKXi6G1lQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPf9gSNx/Yf+j/SX65B0mkFY1el5yFI/N6h4s6nXC/pwIhAN6ynjI0EaAmVgfbVxi5NA8TvwFxYynBjFicg5DDXCC3"}]},"scripts":{}},"0.3.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.3.0","homepage":"https://github.com/felixge/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"_id":"retry@0.3.0","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.8-pre","_defaultsLoaded":true,"dist":{"shasum":"902e4fc3e6c48d52badfec738be656b8ca23844c","tarball":"http://localhost:4260/retry/retry-0.3.0.tgz","integrity":"sha512-a08fczLoXqhlp25DdsyJRpNKQbUZrsu5INwNHKExq2685siC2yldC/Cu7R9aQxbGPziNuupxlkLuoOUWA5nQKg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSD0z85xbtWItSREZ7HLiNA5RppB7Plloqv2ONlcFEQwIhAMirEPAJLvpxOrqUE3XOLMRV4KayycGPwfhinEsWx02t"}]},"scripts":{}},"0.4.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.4.0","homepage":"https://github.com/felixge/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"_id":"retry@0.4.0","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.8-pre","_defaultsLoaded":true,"dist":{"shasum":"f6a0107aee4d4e5bd5469e1d31c780e438d154bd","tarball":"http://localhost:4260/retry/retry-0.4.0.tgz","integrity":"sha512-h3mY/Ifa5AnRdr/uaClOylXt/pT68tDZ3FAQHrvMjlJonPUvlRybiFoR3kmf9y4wBUgYtZCjGeEf3uYT50FNDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3HVgialaTKzvFJM4Pupt0opN/2vo4jtAGc69fQ+/k0AIgfsQsJWokLJ5UCHdXewqRUemhNpZHav84sX7slYUhQNk="}]},"scripts":{}},"0.5.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.5.0","homepage":"https://github.com/felixge/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"_id":"retry@0.5.0","_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"71e2793cd3e2ee9cce1182e173183af959decc3d","tarball":"http://localhost:4260/retry/retry-0.5.0.tgz","integrity":"sha512-FK0YWcgiUupP4R1xZeFBpMSsnr1qb+98QfXHNBRTdVY3OpPp5FCsNSqC7fbjyatiDH7sN4toTAKvaYJ1RLWxLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGQn3ODAlrugm8gU2Gr0ssvbOGT83PAjIXB+2KfTBXlGAiEAtQHeswVu2/JdhZzARgLHLZYpP3spCIuRfqhr0QZEigU="}]},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}]},"0.6.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.6.0","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/felixge/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"_id":"retry@0.6.0","_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"1c010713279a6fd1e8def28af0c3ff1871caa537","tarball":"http://localhost:4260/retry/retry-0.6.0.tgz","integrity":"sha512-RgncoxLF1GqwAzTZs/K2YpZkWrdIYbXsmesdomi+iPilSzjUyr/wzNIuteoTVaWokzdwZIJ9NHRNQa/RUiOB2g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDuqpBCcn1UKdE6gNXs2Q9VFX0EWxjLaqfg/c+vLfe8lAIgaTff+EkIcgrTM0HbxK1cm6JS31lEjJblirbbTuqpDIA="}]},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}]},"0.6.1":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","version":"0.6.1","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.6.1","_shasum":"fdc90eed943fde11b893554b8cc63d0e899ba918","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"dist":{"shasum":"fdc90eed943fde11b893554b8cc63d0e899ba918","tarball":"http://localhost:4260/retry/retry-0.6.1.tgz","integrity":"sha512-txv1qsctZq8ei9J/uCXgaKKFPjlBB0H2hvtnzw9rjKWFNUFtKh59WprXxpAeAey3/QeWwHdxMFqStPaOAgy+dA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIguTCoIhxMDaxnted8U92BNkYi5ZHPPeZOo4js5QIPwIhAOX8pSRvnXp1ypLCfc9ZFSUQgxATRWQym7pNbXtSEppz"}]}},"0.7.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.7.0","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"gitHead":"24d1e61f57423286e2d47fedd48876450a19a923","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.7.0","scripts":{},"_shasum":"dc86eeb960af9acb662896918be4254c1acf6379","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.33","_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"dist":{"shasum":"dc86eeb960af9acb662896918be4254c1acf6379","tarball":"http://localhost:4260/retry/retry-0.7.0.tgz","integrity":"sha512-5FBNTfNV8O9D6Qu+pm3/oosjRn2TrgSyEUCB+35+/VbYsDkCcabQLOhZaCsP42YrsKvJWNO4+eDW9ZpPxrOToA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDLEbyHLeBv4O2mfepmbViU0Y73hNET2diAsAtTdcnF2gIhAIQ++P7qV8netyvvokLRmy1RSi/Z/y4YKo91RrM8TKoj"}]}},"0.8.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.8.0","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"gitHead":"9446e803d6a41ae08732a4a215ae5bf1ff1ccfdd","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.8.0","scripts":{},"_shasum":"2367628dc0edb247b1eab649dc53ac8628ac2d5f","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.33","_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"dist":{"shasum":"2367628dc0edb247b1eab649dc53ac8628ac2d5f","tarball":"http://localhost:4260/retry/retry-0.8.0.tgz","integrity":"sha512-ijZyfXipJZZOw5V+SgaQTkwBS/TBkvWOFqYuWQ0h/tDlvQiTd3LqZ3LqHY/NULYgZgUgV8tmjRmhc1JdE6VAnQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEu3YxOpeCTv/L8SYOKcRydIUe1lwk1UGIR10i0uf4/fAiEA+5HBzZk3ElRLzFt0V8F6TyKUkS43iVkrH//dOqJnhPc="}]}},"0.9.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.9.0","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"gitHead":"1b621cf499ef7647d005e3650006b93a8dbeb986","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.9.0","scripts":{},"_shasum":"6f697e50a0e4ddc8c8f7fb547a9b60dead43678d","_from":".","_npmVersion":"2.1.7","_nodeVersion":"4.2.1","_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"dist":{"shasum":"6f697e50a0e4ddc8c8f7fb547a9b60dead43678d","tarball":"http://localhost:4260/retry/retry-0.9.0.tgz","integrity":"sha512-bkzdIZ5Xyim12j0jq6CQAHpfdsa2VqieWF6eN8vT2MXxCxLAZhgVUyu5EEMevJyXML+XWTxVbZ7mLaKx5F/DZw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICa3RRMGGriVklVgjYyzpV0u+4nlZFrksxlUTiF5VmHkAiEArTeAEyvxJEWFsJTE0Qd7qTQb8syrE4WaMmwR7XhCYGQ="}]}},"0.10.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.10.0","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"gitHead":"0616e6a6ebc49b5a36b619c8f7c414ced8c3813b","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.10.0","scripts":{},"_shasum":"649e15ca408422d98318161935e7f7d652d435dd","_from":".","_npmVersion":"2.1.7","_nodeVersion":"4.2.1","_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"dist":{"shasum":"649e15ca408422d98318161935e7f7d652d435dd","tarball":"http://localhost:4260/retry/retry-0.10.0.tgz","integrity":"sha512-stHWtpKppGdU35i9Neg9MHK/VD6RphZ+f6m/H5ACg4sCJy7o7D0A+o5qxP5DjhnTf1eYuKDfqD4IMJmwTFdtMg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpSKft6+3+gd/sRhiE1Ir67sX/44RiSjEFt4q9wo1iSwIhAMmAbNLgzB5+3i8/U0+4jpZIPCvKguDHtyJFmoMfBhJL"}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/retry-0.10.0.tgz_1471682099847_0.5031970851123333"}},"0.10.1":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.10.1","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":"*"},"dependencies":{},"devDependencies":{"fake":"0.2.0","far":"0.0.1"},"gitHead":"3dbe5189b48786e56d1d1807731adfc53a70eeae","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.10.1","scripts":{},"_shasum":"e76388d217992c252750241d3d3956fed98d8ff4","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"tim-kos","email":"tim@debuggable.com"},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"dist":{"shasum":"e76388d217992c252750241d3d3956fed98d8ff4","tarball":"http://localhost:4260/retry/retry-0.10.1.tgz","integrity":"sha512-ZXUSQYTHdl3uS7IuCehYfMzKyIDBNoAuUblvy5oGO5UJSUTmStUUVPXbA9Qxd173Bgre53yCQczQuHgRWAdvJQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQ5isNJzmcoraZheQaC24dJkhJxbLF+HtLSbpOxE5TggIhAJSiASoDFjyGHgofMSjkCXU3AvFGIsCX0jw4Yooq8Pof"}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/retry-0.10.1.tgz_1481556523726_0.45345148630440235"}},"0.12.0":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.12.0","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index","engines":{"node":">= 4"},"dependencies":{},"devDependencies":{"fake":"0.2.0","istanbul":"^0.4.5","tape":"^4.8.0"},"scripts":{"test":"istanbul cover ./node_modules/tape/bin/tape ./test/integration/*.js","release:major":"env SEMANTIC=major npm run release","release:minor":"env SEMANTIC=minor npm run release","release:patch":"env SEMANTIC=patch npm run release","release":"npm version ${SEMANTIC:-patch} -m \"Release %s\" && git push && git push --tags && npm publish"},"gitHead":"f802d9edc2fdbca727d3e368234b6d714db06f8e","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.12.0","_shasum":"1b42a6266a21f07421d1b0b54b7dc167b01c013b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"6.10.0","_npmUser":{"name":"tim-kos","email":"tim@transloadit.com"},"dist":{"shasum":"1b42a6266a21f07421d1b0b54b7dc167b01c013b","tarball":"http://localhost:4260/retry/retry-0.12.0.tgz","fileCount":17,"unpackedSize":32210,"integrity":"sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDMDGASpQgnZsQGbQrEfU7i4L+ZKTo9locIjyOG8CM7zgIhALH9AixwT4LkB513kWXw3P2vIZ6kqYNzDWTD7UQ/RdD7"}]},"maintainers":[{"name":"tim-kos","email":"tim@debuggable.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retry_0.12.0_1523266527484_0.8738449656621592"},"_hasShrinkwrap":false},"0.13.1":{"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"name":"retry","description":"Abstraction for exponential and custom retry strategies for failed operations.","license":"MIT","version":"0.13.1","homepage":"https://github.com/tim-kos/node-retry","repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"directories":{"lib":"./lib"},"main":"index.js","engines":{"node":">= 4"},"dependencies":{},"devDependencies":{"fake":"0.2.0","istanbul":"^0.4.5","tape":"^4.8.0"},"scripts":{"test":"istanbul cover ./node_modules/tape/bin/tape ./test/integration/*.js","release:major":"env SEMANTIC=major npm run release","release:minor":"env SEMANTIC=minor npm run release","release:patch":"env SEMANTIC=patch npm run release","release":"npm version ${SEMANTIC:-patch} -m \"Release %s\" && git push && git push --tags && npm publish"},"gitHead":"b8e26ea7adda3f11c19086a762d15e95521f3e4e","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"_id":"retry@0.13.1","_nodeVersion":"12.18.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==","shasum":"185b1587acf67919d63b357349e03537b2484658","tarball":"http://localhost:4260/retry/retry-0.13.1.tgz","fileCount":8,"unpackedSize":18852,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg0EOcCRA9TVsSAnZWagAAkmsP/iQnbBGOFMXTsAFq4K7q\nnyBGleAEpi322xf8JWzjCP8exKTHYytFCP3WDNmLEs78cV+2ZPODKOcVAbSS\nMdjmsA4X0sFVd5wV6L319PaQhTxnrBZUSvGmcaCSw9BllbBroZt/ZtH57+Cx\nUKuYY2qi5j0xPY9ZmomwVyYamhi9iZH98aAB/fqwgxOBdwjesAZz5ZD0svwM\nYXELM4kSWZNTdNaRPL1t06zVKAFXFmYRCq2W6NDQTBGQTUV2hhxRRJuJizKz\n9eMITrkTnAoujY628VrOZAJxOxTMEYXRWaF/yZJYRybPGRrxRUE/RfRGSRDm\nLpYQZ+qSDNlyXfqVyK+XgSaPy7G+EkyUnVC9tG7bIZkppnoN0jAoc3pcq85L\ngT7krDeaHf3jqli5hlZ0AnEOEnemBoikzXNJ17p7V+oqqUF3SOFMjbvrH0Yp\nmC3sgt2qgYz4MEtthHIghu8djRwVXdLv/05BKaR2Luao+om72G6Polj47MLf\nxL+S55jzc5+diParH6goP1djfhcb1Bc9QWEBlhG0aNsfzqweAX/e4b1dZT+v\nXxB1XqTDZQCVWtVTv1dHd9hr7qH2EIYHlNCUGeZX8vX11g8r87Xx5jQvgGas\noWwzFSglYHJqviEoW/1oiNz7B33YMWZjDvrc82oP5g4jBEHfrjXtzyJHSSSX\nFSFN\r\n=ZUw9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCWZnJxmpAkgg8liWReEFWDNDKcUTLYfNZrXPUpq4jO1QIhANQCBO5EpuBezpt8hASIeFgwFYEoB429ZAEJyaBd2BfB"}]},"_npmUser":{"name":"tim-kos","email":"tim@transloadit.com"},"maintainers":[{"name":"tim-kos","email":"tim@transloadit.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/retry_0.13.1_1624261532166_0.02383332754816614"},"_hasShrinkwrap":false}},"maintainers":[{"name":"tim-kos","email":"tim@transloadit.com"}],"time":{"modified":"2022-06-26T12:20:05.335Z","created":"2011-05-13T11:26:52.829Z","0.0.1":"2011-05-13T11:26:53.515Z","0.1.0":"2011-05-16T08:10:27.648Z","0.2.0":"2011-05-16T14:32:52.025Z","0.3.0":"2011-05-31T14:19:32.882Z","0.4.0":"2011-06-05T08:07:17.763Z","0.5.0":"2011-11-03T10:55:32.772Z","0.6.0":"2012-02-14T08:34:18.028Z","0.6.1":"2014-06-26T12:00:56.230Z","0.7.0":"2015-09-01T10:16:42.770Z","0.8.0":"2015-09-16T18:34:56.522Z","0.9.0":"2016-01-26T12:02:25.243Z","0.10.0":"2016-08-20T08:35:01.550Z","0.10.1":"2016-12-12T15:28:45.566Z","0.12.0":"2018-04-09T09:35:27.678Z","0.13.1":"2021-06-21T07:45:32.286Z"},"author":{"name":"Tim Koschützki","email":"tim@debuggable.com","url":"http://debuggable.com/"},"repository":{"type":"git","url":"git://github.com/tim-kos/node-retry.git"},"users":{"carlos8f":true,"gdbtek":true,"subchen":true,"jperdereau":true,"j3kz":true,"brandonpapworth":true,"bret":true,"markstos":true,"fotooo":true,"passcod":true,"progmer":true,"mccoyjordan":true,"andris":true,"btd":true,"yetithefoot":true,"shiningray":true,"bsnote":true,"laggingreflex":true,"surajs21":true,"hisabimbola":true,"fatore":true,"crowelch":true,"mattmcfarland":true,"chriszs":true,"asaupup":true,"iwasawafag":true,"crewmoss":true,"manikantag":true,"vladimir.shushkov":true,"moiyer":true,"rajiff":true,"quafoo":true,"nuwaio":true,"mjurincic":true,"floriannagel":true,"knksmith57":true,"losymear":true},"readme":"<!-- badges/ -->\n[![Build Status](https://secure.travis-ci.org/tim-kos/node-retry.svg?branch=master)](http://travis-ci.org/tim-kos/node-retry \"Check this project's build status on TravisCI\")\n[![codecov](https://codecov.io/gh/tim-kos/node-retry/branch/master/graph/badge.svg)](https://codecov.io/gh/tim-kos/node-retry)\n<!-- /badges -->\n\n# retry\n\nAbstraction for exponential and custom retry strategies for failed operations.\n\n## Installation\n\n npm install retry\n\n## Current Status\n\nThis module has been tested and is ready to be used.\n\n## Tutorial\n\nThe example below will retry a potentially failing `dns.resolve` operation\n`10` times using an exponential backoff strategy. With the default settings, this\nmeans the last attempt is made after `17 minutes and 3 seconds`.\n\n``` javascript\nvar dns = require('dns');\nvar retry = require('retry');\n\nfunction faultTolerantResolve(address, cb) {\n var operation = retry.operation();\n\n operation.attempt(function(currentAttempt) {\n dns.resolve(address, function(err, addresses) {\n if (operation.retry(err)) {\n return;\n }\n\n cb(err ? operation.mainError() : null, addresses);\n });\n });\n}\n\nfaultTolerantResolve('nodejs.org', function(err, addresses) {\n console.log(err, addresses);\n});\n```\n\nOf course you can also configure the factors that go into the exponential\nbackoff. See the API documentation below for all available settings.\ncurrentAttempt is an int representing the number of attempts so far.\n\n``` javascript\nvar operation = retry.operation({\n retries: 5,\n factor: 3,\n minTimeout: 1 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n});\n```\n\n## API\n\n### retry.operation([options])\n\nCreates a new `RetryOperation` object. `options` is the same as `retry.timeouts()`'s `options`, with three additions:\n\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Whether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n* `maxRetryTime`: The maximum time (in milliseconds) that the retried operation is allowed to run. Default is `Infinity`. \n\n### retry.timeouts([options])\n\nReturns an array of timeouts. All time `options` and return values are in\nmilliseconds. If `options` is an array, a copy of that array is returned.\n\n`options` is a JS object that can contain any of the following keys:\n\n* `retries`: The maximum amount of times to retry the operation. Default is `10`. Seting this to `1` means `do it once, then retry it once`.\n* `factor`: The exponential factor to use. Default is `2`.\n* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.\n* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.\n* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `false`.\n\nThe formula used to calculate the individual timeouts is:\n\n```\nMath.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout)\n```\n\nHave a look at [this article][article] for a better explanation of approach.\n\nIf you want to tune your `factor` / `times` settings to attempt the last retry\nafter a certain amount of time, you can use wolfram alpha. For example in order\nto tune for `10` attempts in `5 minutes`, you can use this equation:\n\n![screenshot](https://github.com/tim-kos/node-retry/raw/master/equation.gif)\n\nExplaining the various values from left to right:\n\n* `k = 0 ... 9`: The `retries` value (10)\n* `1000`: The `minTimeout` value in ms (1000)\n* `x^k`: No need to change this, `x` will be your resulting factor\n* `5 * 60 * 1000`: The desired total amount of time for retrying in ms (5 minutes)\n\nTo make this a little easier for you, use wolfram alpha to do the calculations:\n\n<http://www.wolframalpha.com/input/?i=Sum%5B1000*x^k%2C+{k%2C+0%2C+9}%5D+%3D+5+*+60+*+1000>\n\n[article]: http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html\n\n### retry.createTimeout(attempt, opts)\n\nReturns a new `timeout` (integer in milliseconds) based on the given parameters.\n\n`attempt` is an integer representing for which retry the timeout should be calculated. If your retry operation was executed 4 times you had one attempt and 3 retries. If you then want to calculate a new timeout, you should set `attempt` to 4 (attempts are zero-indexed).\n\n`opts` can include `factor`, `minTimeout`, `randomize` (boolean) and `maxTimeout`. They are documented above.\n\n`retry.createTimeout()` is used internally by `retry.timeouts()` and is public for you to be able to create your own timeouts for reinserting an item, see [issue #13](https://github.com/tim-kos/node-retry/issues/13).\n\n### retry.wrap(obj, [options], [methodNames])\n\nWrap all functions of the `obj` with retry. Optionally you can pass operation options and\nan array of method names which need to be wrapped.\n\n```\nretry.wrap(obj)\n\nretry.wrap(obj, ['method1', 'method2'])\n\nretry.wrap(obj, {retries: 3})\n\nretry.wrap(obj, {retries: 3}, ['method1', 'method2'])\n```\nThe `options` object can take any options that the usual call to `retry.operation` can take.\n\n### new RetryOperation(timeouts, [options])\n\nCreates a new `RetryOperation` where `timeouts` is an array where each value is\na timeout given in milliseconds.\n\nAvailable options:\n* `forever`: Whether to retry forever, defaults to `false`.\n* `unref`: Wether to [unref](https://nodejs.org/api/timers.html#timers_unref) the setTimeout's, defaults to `false`.\n\nIf `forever` is true, the following changes happen:\n* `RetryOperation.errors()` will only output an array of one item: the last error.\n* `RetryOperation` will repeatedly use the `timeouts` array. Once all of its timeouts have been used up, it restarts with the first timeout, then uses the second and so on.\n\n#### retryOperation.errors()\n\nReturns an array of all errors that have been passed to `retryOperation.retry()` so far. The\nreturning array has the errors ordered chronologically based on when they were passed to\n`retryOperation.retry()`, which means the first passed error is at index zero and the last is\nat the last index.\n\n#### retryOperation.mainError()\n\nA reference to the error object that occured most frequently. Errors are\ncompared using the `error.message` property.\n\nIf multiple error messages occured the same amount of time, the last error\nobject with that message is returned.\n\nIf no errors occured so far, the value is `null`.\n\n#### retryOperation.attempt(fn, timeoutOps)\n\nDefines the function `fn` that is to be retried and executes it for the first\ntime right away. The `fn` function can receive an optional `currentAttempt` callback that represents the number of attempts to execute `fn` so far.\n\nOptionally defines `timeoutOps` which is an object having a property `timeout` in miliseconds and a property `cb` callback function.\nWhenever your retry operation takes longer than `timeout` to execute, the timeout callback function `cb` is called.\n\n\n#### retryOperation.try(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.start(fn)\n\nThis is an alias for `retryOperation.attempt(fn)`. This is deprecated. Please use `retryOperation.attempt(fn)` instead.\n\n#### retryOperation.retry(error)\n\nReturns `false` when no `error` value is given, or the maximum amount of retries\nhas been reached.\n\nOtherwise it returns `true`, and retries the operation after the timeout for\nthe current attempt number.\n\n#### retryOperation.stop()\n\nAllows you to stop the operation being retried. Useful for aborting the operation on a fatal error etc.\n\n#### retryOperation.reset()\n\nResets the internal state of the operation object, so that you can call `attempt()` again as if this was a new operation object.\n\n#### retryOperation.attempts()\n\nReturns an int representing the number of attempts it took to call `fn` before it was successful.\n\n## License\n\nretry is licensed under the MIT license.\n\n\n# Changelog\n\n0.10.0 Adding `stop` functionality, thanks to @maxnachlinger.\n\n0.9.0 Adding `unref` functionality, thanks to @satazor.\n\n0.8.0 Implementing retry.wrap.\n\n0.7.0 Some bug fixes and made retry.createTimeout() public. Fixed issues [#10](https://github.com/tim-kos/node-retry/issues/10), [#12](https://github.com/tim-kos/node-retry/issues/12), and [#13](https://github.com/tim-kos/node-retry/issues/13).\n\n0.6.0 Introduced optional timeOps parameter for the attempt() function which is an object having a property timeout in milliseconds and a property cb callback function. Whenever your retry operation takes longer than timeout to execute, the timeout callback function cb is called.\n\n0.5.0 Some minor refactoring.\n\n0.4.0 Changed retryOperation.try() to retryOperation.attempt(). Deprecated the aliases start() and try() for it.\n\n0.3.0 Added retryOperation.start() which is an alias for retryOperation.try().\n\n0.2.0 Added attempts() function and parameter to retryOperation.try() representing the number of attempts it took to call fn().\n","homepage":"https://github.com/tim-kos/node-retry","bugs":{"url":"https://github.com/tim-kos/node-retry/issues"},"readmeFilename":"README.md","license":"MIT"} |