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

@graphql-live/client

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-live/client - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

6

dist/createClient.d.ts

@@ -0,3 +1,4 @@

import { ManagerOptions, SocketOptions } from "socket.io-client";
import { ExecutionResult } from "graphql";
import { ManagerOptions, SocketOptions } from "socket.io-client";
import { Operation as PatchOperation } from "fast-json-patch";
export declare type ClientOptions = {

@@ -10,2 +11,3 @@ url?: string;

observer: ResultObserver;
latestResult: ExecutionResult;
execute(): void;

@@ -25,3 +27,3 @@ };

id: number;
result: ExecutionResult;
patch: Array<PatchOperation>;
isFinal?: boolean;

@@ -28,0 +30,0 @@ };

@@ -11,2 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { io } from "socket.io-client";
import { applyPatch } from "fast-json-patch";
export function createClient({ url, context, socketOptions } = {}) {

@@ -27,7 +28,9 @@ const socket = url ? io(url, socketOptions) : io(socketOptions);

};
const onOperationResult = ({ id, result, isFinal }) => {
const onOperationResult = ({ id, patch, isFinal }) => {
const record = operations.get(id);
if (!record)
return;
record.observer.next(result);
const previousResult = record.latestResult;
record.latestResult = applyPatch(previousResult, patch).newDocument;
record.observer.next(record.latestResult);
if (isFinal) {

@@ -51,2 +54,3 @@ operations.delete(id);

observer,
latestResult: {},
execute() {

@@ -53,0 +57,0 @@ return __awaiter(this, void 0, void 0, function* () {

{
"name": "@graphql-live/client",
"version": "0.1.2",
"version": "0.1.3",
"description": "The client part of the GraphQLive package",

@@ -37,2 +37,3 @@ "main": "dist/index.js",

"dependencies": {
"fast-json-patch": "^3.0.0-1",
"graphql": "^15.5.0",

@@ -39,0 +40,0 @@ "socket.io-client": "^4.0.0"

@@ -0,3 +1,4 @@

import { io, ManagerOptions, SocketOptions } from "socket.io-client";
import { ExecutionResult } from "graphql";
import { io, ManagerOptions, SocketOptions } from "socket.io-client";
import { applyPatch, Operation as PatchOperation } from "fast-json-patch";

@@ -12,2 +13,3 @@ export type ClientOptions = {

observer: ResultObserver;
latestResult: ExecutionResult;
execute(): void;

@@ -30,3 +32,3 @@ };

id: number;
result: ExecutionResult;
patch: Array<PatchOperation>;
isFinal?: boolean;

@@ -62,6 +64,8 @@ };

const onOperationResult = ({ id, result, isFinal }: ResultPayload) => {
const onOperationResult = ({ id, patch, isFinal }: ResultPayload) => {
const record = operations.get(id);
if (!record) return;
record.observer.next(result);
const previousResult = record.latestResult;
record.latestResult = applyPatch(previousResult, patch).newDocument;
record.observer.next(record.latestResult);
if (isFinal) {

@@ -88,2 +92,3 @@ operations.delete(id);

observer,
latestResult: {},
async execute() {

@@ -90,0 +95,0 @@ const payload: OperationPayload = {

Sorry, the diff of this file is not supported yet

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