Socket
Socket
Sign inDemoInstall

@xialvjun/tiny-graphql-client

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.7 to 0.0.8

2

es/index.js

@@ -29,3 +29,3 @@ var FRAGMENT_USE_REGEX = /\.{3}(\w+)/g;

if (!operationName) {
operationName = random_name();
operationName = 'op' + random_name();
}

@@ -32,0 +32,0 @@ query = query.replace(match[0], match[1] + " " + operationName + (match[3] === '(' ? '(' : ' {'));

@@ -31,3 +31,3 @@ "use strict";

if (!operationName) {
operationName = random_name();
operationName = 'op' + random_name();
}

@@ -34,0 +34,0 @@ query = query.replace(match[0], match[1] + " " + operationName + (match[3] === '(' ? '(' : ' {'));

{
"name": "@xialvjun/tiny-graphql-client",
"version": "0.0.7",
"version": "0.0.8",
"description":

@@ -5,0 +5,0 @@ "a tiny, simple and customable graphql client, only support `query` and `mutation` now.",

@@ -7,3 +7,3 @@ const FRAGMENT_USE_REGEX = /\.{3}(\w+)/g;

export function create_client<T>(send: (body: { operationName: string, query: string, variables?: any }, extra?: any) => T) {
export function create_client<T, E>(send: (body: { operationName: string, query: string, variables?: any }, extra?: E) => T) {
const fragments = {};

@@ -22,3 +22,3 @@ function detect_fragments(query: string, old_detected_fragments: string[]=[]) {

}
function run(query: string, variables?: any, extra?: any) {
function run(query: string, variables?: any, extra?: E) {
query = query.trim();

@@ -32,3 +32,3 @@ query = query.startsWith('{') ? `query ${query}` : query;

if (!operationName) {
operationName = random_name();
operationName = 'op'+random_name();
}

@@ -35,0 +35,0 @@ query = query.replace(match[0], `${match[1]} ${operationName}${match[3]==='(' ? '(' : ' {'}`);

@@ -1,9 +0,9 @@

export declare function create_client<T>(send: (body: {
export declare function create_client<T, E>(send: (body: {
operationName: string;
query: string;
variables?: any;
}, extra?: any) => T): {
run: (query: string, variables?: any, extra?: any) => T;
}, extra?: E) => T): {
run: (query: string, variables?: any, extra?: E) => T;
register_fragment: (fragment: string) => void;
fragments: {};
};
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc