Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-link-multipart

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-link-multipart - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

38

dist/index.js

@@ -42,4 +42,4 @@ 'use strict';

headers: {
accept: 'application/json, multipart/mixed',
...context.headers,
accept: 'application/json, multipart/mixed',
},

@@ -58,21 +58,21 @@ };

.then(async (parts) => {
if (parts[Symbol.asyncIterator] < 'u') {
if (isAsyncIterable(parts)) {
const cache = context.cache;
let first = true;
for await (const part of parts) {
if (!part.json)
throw new Error(`Expected part to be of json type but got:\n${part.headers}\n${part.body}`);
if (cache === undefined) {
observer.next(part);
// @ts-ignore
observer.next(part.body);
continue;
}
// TODO: Fix types
const payload = part.body;
if (first) {
observer.next({
data: part.data,
});
observer.next(payload);
first = false;
}
else {
const patch_data = nestie.nestie({
[part.path.join('.')]: part.data,
});
const original_data = cache.read({
const data = cache.read({
query: operation.query,

@@ -84,3 +84,6 @@ variables: operation.variables,

});
const new_result = deepmerge__default['default'](original_data, patch_data);
const patch_data = nestie.nestie({
[payload.path.join('.')]: payload.data,
});
const new_result = deepmerge__default['default'](data, patch_data);
cache.write({

@@ -92,5 +95,3 @@ result: new_result,

});
observer.next({
data: part.data,
});
observer.next(payload);
}

@@ -107,3 +108,12 @@ }

};
function isAsyncIterable(input) {
return (typeof input === 'object' &&
input !== null &&
// The AsyncGenerator check is for Safari on iOS which currently does not have
// Symbol.asyncIterator implemented
// That means every custom AsyncIterable must be built using a AsyncGeneratorFunction (async function * () {})
(input[Symbol.toStringTag] === 'AsyncGenerator' ||
(Symbol.asyncIterator && Symbol.asyncIterator in input)));
}
exports.createMultipartLink = createMultipartLink;
{
"name": "apollo-link-multipart",
"version": "0.0.2",
"version": "0.0.3",
"description": "An Apollo link for multipart responses",

@@ -37,3 +37,3 @@ "keywords": [

"prepublishOnly": "yarn build",
"test": "uvu -r ts-node/register tests",
"test": "uvu -r ts-node/register -i mocks tests",
"typecheck": "tsc --noEmit"

@@ -52,17 +52,17 @@ },

"deepmerge": "^4.2.2",
"meros": "^1.0.0-beta.4",
"meros": "^1.1.2",
"nestie": "^1.0.0"
},
"devDependencies": {
"@apollo/client": "^3.3.0-rc.0",
"@apollo/client": "3.3.9",
"@marais/tsconfig": "0.0.1",
"@rollup/plugin-node-resolve": "10.0.0",
"@types/node": "14.14.7",
"graphql": "^15.4.0",
"@rollup/plugin-node-resolve": "11.1.1",
"@types/node": "14.14.26",
"graphql": "^15.5.0",
"graphql-tag": "^2.11.0",
"prettier": "2.1.2",
"rollup": "2.33.1",
"prettier": "2.2.1",
"rollup": "2.38.5",
"rollup-plugin-typescript2": "0.29.0",
"ts-node": "^9.0.0",
"typescript": "4.0.5",
"ts-node": "9.1.1",
"typescript": "4.1.5",
"uvu": "0.4.1",

@@ -75,5 +75,5 @@ "zen-observable": "^0.8.15"

"volta": {
"node": "15.1.0",
"yarn": "1.22.5"
"node": "15.8.0",
"yarn": "1.22.10"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc