{"_id":"@canopytax/fetcher","_rev":"8-2042e95ceefc45d272705a287e2e9752","name":"@canopytax/fetcher","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@canopytax/fetcher","version":"0.0.1","license":"Apache-2.0","_id":"@canopytax/fetcher@0.0.1","maintainers":[{"name":"parkm","email":"despondentdonkey@gmail.com"},{"name":"greenjeffreym","email":"green.jeffreym@gmail.com"},{"name":"mmemory","email":"michaelmemoria@gmail.com"},{"name":"ron.douglas","email":"ron.douglas@canopytax.com"},{"name":"miracastillo","email":"mirajcastillo@gmail.com"},{"name":"geoctrl","email":"tonylefler@gmail.com"},{"name":"tannerrigby","email":"PACHRON16@GMAIL.COM"},{"name":"rchilds","email":"rhys.childs@canopytax.com"}],"dist":{"shasum":"cbbe0087cfc80ccdeede80e2ee42e61f0fae2fe6","tarball":"https://registry.npmjs.org/@canopytax/fetcher/-/fetcher-0.0.1.tgz","fileCount":6,"integrity":"sha512-HtqorQ/toGRklHVwXbtTnTx0C+DXn2mB/7DxAqRlO8ZNrziEf1YJ+az4pD+6BQBA1K8t8GSuShZOHw/flN3Frw==","signatures":[{"sig":"MEUCIQDy2ZaT9qs/Bxp6BYEe5FtPn472XPLTh9ObHqouLSP1pAIgMgwwQht8q+znKDrfD8LWrqhPMplAeUqzRaYX9rwevRU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31304,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRueiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEPxAAibJ5wDijuFhGUOvAvhPfk2dUNtnStO83GANXboM8FUCKUKWd\r\n91faUBQvpwTbdoSH8nr4VsjL/gwAew4oeBxjXVTaUsy+0pdaP0Bm64lg9HRF\r\nt66HW0D2S2WxXHZ/KEng2gQOk18r4Lb8+FKL9nT9vimMfOymddDkU9n2njCW\r\nfm1jJcHVhYD21cH7C/iEUKLUp2EH5THMWrV5qggE0zGM/AdLnU50MCPYRCUk\r\nEsL4JtCuT5tYqEFMXUVADE7P9D054+nVFU598BjiHxI+kc8hyU9lpy/p0s09\r\nAqz1QgYu5/Af6Vvw4V8HVmnHHxxe4iL3BCUKFMy9air0MefoZkN48wmhh5du\r\n7MJM3yMHwgmK0M5Vau2hTA8WRvKJZErcbkkpYTq507CGcuOeyuxEuxil5IBq\r\nH2sFDRZMGMiOLUC3Pzu19bb2z18d7yMgG18Wkwm89k/CUxU6agZiSRGqfd7P\r\nDxPAekhhtY+UUAsWNZgoUw1/SEXvr58w0rFYgUg2rS5knASVFdc0Jzxk4OHW\r\nTfMXWC0J6XTsk3MPKLQt15Mc4xmYPckunbVJVSi4CK4e7K9F8rbISl3WDyve\r\nLx4XH8RUNQziDjKfVchu1kkgYbqxvowhxh8w2VxP/znVmeSXHA37cdcSICkf\r\nUSVhSbThhYAgztABG0tFLt0V0GZQSs8BhWM=\r\n=Wod5\r\n-----END PGP SIGNATURE-----\r\n"},"scripts":{"lint":"eslint src","test":"jest --config jest.json --coverage","build":"webpack --config webpack.config.js --env.analyze=static","start":"webpack-dev-server --config ./webpack.config.js --port","analyze":"webpack --config webpack.config.js --env.analyze=server","prepare":"husky install","prepush":"yarn lint","prepublish":"yarn build-library","watch-tests":"jest --watch --config jest.json","build-library":"cp library/mocks/fetcher.js ./ && cp library/types/fetcher.d.ts ./","start-windows":"webpack-dev-server --config ./webpack.config.js --port","publish-public":"yarn prepublish && yarn publish --access public"},"_npmUser":{"name":"geoctrl","email":"tonylefler@gmail.com"},"description":"Canopy's wrapper around the [`window.fetch` api](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) . It automatically provides:","directories":{},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","browserslist":["extends browserslist-config-canopy"],"dependencies":{"rxjs":"^6.5.3","sofe":"^1.5.6","react":"^17.0.2","lodash":"^4.17.15","pusher-js":"^4.4.0","auto-trace":"^3.2.3","online-listener":"^2.0.6","react-test-renderer":"^17.0.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","husky":"^8.0.0","eslint":"^7.18.0","webpack":"^4.41.2","jest-cli":"^26.6.3","prettier":"^2.8.7","babel-jest":"^26.6.3","@babel/core":"^7.12.10","webpack-cli":"^3.3.10","babel-eslint":"^10.1.0","babel-loader":"^8.2.2","pretty-quick":"^3.1.3","@babel/runtime":"^7.12.5","@babel/preset-env":"^7.12.11","webpack-dev-server":"^3.9.0","eslint-config-canopy":"^2.3.0","canopy-webpack-config":"^3.2.0","@testing-library/react":"^8.0.1","browserslist-config-canopy":"^3.1.2","@testing-library/react-hooks":"^1.0.3","@babel/plugin-transform-runtime":"^7.12.10"},"_npmOperationalInternal":{"tmp":"tmp/fetcher_0.0.1_1682368418319_0.8497625742404695","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@canopytax/fetcher","version":"0.0.2","license":"Apache-2.0","_id":"@canopytax/fetcher@0.0.2","maintainers":[{"name":"parkm","email":"despondentdonkey@gmail.com"},{"name":"greenjeffreym","email":"green.jeffreym@gmail.com"},{"name":"mmemory","email":"michaelmemoria@gmail.com"},{"name":"ron.douglas","email":"ron.douglas@canopytax.com"},{"name":"miracastillo","email":"mirajcastillo@gmail.com"},{"name":"geoctrl","email":"tonylefler@gmail.com"},{"name":"tannerrigby","email":"PACHRON16@GMAIL.COM"},{"name":"rchilds","email":"rhys.childs@canopytax.com"}],"dist":{"shasum":"e8d03c64ee664ac71a30e5fa6674339e9045b61d","tarball":"https://registry.npmjs.org/@canopytax/fetcher/-/fetcher-0.0.2.tgz","fileCount":6,"integrity":"sha512-rFp38I2MOqntx7zrqmWjRcma5qLpugXRu68AuUJt7UHX4MTCIT+7bhijTNIUYMOFoSbeDNspbua6XxPfUWhtIg==","signatures":[{"sig":"MEYCIQCPmlFEhye3IBJp6Z6LCjeyyjWA0IlFzdGgArnsGXCQCgIhAN78WbaOaOf9twsPAG4VA0s2S9qsynaJVcd5CE2x2S9A","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31699,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkRwMZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmonjA//TLVzHckMXp+KVQXQw7hmmlwT6pn1Dre+AnXsWiJT+WoJ8lNA\r\nBF8emBcIspx78BgekoJ+LOaBhKYj0IEnbnL1RCW+8VxjpA6n4pfKXiW/jeBI\r\nX/s58dA7x0mhrQHTvS+3HOFjug7R/LgrYiKJvecUA0K6U4OAEf3EzRh6c2xN\r\n1PV3Sl8OWto/Wf93O5KXj7MWgrdlsmxc/LSKu6kVy1MdBw3OPYzY4bIMYlBU\r\nW5ir9RjuaJS4rCPlN9tDqn+JFiyrpZGpmVq2j7OQAjr++KEUAYsxmmg9k+JX\r\nNGkEnrY5KScUCHzepZ+cd0zCemUmAyR+NELMv38pv7bDi4qsYoVrgj9RAAMF\r\ny+Q9n34PnVa+2bQJ6QbRgymW1VhG7Bal5cx+Z1J/pjo/d6Fs5ObeZH1KqpF4\r\n8COVq2NM+lhNoTJZs8OAJpZ45wpa1yQTyoAlEhut+ve1dYAYTikHAsnpLVjq\r\n/mwVykpNtDd2x7eqJKFjsdIc6tYkH7UyXmhhiBMXeQVwQvYJYcq5shC9YCki\r\nLieJsrpDq4UTJqrIi6e2tfVzFJC6BDfZp1475l2kkRRndCJJTjwdtqf/DMmz\r\nUVr0l4Dpe0ArB17d2lAFbwfxW6epVvz0QKpSchB8d0rR2qfnVns8AO17AMy7\r\n37YsMDZ7T4tRI2P4LDdi7XcDcexXOqY/BgI=\r\n=hb4f\r\n-----END PGP SIGNATURE-----\r\n"},"scripts":{"lint":"eslint src","test":"jest --config jest.json --coverage","build":"webpack --config webpack.config.js --env.analyze=static","start":"webpack-dev-server --config ./webpack.config.js --port","analyze":"webpack --config webpack.config.js --env.analyze=server","prepare":"husky install","prepush":"yarn lint","prepublish":"yarn build-library","watch-tests":"jest --watch --config jest.json","build-library":"cp library/mocks/fetcher.js ./ && cp library/types/fetcher.d.ts ./","start-windows":"webpack-dev-server --config ./webpack.config.js --port","publish-public":"yarn prepublish && yarn publish --access public"},"_npmUser":{"name":"geoctrl","email":"tonylefler@gmail.com"},"description":"Canopy's wrapper around the [`window.fetch` api](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) . It automatically provides:","directories":{},"licenseText":"                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","browserslist":["extends browserslist-config-canopy"],"dependencies":{"rxjs":"^6.5.3","sofe":"^1.5.6","react":"^17.0.2","lodash":"^4.17.15","pusher-js":"^4.4.0","auto-trace":"^3.2.3","online-listener":"^2.0.6","react-test-renderer":"^17.0.2"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^26.6.3","husky":"^8.0.0","eslint":"^7.18.0","webpack":"^4.41.2","jest-cli":"^26.6.3","prettier":"^2.8.7","babel-jest":"^26.6.3","@babel/core":"^7.12.10","webpack-cli":"^3.3.10","babel-eslint":"^10.1.0","babel-loader":"^8.2.2","pretty-quick":"^3.1.3","@babel/runtime":"^7.12.5","@babel/preset-env":"^7.12.11","webpack-dev-server":"^3.9.0","eslint-config-canopy":"^2.3.0","canopy-webpack-config":"^3.2.0","@testing-library/react":"^8.0.1","browserslist-config-canopy":"^3.1.2","@testing-library/react-hooks":"^1.0.3","@babel/plugin-transform-runtime":"^7.12.10"},"_npmOperationalInternal":{"tmp":"tmp/fetcher_0.0.2_1682375449166_0.5326691181284902","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-04-24T20:33:38.256Z","modified":"2026-07-27T21:51:28.207Z","0.0.1":"2023-04-24T20:33:38.531Z","0.0.2":"2023-04-24T22:30:49.345Z"},"license":"Apache-2.0","description":"Canopy's wrapper around the [`window.fetch` api](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) . It automatically provides:","maintainers":[{"email":"ron.douglas@canopytax.com","name":"ron.douglas"},{"email":"mirajcastillo@gmail.com","name":"miracastillo"},{"email":"tonylefler@gmail.com","name":"geoctrl"},{"email":"rhys.childs@canopytax.com","name":"rchilds"},{"email":"despondentdonkey@gmail.com","name":"parkm"},{"email":"alize.nguyen@canopytax.com","name":"alizenguyen"},{"email":"mlwill07@gmail.com","name":"mlwill07"},{"email":"larry.custodio@canopytax.com","name":"larrycustodiocanopy"}],"readme":"# fetcher\n\nCanopy's wrapper around\nthe [`window.fetch` api](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)\n. It automatically provides:\n\n- JSON.stringifying the request body by default.\n- Prefixing urls with the api gateway url (canopyUrls.getAPIUrl) if a full url\n  is not provided.\n- Defaulting the `Content-Type` header to be `application/json` for all requests\n  that have a body.\n- Auth token refreshes. This will happen automatically whenever there is a 401\n  unless you provide a truthy `passThrough401` property on the fetch\n  configuration object. (For\n  example, `fetchAsObservable('/url', {passThrough401: true})`). When\n  the `passThrough401` property is set, the auth token will not be refreshed and\n  the request will be passed through like normal.\n- The X-CSRF-TOKEN http header\n- [credentials](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials)\n- Removing angular properties that are prefixed with $$ (similar to what $http\n  does).\n\n#### Fancy Caching\n\nFetcher has an opt-in caching feature (`fetchWithSharedCache`) that allows\nredundant calls to the same URL without the performance/load penalty of making\nmany ajax requests. It also gets even fancier by pushing changes to cached\nobjects out to everyone who's interested in them. This is done by detecting if a\nPUT/PATCH is changing an object that other parts of the app have cached. If so,\nthe response to the PUT/PATCH will be pushed out to all subscribers. See\nthe `fetchWithSharedCache` and `forceBustCache` APIs\n\n## Methods\n\n### fetcher(url: string, options: {})\n\nReturns `Promise<any>`\n\nThe default exported value, `fetcher`, is a function that simply wraps\nthe `fetch` api. You should call fetcher just as if you were calling fetch. The\nonly known limitation that we know of right now is that if you call fetcher with\nthe first parameter being\na [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object,\nfetcher will not be able to do its auth token refreshes for you if a 401 http\nstatus is returned for the server.\n\n```javascript\nimport fetcher from \"fetcher!sofe\";\n\nfetcher(\"/my-url\").then((res) => res);\n```\n\n### fetchAsObservable(url: string, options: {})\n\nReturns `Observable<any>`\n\nTakes almost the exact same params as `fetcher` but returns an RxJS 6 observable\nrather than a promise. If `response.ok`, it will by default automatically try to\nreturn JSON with a fallback of text. To modify the default return behavior, you\ncan including an optional `responseType` (ex. `responseType: 'blob'`) in the\nsecond argument's object to explicitly specify the fetch response body\noperation (i.e. `.json()`, `.text()`, `.blob()`, etc.).\n\n```javascript\nimport { fetchAsObservable } from \"fetcher!sofe\";\n\nfetchAsObservable(\"/my-url\").subscribe((res) => res);\n```\n\n### fetchAbort()\n\nReturns `(url: string, options: {}) => Promise<any>`\n\nThis function will return a new fetch function, while also instantiating a new\nabort controller. That abort signal will be tied to all uses of this fetch.\n\nThe fetch function will also have a new property method on it called `abort`,\nwith each use subsequently instantiating a new abort controller (basically\nthis means you can reuse the fetch as much as you'd like).\n\nAbort all fetches:\n\n```javascript\nimport { fetchAbort } from \"fetcher!sofe\";\n\n// only one fetch is needed if you're going to abort them together\nconst runFetch = fetchAbort();\n\nrunFetch(\"/my-url-1\").then((res) => res);\nrunFetch(\"/my-url-2\").then((res) => res);\n\n// abort all\nrunFetch.abort();\n```\n\nAbort a single fetch:\n\n```javascript\nimport { fetchAbort } from \"fetcher!sofe\";\n\n// controlling each abort differently requires multiple fetches\nconst runFetch1 = fetchAbort();\nconst runFetch2 = fetchAbort();\n\nrunFetch1(\"/my-url-1\").then((res) => res);\nrunFetch2(\"/my-url-2\").then((res) => res);\n\n// abort only \"runFetch1\"\nrunFetch1.abort();\n```\n\n### useFetchAbort(opts: { abortOnUnmount: boolean })\n\nReact hook version of `fetchAbort`. Hook returns an array of two variables:\n\n- `(url: string, options: {}) => Promise<any>` - fetcher method\n- `() => void` - method to abort fetch\n\nWhen fetching on component mount, fetching/aborting is as simple as throwing\nthem in a useEffect:\n\n```jsx\nimport React, { useEffect } from 'react';\nimport { useFetchAbort } from 'fetcher!sofe';\n\nfunction MyComponent() {\n  const [runFetch, runAbort] = useFetchAbort();\n\n  useEffect(() => {\n    runFetch('/my-url').then(res => res);\n    () => runAbort();\n  });\n\n  return (...);\n}\n```\n\n_(Keep in mind React 18's quirk of running `useEffect` twice on initial\nrender...)_\n\nIf you need more finite control of aborting, this works the same way as\n`fetchAbort`:\n\n```jsx\nimport React, { useEffect } from 'react';\nimport { useFetchAbort } from 'fetcher!sofe';\n\nfunction MyComponent() {\n  const [runFetch1, runAbort1] = useFetchAbort();\n  const [runFetch2, runAbort2] = useFetchAbort();\n\n  async function getOne() {\n    const res = await runFetch1('/my-url-1');\n  }\n  async function getTwo() {\n    const res = await runFetch2('/my-url-2');\n  }\n\n  useEffect(() => {\n    // only abort \"runFetch1\"\n    () => runAbort1();\n  });\n\n  return (...);\n}\n```\n\nBy default, the `opts.abortOnUnmount` argument is set to `true`, so you don't\nneed to manually abort - the hook will do that for you 😉.\n\n```jsx\nimport React, { useEffect } from 'react';\nimport { useFetchAbort } from 'fetcher!sofe';\n\nfunction MyComponent() {\n  const [runFetch] = useFetchAbort();\n\n  async function getTheThing() {\n    const res = await runFetch('/my-url');\n  }\n  return (...);\n}\n```\n\n_You can set `opts.abortOnUnmount` to false if you need to manually control how the\nfetch aborts._\n\n## Older docs that need to get updated:\n\n## React Hook options\n\n- useFetcher\n- useObservable\n\n### useFetcher\n\nA helper that allows you to run fetcher on component mount. `useFetcher` takes\ntwo arguments the url and optionalProps:\n\n- api url: (\n  eg `api/clients/${contactId}?include=users,contacts,tags,contact_for,contact_sources`)\n  ,\n- optionalProps: {\n  pluck: 'clients', // string that we use to pluck the value out of the\n  response (via rxjs pluck operator)\n  options: fetcherOptions,\n  initialResults: [] // initial results value\n  manualFire: true // defaults to false. If true you'll also get a `fire` method\n  that allows you to \"fire when ready\" and not immediately.\n  }\n\n#### Example\n\n```jsx\nconst { loading, results, error, refetch } = useFetcher(\n  `api/clients/${contactId}?include=users,contacts,tags,contact_for,contact_sources`,\n  {\n    pluck: \"clients\",\n  }\n);\n```\n\n### useObservable\n\nA more powerful version of `useFetcher` but requires more configuration.\n`useObservable` takes two arguments an rxjs observable and the initialResults\n\n- rxjs observable can do anything/everything\n- options: {initialResults, manualFire}\n  - initialResults: represents the initial state returned by the hook\n  - manualFire: defaults to false. If true you'll also get a `fire` method\n    that allows you to \"fire when ready\" and not immediately.\n\n_NOTE_ you _must_ memoize your observable if dynamically created\n\n#### Example\n\n```jsx\nconst observable = useMemo(\n  () => {\n    return fromEvent(...).pipe(\n      tap(...),\n      debounceTime(...),\n      switchMap(...),\n      pluck(...)\n    )\n  },\n  []\n)\n\nconst { loading, results, error, resubscribe } = useObservable(observable, [])\n\n```\n\n## Usage\n\n```js\nimport fetcher, {\n  onPusher,\n  fetchWithSharedCache,\n  forceBustCache,\n  fetchAsObservable,\n  fetchWithProgress,\n} from \"fetcher\";\nimport canopyUrls from \"canopy-urls!sofe\";\nimport { skipLast, last } from \"rxjs/operators\";\n\nfetcher(`${canopyUrls.getWorkflowUrl()}/api/users/0`)\n  .then((resp) => {\n    if (resp.ok) {\n      resp\n        .json() // or .text()\n        .then((json) => {\n          console.log(json.users);\n        })\n        .catch((ex) => {\n          throw ex;\n        });\n    } else {\n      throw new Error(\n        `Couldn't get user -- server responded with ${resp.status}`\n      );\n    }\n  })\n  .catch((ex) => {\n    throw ex;\n  });\n\nfetchAsObservable(`${canopyUrls.getWorkflowUrl()}/api/users/0`).subscribe(\n  (user) => {\n    /* user json object */\n  },\n  (error) => {\n    throw error;\n  }\n);\n\nconst formData = new FormData();\nformData.append(\"file\", document.getElementById(\"file-input\").files[0]);\nconst withProgress = fetchWithProgress(\n  `${canopyUrls.getAPIUrl()}/contacts/1/files`,\n  {\n    method: \"post\",\n    body: formData,\n  }\n);\nwithProgress.pipe(skipLast(1)).subscribe((progressEvent) => {\n  console.log(\n    `File upload progress is now at ${progressEvent.overallProgress}`\n  );\n});\nwithProgress.pipe(last()).subscribe((data) => {\n  console.log(`Response from server`, data);\n});\n\nwithProgress.connect();\n\nconst subscription = fetchWithSharedCache(\n  `${canopyUrls.getWorkflowUrl()}/api/clients/1/engagements/1`\n).subscribe(\n  (engagement) => {\n    // this is the json from the response, not the response itself\n    console.log(engagement.id);\n  },\n\n  (err) => {\n    throw err;\n  }\n);\n\nsetTimeout(subscription.dispose, 10000);\n\nforceBustCache(`${canopyUrls.getWorkflowUrl()}/api/clients/1`)\n  .then((resp) => {\n    console.log(\"cache was busted!\");\n    resp\n      .json()\n      .then((json) => console.log(json))\n      .catch((ex) => {\n        throw ex;\n      });\n  })\n  .catch((ex) => {\n    throw ex;\n  });\n\nconst disposable = onPusher(\"message-type\").subscribe((data) =>\n  console.log(data)\n);\n\ndisposable.dispose();\n```\n\n## API\n\n- `fetcher(params)`: The default exported value, `fetcher`, is a function that\n  simply wraps the `fetch` api. You should call fetcher just as if you were\n  calling fetch. The only known limitation that we know of right now is that if\n  you call fetcher with the first parameter being\n  a [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object,\n  fetcher will not be able to do its auth token refreshes for you if a 401 http\n  status is returned for the server.\n- `fetchAsObservable(params)`: _Returns an RxJS 6 Observable._ Takes almost the\n  exact same params as `fetcher` but returns an RxJS 6 observable rather than a\n  promise. If `response.ok`, it will by default automatically try to return JSON\n  with a fallback of text. To modify the default return behavior, you can\n  including an optional `responseType` (ex. `responseType: 'blob'`) in the\n  second argument's object to explicitly specify the fetch response body\n  operation (i.e. `.json()`, `.text()`, `.blob()`, etc.).\n- `onPusher(message-type)`: Subscribe to server push events. Unsubscribe by\n  disposing the subscriptions. The returned observable is deferred.\n- `fetchWithSharedCache(url, subscriptionDuration, forceBust)`: This function\n  takes in the string `url`, a string or function `subscriptionDuration`, and an\n  optional boolean `forceBust`. It will either make a network request or return\n  the cached object, depending on if the cache already has the object for that\n  URL. Here are some things to note:\n  - This API returns an Observable. Please make sure\n    to [`dispose()`](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/gettingstarted/creating.md)\n    your subscription to the observable when you are done with it\n  - The value given is not a `Response` object, but a json object. This is\n    different than when you do `fetcher(url).then(response => ...)`, which\n    indeed gives you a Response object.\n  - The `subscriptionDuration` parameter is either a string (recommended) or a\n    function. Whenever a hashchange event fires, fetcher will check to see if\n    the subscriptionDuration has finished. It will check this for all\n    subscriptions\n    to the same `url` and if **any** of them says that the duration has ended,\n    then it will bust the cache and call `onCompleted` on the observable which\n    will end **all** of the subscriptions for that url. The reasoning for this\n    is that\n    the supported use case is subscribing to a data source as long as a\n    certain SPA route is active, and then not caring about updates to the data\n    once that SPA route is no longer active.\n    - Usage as a string: as long as window.location.hash includes this\n      string, your subscription will stay alive.\n    - Usage as a function: your function will be called with no arguments.\n      Your subscription will stay alive until the function returns something\n      truthy.\n    - Usually the best time to bust the cache is when the user navigates\n      away from the part of the single-page-app that cares about the\n      specific url/restful-object. This is just the best practice for SPAs,\n      since the page is never refreshed and we want the object to be\n      re-fetched if users go away from part of the app and then come back\n      later.\n  - If anyone performs a PUT or PATCH to a url that has been cached, it is\n    assumed that the response to that PUT or PATCH is the _full_ object (the\n    same as if a GET had been performed). That assumption allows us to not\n    make another GET request immediately after a PUT or PATCH. Because of that\n    assumption, however, you have to be aware of if the RESTful url you are\n    hitting actually meets that assumption or not.\n  - This API tries to be smart about query params in urls and should work just\n    fine no matter what you do with query params.\n  - If anyone performs a plain old `fetcher` GET on a url that is cached, when\n    the response comes back it will automatically update the cache and its\n    subscribers.\n- `forceBustCache(url)`: This function will forcibly bust the cache for a URL,\n  and also trigger a re-fetch of the URL so that all subscribers to the cache\n  are notified of the new change. It returns a promise just the same as if you\n  had done `fetch(url)`.\n- `bustCacheForSubscriptionDuration(subscriptionDuration, [refetchCachedUrls = false])`:\n  Will bust the cache for all `subscriptionDuration` key/url hash that `===`what\n  you pass in. By default, it will notify all observers that the observable\n  returned from fetchWithSharedCache is completed., but optionally you can\n  make `refetchCachedUrls = true` to have all subjects refetch their data and\n  update the cache instead of being removed.\n\n  Note: will only work for `subscriptionDurations` that are `typeof string`.\n  Also see `fetchWithSharedCache`'s `subscriptionDuration` for more info\n\n- `fetchWithProgress(url, options)`: This function uses XMLHttpRequest to call\n  an API so that the progress of the API request can be tracked. It returns\n  an [ConnectableObservable](http://reactivex.io/documentation/operators/connect.html)\n  that will produce\n  a stream\n  of [ProgressEvent](https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent)\n  objects, except the last value is the response data the server responds with.\n  The ProgressEvent objects are also modified to include an `overallProgress`\n  property,\n  which is a number between 0 and 1 which approximates what percentage of the\n  overall user wait time has occurred. Note that since it is a\n  ConnectableObservable, you have to call `connect()` on it after you subscribe.\n  The `fetchWithProgress` function takes two arguments: a string `url` and an\n  object `options`. The following properties are supported in options:\n  - `method` (required): a string for the HTTP method of the request\n  - `headers` (optional): an object where the keys are header names and the\n    values are header values.\n  - `body` (optional): Something that you can call xhr.send(body). This is\n    usually a string\n    or [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData)\n    object.\n    The FormData object is useful when you want to upload files.\n  - `baseServerLatency` (optional): A number of milliseconds to use when\n    approximating the `overallProgress` of the api request. This number\n    represents how long it takes on\n    average for the server to handle a _small_ request. For example, file\n    uploads incur a set amount of latency on the server even when the file\n    size is very small.\n    `baseServerLatency` defaults to 1500 ms, which seems about right for file\n    uploads.\n\n## Examples\n\n```js\nfetchWithSharedCache(\n  `https://workflow.canopytax.com/api/clients/1`,\n  `clients/1`\n).subscribe((json) => {\n  console.log(`Client name is ${json.clients.name}`);\n});\n\nfetchWithSharedCache(`https://workflow.canopytax.com/api/clients/1`, () => {\n  const pleaseEndMySubscription = true;\n  return pleaseEndMySubscription;\n}).subscribe((json) => {\n  console.log(`Client name is ${json.clients.name}`);\n});\n```\n\n## redirectOrCatch()\n\nredirectOrCatch() is a shortcut for asyncStacktrace -> check for 403/404 and\nmaybe redirect -> else catchSyncStacktrace.\nIt checks the request error for 404/403, logs to console the failure, and\nredirect the user to relevant 404/403 page\n\n```jsx\nimport {redirectOrCatch} from 'fetcher!sofe';\n\nuseEffect(() => {\n  const sub = getContact().subscribe(\n    successFunction(),\n    asyncStacktrace(err => {\n      if (err.status === 404 || err.status === 403) {\n        console.info(`api/contact returned ${err.status}, redirecting`);\n        window.history.replaceState(null, \"\", `/#/${err.status}`);\n      } else catchSyncStacktrace(err);\n    }\n  )\n  return () => sub.unsubscribe()\n}, [])\n\n// becomes\n\nuseEffect(() => {\n  const sub = getContact().subscribe(\n    successFunction(),\n    redirectOrCatch()\n  )\n  return () => sub.unsubscribe()\n}, [])\n```\n","readmeFilename":"README.md"}