{"_id":"falcor-http-datasource","_rev":"29-76d90433420edee68a8765e804f8fbe9","name":"falcor-http-datasource","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.1":{"name":"falcor-http-datasource","version":"0.1.1","keywords":["Falcor","Browser"],"author":{"url":"https://github.com/Netflix/falcor/authors.txt","name":"Netflix"},"license":"ALV2","_id":"falcor-http-datasource@0.1.1","maintainers":[{"name":"michael.paulson","email":"michael.b.paulson@gmail.com"}],"homepage":"https://github.com/Netflix/falcor-browser","bugs":{"url":"https://github.com/Netflix/falcor-browser/issues"},"dist":{"shasum":"68fb6917fb74fccec5ed30852dc455b028ac7ac0","tarball":"https://registry.npmjs.org/falcor-http-datasource/-/falcor-http-datasource-0.1.1.tgz","integrity":"sha512-O3wWrYWKCD/F6S+U1fiZH4L6SSIeF83g69Jv+CrmTIHMBx58L5V9ffeW8UwOYE7R5AaEr+ih9gcntD4V1jwqWg==","signatures":[{"sig":"MEYCIQCzNgg8G00R9dBt0qkhqam+3GmDyQMc80ikr+3XvEFdKQIhALeRcUOQpUOCQYj+mg98eHy/IWM0YuXtv6uet7Kwp4se","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"src/XMLHttpSource.js","_from":".","_shasum":"68fb6917fb74fccec5ed30852dc455b028ac7ac0","browser":{"./src/getXMLHttpRequest.js":"./src/getXMLHttpRequest.browser.js"},"gitHead":"e6d9bef715fa154084d19dbb036ee36759024f6a","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run build:min && npm run build:pretty","build:min":"browserify . | uglifyjs > ./dist/XMLHttpSource.min.js","build:pretty":"browserify ./src/XMLHttpSource.js > ./dist/XMLHttpSource.js"},"_npmUser":{"name":"michael.paulson","email":"michael.b.paulson@gmail.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0.html","type":"Apache License, Version 2.0"}],"repository":{"url":"git://github.com/Netflix/falcor-browser.git","type":"git"},"_npmVersion":"2.8.4","description":"This package contains falcor components for use in browsers.","directories":{},"_nodeVersion":"0.10.24","dependencies":{"xmlhttprequest":"^1.7.0"},"devDependencies":{"uglifyjs":"^2.4.10","browserify":"^11.0.0"}},"0.1.2":{"name":"falcor-http-datasource","version":"0.1.2","keywords":["Falcor","Browser"],"author":{"url":"https://github.com/Netflix/falcor/authors.txt","name":"Netflix"},"license":"ALV2","_id":"falcor-http-datasource@0.1.2","maintainers":[{"name":"michael.paulson","email":"michael.b.paulson@gmail.com"},{"name":"netflix","email":"aliu@netflix.com"},{"name":"satyend","email":"satyend@netflix.com"}],"homepage":"https://github.com/Netflix/falcor-browser","bugs":{"url":"https://github.com/Netflix/falcor-browser/issues"},"dist":{"shasum":"44ccc2d978f91b3259bd2875a394d77a769498e1","tarball":"https://registry.npmjs.org/falcor-http-datasource/-/falcor-http-datasource-0.1.2.tgz","integrity":"sha512-jxsjYKoO0MTrpi8JTHHZurm5rleM2ZoY2FtimP7nr6DFlwFFuVx+73xNF771Bwetoxy3V+DhJt4re5OCR4Ptrg==","signatures":[{"sig":"MEQCIFGWfC23p/RFKggwyNv23CFxpNYx3/kGKWfWnCTiYFSAAiAokHSs9fyaPhTzDlzitZTDNN1Vn7VD5BKx360ut2Ys9A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"src/XMLHttpSource.js","_from":".","_shasum":"44ccc2d978f91b3259bd2875a394d77a769498e1","browser":{"./src/getXMLHttpRequest.js":"./src/getXMLHttpRequest.browser.js"},"gitHead":"0d228ee3367c049835015ea4413edb96303c0695","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run build:min && npm run build:pretty","build:min":"browserify . | uglifyjs > ./dist/XMLHttpSource.min.js","build:pretty":"browserify ./src/XMLHttpSource.js > ./dist/XMLHttpSource.js"},"_npmUser":{"name":"satyend","email":"satyend@netflix.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0.html","type":"Apache License, Version 2.0"}],"repository":{"url":"git://github.com/Netflix/falcor-browser.git","type":"git"},"_npmVersion":"2.13.2","description":"This package contains falcor components for use in browsers.","directories":{},"_nodeVersion":"0.12.7","dependencies":{"xmlhttprequest":"^1.7.0"},"devDependencies":{"uglifyjs":"^2.4.10","browserify":"^11.0.0"}},"0.1.3":{"name":"falcor-http-datasource","version":"0.1.3","keywords":["Falcor","Browser"],"author":{"url":"https://github.com/Netflix/falcor/authors.txt","name":"Netflix"},"license":"ALV2","_id":"falcor-http-datasource@0.1.3","maintainers":[{"name":"michael.paulson","email":"michael.b.paulson@gmail.com"},{"name":"netflix","email":"aliu@netflix.com"},{"name":"satyend","email":"satyend@netflix.com"}],"homepage":"https://github.com/Netflix/falcor-http-datasource","bugs":{"url":"https://github.com/Netflix/falcor-http-datasource/issues"},"dist":{"shasum":"d4004950ae0944a81b6acb3d28a12e37165496cb","tarball":"https://registry.npmjs.org/falcor-http-datasource/-/falcor-http-datasource-0.1.3.tgz","integrity":"sha512-iqQP4IdO4My9O8WdeGBk+ADq6I1cfCTunjNVfHY1nkUGFzmBSJ4BPkMJoIjpIGWPO+xxBHpKY7RwY9RSAApIlg==","signatures":[{"sig":"MEYCIQD7XeQIoj25Mt82N+v/mWmTCBz0p+ZItc+/nR394SIy7AIhAM0asS0rA+M22TDxmAQXNJGouXmHyaHpi5pvLFuXfJwh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"src/XMLHttpSource.js","_from":".","_shasum":"d4004950ae0944a81b6acb3d28a12e37165496cb","browser":{"./src/getXMLHttpRequest.js":"./src/getXMLHttpRequest.browser.js"},"gitHead":"d85f4b4cca3166b0cfdee72acfce30568f3f344d","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"npm run build:min && npm run build:pretty","build:min":"browserify . | uglifyjs > ./dist/XMLHttpSource.min.js","build:pretty":"browserify ./src/XMLHttpSource.js > ./dist/XMLHttpSource.js"},"_npmUser":{"name":"michael.paulson","email":"michael.b.paulson@gmail.com"},"licenses":[{"url":"http://www.apache.org/licenses/LICENSE-2.0.html","type":"Apache License, Version 2.0"}],"repository":{"url":"git://github.com/Netflix/falcor-http-datasource.git","type":"git"},"_npmVersion":"3.3.12","description":"This package contains falcor components for use in browsers.","directories":{},"_nodeVersion":"5.1.1","dependencies":{"xmlhttprequest":"^1.7.0"},"devDependencies":{"uglifyjs":"^2.4.10","browserify":"^11.0.0"}}},"time":{"created":"2015-08-17T13:25:28.379Z","modified":"2025-11-26T16:39:46.631Z","0.1.1":"2015-08-17T13:25:28.379Z","0.1.2":"2015-09-05T01:09:41.025Z","0.1.3":"2016-01-29T15:26:55.273Z"},"bugs":{"url":"https://github.com/Netflix/falcor-http-datasource/issues"},"author":{"url":"https://github.com/Netflix/falcor/authors.txt","name":"Netflix"},"license":"ALV2","homepage":"https://github.com/Netflix/falcor-http-datasource","keywords":["Falcor","Browser"],"repository":{"url":"git://github.com/Netflix/falcor-http-datasource.git","type":"git"},"description":"This package contains falcor components for use in browsers.","maintainers":[{"email":"npm@netflix.com","name":"barb_the_builder"},{"email":"satyend@netflix.com","name":"satyend"}],"readme":"# HttpDataSource\n\nThis is a Falcor DataSource which can be used to retrieve JSON Graph information from an HTTP server.\n\n## Install\n```bash\nnpm install falcor-http-datasource\n```\n\n## Usage\n\nMinimalistic ES6 example, a quick dirty setup\n\n```es6\nimport falcor from 'falcor';\nimport HttpDataSource from 'falcor-http-datasource';\nimport user from 'app/models/user';\n\nvar model = new falcor.Model({\n  source: new HttpDataSource('/model.json')\n});\n```\nIf you need some additional info for your global HTTP requests consider something like\n\nJWT\n```javascript\nvar source = new HttpDataSource('/model.json', {\n  headers: {\n    'Authorization': `bearer ' + token`\n  }\n});\n```\nCookies\n```javascript\nvar source = new HttpDataSource('/model.json', {\n  withCredentials: true\n});\n// server must include the header `Access-Control-Allow-Credentials: true`\n```\nCORS\n```javascript\nvar source = new HttpDataSource('/model.json', {\n  crossDomain: true\n});\n```\nor you might want to pass it to constructor as your global AppSource\n\n```es6\n\nexport class AppSource extends HttpDataSource {\n  constructor(path, token) {\n    super(path, {\n      headers: {\n        'Authorization': `bearer ${ token }`\n      }\n      timeout: 20000\n    })\n  }\n\n  get(...args) {\n    // returns an Observable if you wanted to map/filter/reduce/etc\n    return super.get(...args)\n  }\n  set(...args) {\n    // returns an Observable if you wanted to map/filter/reduce/etc\n    return super.set(...args)\n  }\n  call(...args) {\n    // returns an Observable if you wanted to map/filter/reduce/etc\n    return super.call(...args)\n  }\n\n  onBeforeRequest(config) {\n    // as of now you're able to mutate the config object before we create our xhr instance\n    // you would attach any url params here\n    // config.url = config.url + '&something=Value'\n    console.log(config);\n  }\n  buildQueryObject(...args) {\n    // helper method to build our url for advanced implementations\n    return super.buildQueryObject(...args)\n  }\n}\n\nexport class FalcorModel extends falcor.Model {\n  constructor(cache) {\n    super({\n      cache: cache,\n      source: new AppSource('/model.json', user.token)\n    });\n  }\n}\n\n```\n","readmeFilename":"README.md","users":{"gdi2290":true}}