Socket
Socket
Sign inDemoInstall

@gqless/logger

Package Overview
Dependencies
3
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.5 to 2.0.6

9

CHANGELOG.md
# @gqless/logger
## 2.0.6
### Patch Changes
- 173e11d: add subscriptions to events
- Updated dependencies [173e11d]
- Updated dependencies [c613410]
- gqless@2.0.6
## 2.0.5

@@ -4,0 +13,0 @@

22

dist/gqless-logger.cjs.development.js

@@ -80,19 +80,23 @@ 'use strict';

cacheSnapshot,
type
type,
label
} = await dataPromise;
const fetchTime = Date.now() - startTime;
console.groupCollapsed(...format(['GraphQL ', 'color: gray'], [type + ' ', `color: ${error ? 'red' : '#03A9F4'}; font-weight: bold`], [`(${fetchTime}ms)`, 'color: gray'], [` ${selections.length} selections`, 'color: gray'], error && ['FAILED', 'margin-left: 10px; border-radius: 2px; padding: 2px 6px; background: #e84343; color: white']));
console.groupCollapsed(...format(['GraphQL ', 'color: gray'], [type + ' ', `color: ${error ? 'red' : '#03A9F4'}; font-weight: bold`], ...(label ? [[label + ' ', 'color: green']] : []), [`(${fetchTime}ms)`, 'color: gray'], [` ${selections.length} selections`, 'color: gray'], error && ['FAILED', 'margin-left: 10px; border-radius: 2px; padding: 2px 6px; background: #e84343; color: white']));
const headerStyles = `font-weight: bold; color: #f316c1`;
console.group(...format(['Query ', headerStyles], [' ', `background-image: url(https://graphql.org/img/logo.svg)`]));
if (variables) {
console.log(...format(['Variables', 'color: #25e1e1']), stringifyJSONIfEnabled(variables));
if (query) {
console.group(...format(['Query ', headerStyles], [' ', `background-image: url(https://graphql.org/img/logo.svg)`]));
if (variables) {
console.log(...format(['Variables', 'color: #25e1e1']), stringifyJSONIfEnabled(variables));
}
console.log(...format([parseGraphQL(query)]));
console.groupEnd();
}
console.log(...format([parseGraphQL(query)]));
console.groupEnd();
if (error) {
console.error(...format(['Error', headerStyles]), serializeError.serializeError(error));
} else {
} else if (executionResult) {
console.log(...format(['Result', headerStyles]), stringifyJSONIfEnabled(executionResult));

@@ -99,0 +103,0 @@ }

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("prettier/parser-babel"),o=require("prettier/parser-graphql"),r=require("prettier/standalone"),n=require("serialize-error");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=t(e),l=t(o),c=t(r);function i(e){return c.default.format(e,{parser:"graphql",plugins:[l.default]})}function a(e){return Boolean(e)}const u=(...e)=>{const o=[],r=[];for(const[n,t]of e.filter(a))o.push(n),r.push(`font-weight: normal; ${t}`);return[`%c${o.join("%c")}`,...r]};exports.createLogger=function(e,o={}){null!=(o=Object.assign({},o)).showCache||(o.showCache=!0),null!=o.showSelections||(o.showSelections=!0),null!=o.stringifyJSON||(o.stringifyJSON=!1);const r=e=>o.stringifyJSON?c.default.format(JSON.stringify(e),{parser:"json",plugins:[s.default]}):e,t=e.eventHandler;async function l(e){const t=Date.now(),{query:s,variables:l,error:c,selections:a,executionResult:g,cacheSnapshot:p,type:f}=await e,h=Date.now()-t;console.groupCollapsed(...u(["GraphQL ","color: gray"],[f+" ",`color: ${c?"red":"#03A9F4"}; font-weight: bold`],[`(${h}ms)`,"color: gray"],[` ${a.length} selections`,"color: gray"],c&&["FAILED","margin-left: 10px; border-radius: 2px; padding: 2px 6px; background: #e84343; color: white"]));const d="font-weight: bold; color: #f316c1";console.group(...u(["Query ",d],[" ","background-image: url(https://graphql.org/img/logo.svg)"])),l&&console.log(...u(["Variables","color: #25e1e1"]),r(l)),console.log(...u([i(s)])),console.groupEnd(),c?console.error(...u(["Error",d]),n.serializeError(c)):console.log(...u(["Result",d]),r(g)),o.showSelections&&(console.groupCollapsed(...u(["Selections",d])),a.forEach((({noIndexSelections:e,selectionsList:o,type:n,...t})=>{console.log(r(t))})),console.groupEnd()),o.showCache&&(console.log(...u(["Cache snapshot",d]),r(p)),console.groupEnd())}return{start:function(){return t.onFetchSubscribe(l)},options:o}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("prettier/parser-babel"),o=require("prettier/parser-graphql"),r=require("prettier/standalone"),n=require("serialize-error");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=t(e),l=t(o),c=t(r);function a(e){return c.default.format(e,{parser:"graphql",plugins:[l.default]})}function i(e){return Boolean(e)}const u=(...e)=>{const o=[],r=[];for(const[n,t]of e.filter(i))o.push(n),r.push(`font-weight: normal; ${t}`);return[`%c${o.join("%c")}`,...r]};exports.createLogger=function(e,o={}){null!=(o=Object.assign({},o)).showCache||(o.showCache=!0),null!=o.showSelections||(o.showSelections=!0),null!=o.stringifyJSON||(o.stringifyJSON=!1);const r=e=>o.stringifyJSON?c.default.format(JSON.stringify(e),{parser:"json",plugins:[s.default]}):e,t=e.eventHandler;async function l(e){const t=Date.now(),{query:s,variables:l,error:c,selections:i,executionResult:g,cacheSnapshot:p,type:f,label:h}=await e,d=Date.now()-t;console.groupCollapsed(...u(["GraphQL ","color: gray"],[f+" ",`color: ${c?"red":"#03A9F4"}; font-weight: bold`],...h?[[h+" ","color: green"]]:[],[`(${d}ms)`,"color: gray"],[` ${i.length} selections`,"color: gray"],c&&["FAILED","margin-left: 10px; border-radius: 2px; padding: 2px 6px; background: #e84343; color: white"]));const b="font-weight: bold; color: #f316c1";s&&(console.group(...u(["Query ",b],[" ","background-image: url(https://graphql.org/img/logo.svg)"])),l&&console.log(...u(["Variables","color: #25e1e1"]),r(l)),console.log(...u([a(s)])),console.groupEnd()),c?console.error(...u(["Error",b]),n.serializeError(c)):g&&console.log(...u(["Result",b]),r(g)),o.showSelections&&(console.groupCollapsed(...u(["Selections",b])),i.forEach((({noIndexSelections:e,selectionsList:o,type:n,...t})=>{console.log(r(t))})),console.groupEnd()),o.showCache&&(console.log(...u(["Cache snapshot",b]),r(p)),console.groupEnd())}return{start:function(){return t.onFetchSubscribe(l)},options:o}};
//# sourceMappingURL=gqless-logger.cjs.production.min.js.map

@@ -59,19 +59,23 @@ import parserJSON from 'prettier/parser-babel';

cacheSnapshot,
type
type,
label
} = await dataPromise;
const fetchTime = Date.now() - startTime;
console.groupCollapsed(...format(['GraphQL ', 'color: gray'], [type + ' ', `color: ${error ? 'red' : '#03A9F4'}; font-weight: bold`], [`(${fetchTime}ms)`, 'color: gray'], [` ${selections.length} selections`, 'color: gray'], error && ['FAILED', 'margin-left: 10px; border-radius: 2px; padding: 2px 6px; background: #e84343; color: white']));
console.groupCollapsed(...format(['GraphQL ', 'color: gray'], [type + ' ', `color: ${error ? 'red' : '#03A9F4'}; font-weight: bold`], ...(label ? [[label + ' ', 'color: green']] : []), [`(${fetchTime}ms)`, 'color: gray'], [` ${selections.length} selections`, 'color: gray'], error && ['FAILED', 'margin-left: 10px; border-radius: 2px; padding: 2px 6px; background: #e84343; color: white']));
const headerStyles = `font-weight: bold; color: #f316c1`;
console.group(...format(['Query ', headerStyles], [' ', `background-image: url(https://graphql.org/img/logo.svg)`]));
if (variables) {
console.log(...format(['Variables', 'color: #25e1e1']), stringifyJSONIfEnabled(variables));
if (query) {
console.group(...format(['Query ', headerStyles], [' ', `background-image: url(https://graphql.org/img/logo.svg)`]));
if (variables) {
console.log(...format(['Variables', 'color: #25e1e1']), stringifyJSONIfEnabled(variables));
}
console.log(...format([parseGraphQL(query)]));
console.groupEnd();
}
console.log(...format([parseGraphQL(query)]));
console.groupEnd();
if (error) {
console.error(...format(['Error', headerStyles]), serializeError(error));
} else {
} else if (executionResult) {
console.log(...format(['Result', headerStyles]), stringifyJSONIfEnabled(executionResult));

@@ -78,0 +82,0 @@ }

{
"name": "@gqless/logger",
"version": "2.0.5",
"version": "2.0.6",
"homepage": "https://gqless.com",

@@ -32,3 +32,3 @@ "license": "MIT",

"build-utils": "1.0.0",
"gqless": "^2.0.5",
"gqless": "^2.0.6",
"jest": "^26.6.3",

@@ -42,3 +42,3 @@ "rimraf": "^3.0.2",

"peerDependencies": {
"gqless": "^2.0.5"
"gqless": "^2.0.6"
},

@@ -45,0 +45,0 @@ "engines": {

@@ -88,2 +88,3 @@ import parserJSON from 'prettier/parser-babel';

type,
label,
} = await dataPromise;

@@ -97,2 +98,3 @@

[type + ' ', `color: ${error ? 'red' : '#03A9F4'}; font-weight: bold`],
...(label ? [[label + ' ', 'color: green']] : []),
[`(${fetchTime}ms)`, 'color: gray'],

@@ -110,23 +112,26 @@ [` ${selections.length} selections`, 'color: gray'],

console.group(
...format(
['Query ', headerStyles],
[' ', `background-image: url(https://graphql.org/img/logo.svg)`]
)
);
if (variables) {
console.log(
...format(['Variables', 'color: #25e1e1']),
stringifyJSONIfEnabled(variables)
// Ignore empty string queries
if (query) {
console.group(
...format(
['Query ', headerStyles],
[' ', `background-image: url(https://graphql.org/img/logo.svg)`]
)
);
}
console.log(...format([parseGraphQL(query)]));
if (variables) {
console.log(
...format(['Variables', 'color: #25e1e1']),
stringifyJSONIfEnabled(variables)
);
}
console.groupEnd();
console.log(...format([parseGraphQL(query)]));
console.groupEnd();
}
if (error) {
console.error(...format(['Error', headerStyles]), serializeError(error));
} else {
} else if (executionResult) {
console.log(

@@ -157,2 +162,5 @@ ...format(['Result', headerStyles]),

/**
* Start logging, it returns the "stop" function
*/
function start() {

@@ -159,0 +167,0 @@ const unsubscribe = eventHandler.onFetchSubscribe(onFetch);

Sorry, the diff of this file is not supported yet

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc