{"_id":"@abcnews/capi-fetch","_rev":"12-88bec5171072c3000f02d12e433dfeee","name":"@abcnews/capi-fetch","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@abcnews/capi-fetch","version":"1.0.0","description":"Grab a Core Media document object from the Preview / Live Content API, based on current execution domain","license":"MIT","contributors":[{"name":"Colin Gourlay","email":"Gourlay.Colin@abc.net.au"}],"repository":{"type":"git","url":"git+https://github.com/abcnews/capi-fetch.git"},"main":"dist/capi-fetch.js","module":"dist/capi-fetch.mjs","scripts":{"start":"http-server example --silent & npm run watch","watch":"microbundle watch --format umd --entry example/src/index.js --external none --output example/dist/bundle.js -c-1","build":"microbundle --format cjs,es --sourcemap false","prepare":"npm run build"},"devDependencies":{"http-server":"^0.11.1","microbundle":"^0.9.0"},"dependencies":{"xhr":"^2.5.0"},"gitHead":"571a4c97f5e668b3b05f7c585e182d63d1ebd9ce","bugs":{"url":"https://github.com/abcnews/capi-fetch/issues"},"homepage":"https://github.com/abcnews/capi-fetch#readme","_id":"@abcnews/capi-fetch@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.11.4","_npmUser":{"name":"colingourlay","email":"colin@colin-gourlay.com"},"dist":{"integrity":"sha512-foL3KYewRZcyJu4VB+W7ivr+wWDGgnoC4Zc9u4SozFKXYD2aBXrw11RudL2MKpm0tZ1EfjY6hRhn2KNVGY9BtA==","shasum":"5a3dd277542fabf8a532d61e680a67caa5b2d12e","tarball":"https://registry.npmjs.org/@abcnews/capi-fetch/-/capi-fetch-1.0.0.tgz","fileCount":5,"unpackedSize":4535,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcR82PCRA9TVsSAnZWagAAX54QAKEv9s2Xv9Pqc0T/K+ja\nvR6fZ27TVx3MbnKgngk/b4v9CVZNYd/wasTBJ2kJQzDSqtnoef8Zl5ifv1lh\naj7lPrvGCAIqTjo1193US7EDuJdU55ZhEInDWy/GtWcB0EMP4z9+FH8UPDHr\nZr/W4/irk6ho4wbbELZ4MC3hPo/AaKL1QuzT076G88F+tXJS6EYNFv1cwPZS\n70eDypzRanDdRUt5gP6ucLYRa9xOuaXwwJ8scdrthHJDOk/Dlmgs/17yvo2e\nFbnAEenVvXKIQxaADKjLD7745Mfn0HzxUKphIP+TZhSBk7cqiWkgI/tWLkfR\nl+zLEEe7kdVkV0J6TsoDv3QD5fi8+Cb/U8AYjriIxBPdJ5mIysUrWaRA4aA1\ngGM1M02uCeNyhVfOFj0M++3l39dxyk5nNUjleeTdS+V3s26hKvKFEXxK+BuI\ne0h7rlCHUmqDI0/oCYrEqzFLfuu/D3SGN9gxk82XLz+QVpdBnsSep97UdH43\nutwmM/yrfkvK0y3BLtJuVszqeDY8pn+ZsL/sspm3zf2sSoZDLODI3M9gt840\naX9Z7ZLQRTMbQWoaqwMw7mHzBynbMEqkvwxY8sTkGRmRwJucvB6LK2l7adGz\nYS2Cu0B41cMVSD4EdaQ9wJhr3zvpPLRjYsuqo+gprEDo2DBpSf4s+nJtA8ya\nK3FC\r\n=4HBq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7QsrBiU7BY2lrXJv1pzdnA8wwzQUf3jlZjweGV9sTgAIgJe6Tp0Ybm9moW8shBQrwPG0CzthvmesRvlK5yjXTWHI="}]},"maintainers":[{"name":"phocks","email":"phocks@gmail.com"},{"name":"drzax","email":"simon@elvery.net"},{"name":"colingourlay","email":"colin@colin-gourlay.com"},{"name":"joshduck","email":"npm@joshduck.com"},{"name":"blakebutcher","email":"blake.butcher@abc.net.au"},{"name":"louisstow","email":"louisstow@gmail.com"},{"name":"nathanhoad","email":"nathan@nathanhoad.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capi-fetch_1.0.0_1548209550865_0.052642118192318677"},"_hasShrinkwrap":false},"1.1.0":{"name":"@abcnews/capi-fetch","version":"1.1.0","description":"Grab a Core Media document object from the Preview / Live Content API, based on the current execution domain","license":"MIT","contributors":[{"name":"Colin Gourlay","email":"Gourlay.Colin@abc.net.au"}],"repository":{"type":"git","url":"git+https://github.com/abcnews/capi-fetch.git"},"main":"dist/capi-fetch.js","module":"dist/capi-fetch.mjs","source":"src/index.ts","scripts":{"start":"http-server example --silent & npm run watch","watch":"microbundle watch --entry example/src/index.ts --output example/dist/bundle.js --format umd","build":"microbundle --format cjs,es --no-sourcemap","prepare":"npm run build"},"devDependencies":{"http-server":"^0.11.1","microbundle":"^0.9.0"},"gitHead":"1a1c1cff3a49e7627e71e36e487af8efd126096b","bugs":{"url":"https://github.com/abcnews/capi-fetch/issues"},"homepage":"https://github.com/abcnews/capi-fetch#readme","_id":"@abcnews/capi-fetch@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"8.11.4","_npmUser":{"name":"colingourlay","email":"colin@colin-gourlay.com"},"dist":{"integrity":"sha512-al0/WCFHEk/F1Qw/w6doKMMBdwa5tCAKWKVknHvuBtGD9wS9Ukc2Mu7rvodal9jGFz9NV5bepZ0W0aYvvcUNww==","shasum":"6b7894050a465318e1074f4da3533cfdeadf8a65","tarball":"https://registry.npmjs.org/@abcnews/capi-fetch/-/capi-fetch-1.1.0.tgz","fileCount":5,"unpackedSize":5068,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcSALjCRA9TVsSAnZWagAADygP+gLaaSyE6saGBJaUaMEm\nnptQGl7kUbu1D+0tFcPKT9voc32hx1GCOSp7HVO1zMl5ZZMP6OrgEBhwUHKp\nZz+I5QMltX44ChI8K2cxpj85M2QqKPnNJeypgmBt8QKR3naGgRIG/HpHyYJr\njdMWL6SClCSeuh0Vp0CIIbLeN1lhKtiz6CKENvJ48nnPIW4KVrxO5oFvgI49\nUzjC+VXtnGi2jnu6LwrnvXXs5GMi7H7vKtIqa5nl7wKv5v166aXwv0QgVlVD\n75oAvjhTcZOIr72smbHCfjRWEkE7XSjfwrQq0L+1bLQPHsiv99McgesCEvVn\nsNSVCfa4ftFQnA2xqHDmSwknLCNffxSdxTpE+JHrHP/fQQ2N8AS3KKNpqwkq\nRllPkhGKYu7ChipuSHzztCkmrNfp7iVUxQ/OjZiwldpImlXQPvkWqX3kKnr4\nfbtSCAzzvPcEOXHBHMOZk4UkoKDfmKKW6Qq2aSeHns4t/HT5MZCzv1TxXibs\n4AavDJGlzs6JYlheCq0cTXw2J3qCaObUfE8l7KOcMsW1VKwTTEQkzyUWXKja\nRufMZNo49cZjIT+3HNcQ9LcvoVsBHc4+cL6+yj7CDG+H3WBgVXAcPiPQ5EXF\nk9C7wzTIVLxVIY+dhoCrez/BSSFn0S+zm1SlB8wdhlZdXwUkUmZxDIibXZwS\noVyU\r\n=FsBJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDjMAvcuLVb52fpLuQeaFBIC/m/anXGAuYSAjtIjfJqXAiEAkQfFq3+6NqOkGRhf2+QEiSvO5YP3Sdw1PWCp+Ek6nbI="}]},"maintainers":[{"name":"blakebutcher","email":"blake.butcher@abc.net.au"},{"name":"colingourlay","email":"colin@colin-gourlay.com"},{"name":"drzax","email":"simon@elvery.net"},{"name":"joshduck","email":"npm@joshduck.com"},{"name":"louisstow","email":"louisstow@gmail.com"},{"name":"nathanhoad","email":"nathan@nathanhoad.net"},{"name":"phocks","email":"phocks@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capi-fetch_1.1.0_1548223202900_0.271465601401929"},"_hasShrinkwrap":false},"1.2.0":{"name":"@abcnews/capi-fetch","version":"1.2.0","description":"Grab a Core Media document object from the Preview / Live Content API, based on the current execution domain","license":"MIT","contributors":[{"name":"Colin Gourlay","email":"Gourlay.Colin@abc.net.au"}],"repository":{"type":"git","url":"git+https://github.com/abcnews/capi-fetch.git"},"main":"dist/capi-fetch.js","module":"dist/capi-fetch.mjs","source":"src/index.ts","scripts":{"start":"http-server example --silent & npm run watch","watch":"microbundle watch --entry example/src/index.ts --output example/dist/bundle.js --format umd","build":"microbundle --format cjs,es --no-sourcemap","prepare":"npm run build"},"devDependencies":{"http-server":"^0.11.1","microbundle":"^0.9.0"},"gitHead":"40ac1a0e62265075c30d9dfbb9d6c3b250b14465","bugs":{"url":"https://github.com/abcnews/capi-fetch/issues"},"homepage":"https://github.com/abcnews/capi-fetch#readme","_id":"@abcnews/capi-fetch@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"8.11.4","_npmUser":{"name":"colingourlay","email":"colin@colin-gourlay.com"},"dist":{"integrity":"sha512-gTwQzKi63aW9XzZ+YBlwLi4ZKMVqm+ijlfZ3CzPSKaHJQeY/cyEECqBLYUESTHLyXqe3J0q/Hu8P67COc8QWjA==","shasum":"c52b563fd3a125c145b815218d460f14388b748a","tarball":"https://registry.npmjs.org/@abcnews/capi-fetch/-/capi-fetch-1.2.0.tgz","fileCount":5,"unpackedSize":5118,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcSV5lCRA9TVsSAnZWagAAE+EQAJeQM+YQRpvrBh6vN5HG\nTiVf1TgttQAnKAgsMjIo4gyE4NItYD/eCLDiozbPRp8YHTYp5K8q0WRAR5iw\n1dekzHlbKuRShAuIaDbJDOruwYXP9WnjajkhOo5qiwPyxDnPVnGiWOs9WDwG\nTdspf918ht0QURv94HBo8sMqNXrpzgLr/ths3RItFxQE28eGl60fzlUFdasi\n4v1ZGZeT4TqDgZDK60HknH3drw83fnYCCJtEp0j6TZFRwR9T5RRWK4SU55p0\ne/R7P5Jf6a/VugpKa/YTpxnnZOuwEnixGF7CY6lZpTiBI1h404SPbabym+Qm\nrKNxwezMPEl4ivdjYHLF05xM9BWTIGL1UfV8GazY2I6v45gZLOWGynEyX8Uo\nQDEkCFTRTae5saQPbMIdn/dOwcQ28Uu5I3dybDiQA2S/x5vP8YrLnqO6oq3g\nbEV/3Azw3WAIjXFgQm+9HJhUHJTm2+lMdSmM2bpDC9k7u+5+3CRnx8Xwm1BP\nkSQEpT905ClZ7+ec/E2bbHYw8JCmh7aQb4jXw6naWE9fmj6qkW5TDtnRnYaE\nuGvTIkrHfTD7PIa50/sXMFvFpo6rj1e2u69Pxq6ugyM3pkZ5ClzW/Zg0PhJk\nk8dfvZw8aDkqctGhqcIXzFGeN5sa5Rjg+DpnIZXHTbcjfVXW0xVYyirH2GQD\n3CKk\r\n=GQcV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHD6XeJPEzJurhF3A4VNu6pzKrK3OqJZpzUeF8bP2GTVAiEA0LKi1cl0kUWG/akaT4LcsbjregwE7grRfnFabIPfcqo="}]},"maintainers":[{"name":"blakebutcher","email":"blake.butcher@abc.net.au"},{"name":"colingourlay","email":"colin@colin-gourlay.com"},{"name":"drzax","email":"simon@elvery.net"},{"name":"joshduck","email":"npm@joshduck.com"},{"name":"louisstow","email":"louisstow@gmail.com"},{"name":"nathanhoad","email":"nathan@nathanhoad.net"},{"name":"phocks","email":"phocks@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capi-fetch_1.2.0_1548312165008_0.15548586433132794"},"_hasShrinkwrap":false},"1.3.0":{"name":"@abcnews/capi-fetch","version":"1.3.0","description":"Grab a Core Media document object from the Preview / Live Content API, based on the current execution domain","license":"MIT","contributors":[{"name":"Colin Gourlay","email":"Gourlay.Colin@abc.net.au"}],"repository":{"type":"git","url":"git+https://github.com/abcnews/capi-fetch.git"},"main":"dist/capi-fetch.js","module":"dist/capi-fetch.mjs","source":"src/index.ts","scripts":{"start":"http-server example --silent & npm run watch","watch":"microbundle watch --entry example/src/index.ts --output example/dist/bundle.js --format umd","build":"microbundle --format cjs,es --no-sourcemap","prepare":"npm run build"},"devDependencies":{"http-server":"^0.11.1","microbundle":"^0.9.0"},"gitHead":"5d916115c231e6409c13ff483b826ffcc7c018a5","bugs":{"url":"https://github.com/abcnews/capi-fetch/issues"},"homepage":"https://github.com/abcnews/capi-fetch#readme","_id":"@abcnews/capi-fetch@1.3.0","_npmVersion":"6.4.1","_nodeVersion":"8.11.4","_npmUser":{"name":"colingourlay","email":"colin@colin-gourlay.com"},"dist":{"integrity":"sha512-uJF74S/srSJ99aMLBzzHFOr8pbffOOoNXsuvMY2VPqNezTLdHL9m9f1frqG9vaO9jW2s2yVE2pClAZ3eVMkVSg==","shasum":"9efaa1f1457780a7e7a9c7ec78783f904014e13a","tarball":"https://registry.npmjs.org/@abcnews/capi-fetch/-/capi-fetch-1.3.0.tgz","fileCount":5,"unpackedSize":5164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcU6z7CRA9TVsSAnZWagAAhG4P/AiqAIoATm5wbrxGF2ac\nG92qnNLC93mOxPCn1OrTkE4uSToqlxycfO04ODkZ3rMVv94jFSVj49EfViSV\nXwWNPuVQW+PIB6MCIaoj1L2HtQZDUGWuZJs9gB+cAnADkgwOHG+LNb2Y9rGW\nrVroBh880P3rT7DKM3v79VI+KXZ7SaNuxi7Szj/DGG+f6VuyNLAEgKZY9c43\nOOMwOu4kziFEVhsxRI38T0wT6QTHVOv+bMYWFyn29E0Zrdj5iNVeyKomAMWM\nqJa96xPfrbzdX7Mmkx0+/eKg8FVDQlFZ5hkUsfxo73UasI/wcimUHdgUU/Km\n+Aw8JV6nVah+DRig/TJFWi64d+4TeiwMbbv/DZuewc2LVlDNO/z6ktVjE5kB\nVS7RxyBxxhucRytfZ+dvuHiLgJf4h+XRJrWt9JUlP6QwrmHu9Yj8aQIvDP5o\ngWTiboUnawarSVdcmirOiLFTQfYZN3PLuZinCC3ZjhoknbV2K8L65cJvfQq4\nrC5F4j9KdZ+Dr22jkpYCeRlDNVPQSIxxJ0RorFAPyUb7qK4VdgJH252GccsO\n8KgPND1AyXAylLj3SLvlVbgBlAxt4AQH8ykJUtkISn3YG5pJbCZ827lPPblx\nyyS9rCmI8BmHTUxXOzY5EYsoUWBbCJ8jciMc/Zcfez/2jyRuoLih29/i+OF/\nmaO8\r\n=ubGs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBRZUu+8JEU8aoF7r10K1eyeV9JQBd5xdMKxTlpO1wO9AiEAtotnWB93OxMJ2BthTnQKq6ynIrWQUvVosU/g8MN89bw="}]},"maintainers":[{"name":"blakebutcher","email":"blake.butcher@abc.net.au"},{"name":"colingourlay","email":"colin@colin-gourlay.com"},{"name":"drzax","email":"simon@elvery.net"},{"name":"joshduck","email":"npm@joshduck.com"},{"name":"louisstow","email":"louisstow@gmail.com"},{"name":"nathanhoad","email":"nathan@nathanhoad.net"},{"name":"phocks","email":"phocks@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capi-fetch_1.3.0_1548987643035_0.8447188548647386"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-23T02:12:30.723Z","1.0.0":"2019-01-23T02:12:31.047Z","modified":"2023-08-10T04:59:26.890Z","1.1.0":"2019-01-23T06:00:02.986Z","1.2.0":"2019-01-24T06:42:45.172Z","1.3.0":"2019-02-01T02:20:43.173Z"},"maintainers":[{"email":"ash@kyd.com.au","name":"ashkyd"},{"email":"hi@jtfell.com","name":"jtfell"},{"email":"phocks@gmail.com","name":"phocks"},{"email":"andy@andrewkesper.com","name":"andrewkesper"},{"email":"simon@elvery.net","name":"drzax"}],"description":"Grab a Core Media document object from the Preview / Live Content API, based on the current execution domain","homepage":"https://github.com/abcnews/capi-fetch#readme","repository":{"type":"git","url":"git+https://github.com/abcnews/capi-fetch.git"},"contributors":[{"name":"Colin Gourlay","email":"Gourlay.Colin@abc.net.au"}],"bugs":{"url":"https://github.com/abcnews/capi-fetch/issues"},"license":"MIT","readme":"# @abcnews/capi-fetch\n\nGrab a Core Media document object from the Preview / Live Content API, based on the current execution domain\n\n```sh\n$ npm i @abcnews/capi-fetch\n```\n\n## Usage\n\n```js\nimport capiFetch from '@abcnews/capi-fetch';\n\ncapiFetch(10736062, (err, doc) => {\n  if (!err) {\n    console.log(doc);\n    // > {executionTime: \"367 ms\", id: 10736062, docType: \"Article\", ...}\n  }\n});\n```\n\nIf your project's JS is currently executing in a page on `nucwed.aus.aunty.abc.net.au`, requests will be made to Preview CAPI (`http://nucwed.aus.aunty.abc.net.au/api/v2/*`), otherwise they'll be made to Live CAPI (`https://content-gateway.abc-prod.net.au/api/v2/*`).\n\nIf you want to direct a single request to Live CAPI, regardless of the current execution domain, pass `true` as a 3rd argument to `capiFetch`.\n\n### API\n\n```ts\ndeclare function capiFetch(\n  cmid: string | number,\n  done: (err?: ProgressEvent | Error, doc?: Object) => void,\n  forceLive?: boolean,\n  forcePreview?: boolean\n): void;\n```\n\n## Developing\n\nTo run the `/example` project, you need to pretend your local machine is `www.abc.net.au` to work around cross-domain request limitations on the Content APIs...\n\n1. Add this to your hosts file:\n\n```\n127.0.0.1 mock.www.abc.net.au\n127.0.0.1 mock.nucwed.aus.aunty.abc.net.au\n```\n\n2. Start the development server: `$ npm start`\n3. Open [mock.nucwed.aus.aunty.abc.net.au:8080](http://mock.nucwed.aus.aunty.abc.net.au:8080) or [mock.www.abc.net.au:8080](http://mock.www.abc.net.au:8080)\n4. Restore your hosts file when you're finished\n\nThe best way to check that the Preview / Live switching works is to use this module inside a project hosted on `*.abc.net.au`.\n\nFor testing purposes, you can direct all requests to Live CAPI by appending `?prod=1` to your current page URL.\n\n## Authors\n\n- Colin Gourlay ([Gourlay.Colin@abc.net.au](mailto:Gourlay.Colin@abc.net.au))\n","readmeFilename":"README.md"}