{"_id":"@bitphinix/fetch-multipart-graphql","_rev":"3-69636ce5a76da20f14047c282e2fc346","name":"@bitphinix/fetch-multipart-graphql","dist-tags":{"latest":"3.2.4"},"versions":{"3.2.2":{"name":"@bitphinix/fetch-multipart-graphql","version":"3.2.2","author":{"name":"Rob Richard","email":"rob@robrichard.net"},"license":"MIT","_id":"@bitphinix/fetch-multipart-graphql@3.2.2","maintainers":[{"name":"bitphinix","email":"ericmeier@protonmail.com"}],"homepage":"https://github.com/relay-tools/fetch-multipart-graphql#readme","bugs":{"url":"https://github.com/relay-tools/fetch-multipart-graphql/issues"},"dist":{"shasum":"036b808da708b23e9541f9976aab6f5a37657551","tarball":"https://registry.npmjs.org/@bitphinix/fetch-multipart-graphql/-/fetch-multipart-graphql-3.2.2.tgz","fileCount":22,"integrity":"sha512-3UZQs4U3/915LHCs1dtBSaIhMowlkObIl30LEJtkXEy66w0ju1mDVBli4cYu/x74BHySBZckNIIS+hptdbqRSw==","signatures":[{"sig":"MEYCIQD0f4JMishTnlDJqmkfMVkqYqWevrGAkj436UNlmeuQGgIhANyPWxm/gge6x6G6KKE1pM8ck8HHIm6wVcHUABmoSUGw","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43455},"jest":{"testEnvironment":"node","testPathIgnorePatterns":["/node_modules/","/dist/"]},"main":"dist/index.js","types":"./typings.d.ts","gitHead":"9aaa9581b798f6a1b7396e6a4844f125dda8d21b","scripts":{"test":"jest","build":"babel src --out-dir dist --ignore '**/*.spec.js'","prepublishOnly":"yarn run build"},"_npmUser":{"name":"bitphinix","email":"ericmeier@protonmail.com"},"repository":{"url":"git+ssh://git@github.com/relay-tools/fetch-multipart-graphql.git","type":"git"},"_npmVersion":"10.5.2","description":"Cross browser function to fetch and parse streaming multipart graphql responses.","directories":{},"_nodeVersion":"20.13.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.4 ","@babel/cli":"^7.12.1","@babel/preset-env":"^7.12.1"},"_npmOperationalInternal":{"tmp":"tmp/fetch-multipart-graphql_3.2.2_1742516643246_0.0934419305915537","host":"s3://npm-registry-packages-npm-production"}},"3.2.3":{"name":"@bitphinix/fetch-multipart-graphql","version":"3.2.3","author":{"name":"Rob Richard","email":"rob@robrichard.net"},"license":"MIT","_id":"@bitphinix/fetch-multipart-graphql@3.2.3","maintainers":[{"name":"bitphinix","email":"ericmeier@protonmail.com"}],"homepage":"https://github.com/relay-tools/fetch-multipart-graphql#readme","bugs":{"url":"https://github.com/relay-tools/fetch-multipart-graphql/issues"},"dist":{"shasum":"a2095a0210eb9d76187d13a6f22f88f70c771f88","tarball":"https://registry.npmjs.org/@bitphinix/fetch-multipart-graphql/-/fetch-multipart-graphql-3.2.3.tgz","fileCount":21,"integrity":"sha512-7Now3yxy5bTIYGsQQg9rK2PdFU5639vDiOYII1y/SB0+LdhDKE6i/T+lOZgt9tGS4Ho8hDAh0ZvDiKo4LSD/OA==","signatures":[{"sig":"MEUCIAaDTaa5bVdSe8COBNWQldY8JyZbZuWF9F/qf6NSHE86AiEAqcVAhe8wxzs7vGU04exHV/Abbzqs0ukUcUf99oozlRo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41014},"jest":{"testEnvironment":"node","testPathIgnorePatterns":["/node_modules/","/dist/"]},"main":"dist/index.js","types":"./typings.d.ts","gitHead":"9aaa9581b798f6a1b7396e6a4844f125dda8d21b","scripts":{"test":"jest","build":"babel src --out-dir dist --ignore '**/*.spec.js'","prepublishOnly":"yarn run build"},"_npmUser":{"name":"bitphinix","email":"ericmeier@protonmail.com"},"repository":{"url":"git+ssh://git@github.com/relay-tools/fetch-multipart-graphql.git","type":"git"},"_npmVersion":"10.5.2","description":"Cross browser function to fetch and parse streaming multipart graphql responses.","directories":{},"_nodeVersion":"20.13.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.0.4 ","@babel/cli":"^7.12.1","@babel/preset-env":"^7.12.1"},"_npmOperationalInternal":{"tmp":"tmp/fetch-multipart-graphql_3.2.3_1742516913336_0.650526661929586","host":"s3://npm-registry-packages-npm-production"}},"3.2.4":{"name":"@bitphinix/fetch-multipart-graphql","version":"3.2.4","description":"Cross browser function to fetch and parse streaming multipart graphql responses.","main":"dist/index.js","types":"./typings.d.ts","repository":{"type":"git","url":"git+ssh://git@github.com/relay-tools/fetch-multipart-graphql.git"},"author":{"name":"Rob Richard","email":"rob@robrichard.net"},"license":"MIT","scripts":{"test":"jest","build":"babel src --out-dir dist --ignore '**/*.spec.js'","prepublishOnly":"yarn run build"},"jest":{"testPathIgnorePatterns":["/node_modules/","/dist/"],"testEnvironment":"node"},"devDependencies":{"@babel/cli":"^7.12.1","@babel/preset-env":"^7.12.1","jest":"^27.0.4 "},"dependencies":{},"_id":"@bitphinix/fetch-multipart-graphql@3.2.4","gitHead":"9aaa9581b798f6a1b7396e6a4844f125dda8d21b","bugs":{"url":"https://github.com/relay-tools/fetch-multipart-graphql/issues"},"homepage":"https://github.com/relay-tools/fetch-multipart-graphql#readme","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-MLzXbEmOVWZMmAo3CGvKjQpxLN9BPuaBEJNXkYGT6vYUZPmKT0ngKyPSbBjF+6hrQ/7B4hEjAJlqOk1av3icfA==","shasum":"9f969210291712045ab20ef2d791f4d9faa72d36","tarball":"https://registry.npmjs.org/@bitphinix/fetch-multipart-graphql/-/fetch-multipart-graphql-3.2.4.tgz","fileCount":21,"unpackedSize":41020,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCJJvX8gwQe24JQ8QTz7Vd48+XTqSdfmSRCaqmyD5px+QIgRmA1p9X3KmbBgux2VWGFgP6SMlQDVykSjU4rc9FSlBI="}]},"_npmUser":{"name":"bitphinix","email":"ericmeier@protonmail.com"},"directories":{},"maintainers":[{"name":"bitphinix","email":"ericmeier@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fetch-multipart-graphql_3.2.4_1742517213247_0.37041695029870936"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-21T00:24:03.138Z","modified":"2025-03-21T00:33:33.625Z","3.2.2":"2025-03-21T00:24:03.491Z","3.2.3":"2025-03-21T00:28:33.576Z","3.2.4":"2025-03-21T00:33:33.457Z"},"bugs":{"url":"https://github.com/relay-tools/fetch-multipart-graphql/issues"},"author":{"name":"Rob Richard","email":"rob@robrichard.net"},"license":"MIT","homepage":"https://github.com/relay-tools/fetch-multipart-graphql#readme","repository":{"type":"git","url":"git+ssh://git@github.com/relay-tools/fetch-multipart-graphql.git"},"description":"Cross browser function to fetch and parse streaming multipart graphql responses.","maintainers":[{"name":"bitphinix","email":"ericmeier@protonmail.com"}],"readme":"# fetch-multipart-graphql\n\nCross-browser function to fetch and parse streaming multipart graphql responses.\n\nThis allows you to efficiently fetch streamed GraphQL responses that use the @defer directive as supported by [Apollo Server](https://blog.apollographql.com/introducing-defer-in-apollo-server-f6797c4e9d6e). It can be easily used in a Relay Modern network layer to support deferred queries.\n\n## Usage\n\nIn a Relay Network Layer:\n\n```javascript\nimport fetchMultipart from 'fetch-multipart-graphql';\nimport { Observable } from 'relay-runtime';\n\nfunction fetchQuery(operation, variables) {\n    return Observable.create(sink => {\n        fetchMultipart('/graphql', {\n            method: 'POST',\n            headers: {\n                'content-type': 'application/json',\n            },\n            body: JSON.stringify({\n                query: operation.text,\n                variables,\n            }),\n            credentials: 'same-origin',\n            onNext: parts => sink.next(parts),\n            onError: err => sink.error(err),\n            onComplete: () => sink.complete(),\n        });\n    });\n}\n```\n\n#### Handling cookies and other auth headers\n\nThe `credentials` param is passed to [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters). For XHR requests, [`XMLHttpRequest.withCredentials`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials) is mapped to true when `credentials: 'include'`.\n\n#### Handling additional request settings\n\nWhen `fetch` is not available requests are sent through XHR, which supports standard `method`, `headers`, `credentials` and `body` settings; as seen in the code example above. \nWhen requests are sent through `fetch` we can also set, in addition to the properties already mentioned, all the [options supported by fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options).\n\n## Browser Support\n\nTested in the latest Chrome, Firefox, Safari, Edge, and Internet Explorer 11. Requires a polyfill for TextEncoder/Decoder. Since only utf-8 encoding is required, it's recommended to use [text-encoding-utf-8](https://www.npmjs.com/package/text-encoding-utf-8) to minimize impact on bundle size.\n","readmeFilename":"README.md"}