
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
@n1ru4l/graphql-live-query-patch-jsondiffpatch
Advanced tools
[](https://www.npmjs.com/package/@n1ru4l/graphql-live-query-patch-jsondiffpatch) [ @live {
post(id: $id) {
id
title
totalLikeCount
}
}
Initial result
{
"data": {
"post": {
"id": "1",
"title": "foo",
"totalLikeCount": 10
}
},
"revision": 1
}
Patch result (increase totalLikeCount)
{
"patch": {
"post": {
"totalLikeCount": [null, 11]
}
},
"revision": 2
}
yarn add -E @n1ru4l/graphql-live-query-patch-jsondiffpatch
applyLiveQueryJSONDiffPatchGenerator
Wrap a execute
result and apply a live query patch generator middleware.
import { execute } from "graphql";
import { applyLiveQueryJSONDiffPatchGenerator } from "@n1ru4l/graphql-live-query-patch-jsondiffpatch";
import { schema } from "./schema";
const result = applyLiveQueryJSONDiffPatchGenerator(
execute({
schema,
operationDocument: parse(/* GraphQL */ `
query todosQuery @live {
todos {
id
content
isComplete
}
}
`),
rootValue: rootValue,
contextValue: {},
variableValues: null,
operationName: "todosQuery",
})
);
applyLiveQueryJSONDiffPatch
Inflate the execution patch results on the client side.
import { applyLiveQueryJSONDiffPatch } from "@n1ru4l/graphql-live-query-patch-jsondiffpatch";
const asyncIterable = applyLiveQueryJSONDiffPatch(
// networkLayer.execute returns an AsyncIterable
networkLayer.execute({
operation: /* GraphQL */ `
query todosQuery @live {
todos {
id
content
isComplete
}
}
`,
})
);
AsyncIterators make composing async logic super easy. In case your GraphQL transport does not return a AsyncIterator you can use the @n1ru4l/push-pull-async-iterable-iterator
package for wrapping the result as a AsyncIterator.
import { applyLiveQueryJSONDiffPatch } from "@n1ru4l/graphql-live-query-patch-jsondiffpatch";
import { makeAsyncIterableIteratorFromSink } from "@n1ru4l/push-pull-async-iterable-iterator";
import { createClient } from "graphql-ws/lib/use/ws";
const client = createClient({
url: "ws://localhost:3000/graphql",
});
const asyncIterableIterator = makeAsyncIterableIteratorFromSink((sink) => {
const dispose = client.subscribe(
{
query: "query @live { hello }",
},
{
next: sink.next,
error: sink.error,
complete: sink.complete,
}
);
return () => dispose();
});
const wrappedAsyncIterableIterator = applyLiveQueryJSONDiffPatch(
asyncIterableIterator
);
for await (const value of asyncIterableIterator) {
console.log(value);
}
applyLiveQueryJSONDiffPatch
In most cases using createApplyLiveQueryPatchGenerator
is the best solution. However, some special implementations might need a more flexible and direct way of applying the patch middleware.
import { execute } from "graphql";
import { applyLiveQueryJSONDiffPatch } from "@n1ru4l/graphql-live-query-patch-jsondiffpatch";
import { schema } from "./schema";
execute({
schema,
operationDocument: parse(/* GraphQL */ `
query todosQuery @live {
todos {
id
content
isComplete
}
}
`),
rootValue: rootValue,
contextValue: {},
variableValues: null,
operationName: "todosQuery",
}).then(async (result) => {
if (isAsyncIterable(result)) {
for (const value of applyLiveQueryJSONDiffPatch(result)) {
console.log(value);
}
}
});
FAQs
[](https://www.npmjs.com/package/@n1ru4l/graphql-live-query-patch-jsondiffpatch) [![npm downloads](https://img.shields.io/npm/dm/@n1ru4l/graphql-live-query-patc
We found that @n1ru4l/graphql-live-query-patch-jsondiffpatch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.