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

apollo-logger

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-logger - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

48

lib/bundle.umd.js

@@ -124,3 +124,3 @@ (function (global, factory) {

case 2:
debug(JSON.stringify(result), "<= " + trigger + "->next");
debug(JSON.stringify(result), '<= ' + trigger + '->next');
return [7];

@@ -138,8 +138,8 @@ case 3: return [2, result];

finally {
debug(trigger + ("->throw(\"" + JSON.stringify(error) + "\") =>"), JSON.stringify(result));
debug(trigger + ("->throw('" + JSON.stringify(error) + "') =>"), JSON.stringify(result));
}
return result;
}
},
});
}
},
}); };

@@ -160,18 +160,26 @@ var LoggingLink = (function (_super) {

else {
observable.subscribe(function (result) {
debug(JSON.stringify(result) + " <= " + formatRequest(operation));
return result;
return new apolloLink.Observable(function (observer) {
debug("subscribe <= " + formatRequest(operation));
var observerProxy = {
next: function (value) {
debug(JSON.stringify(value) + " <= " + formatRequest(operation));
if (observer.next) {
observer.next(value);
}
},
error: function (errorValue) {
debug(JSON.stringify(errorValue) + " <= " + formatRequest(operation));
if (observer.error) {
observer.error(errorValue);
}
},
complete: function () {
debug("unsubscribe <= " + formatRequest(operation));
if (observer.complete) {
observer.complete();
}
},
};
observable.subscribe(observerProxy);
});
return {
subscribe: function () {
debug("subscribe <= " + formatRequest(operation));
var result = observable.subscribe.apply(observable, arguments);
return {
unsubscribe: function () {
debug("unsubscribe <= " + formatRequest(operation));
return result.unsubscribe.apply(observable, arguments);
}
};
},
};
}

@@ -186,3 +194,3 @@ };

else {
throw new Error("Unknown object passed to Apollo Logger:" + JSON.stringify(obj));
throw new Error('Unknown object passed to Apollo Logger:' + JSON.stringify(obj));
}

@@ -189,0 +197,0 @@ };

@@ -1,4 +0,5 @@

import { ApolloLink } from 'apollo-link';
/// <reference types="zen-observable" />
import { ApolloLink, NextLink, Operation, Observable } from 'apollo-link';
export declare class LoggingLink extends ApolloLink {
request(operation: any, forward: any): any;
request(operation: Operation, forward: NextLink): Observable<any>;
}

@@ -5,0 +6,0 @@ export declare const addApolloLogging: (obj: any) => {

@@ -46,3 +46,3 @@ var __extends = (this && this.__extends) || (function () {

};
import { ApolloLink } from 'apollo-link';
import { ApolloLink, Observable } from 'apollo-link';
function debug() {

@@ -120,3 +120,3 @@ var args = [];

case 2:
debug(JSON.stringify(result), "<= " + trigger + "->next");
debug(JSON.stringify(result), '<= ' + trigger + '->next');
return [7];

@@ -134,8 +134,8 @@ case 3: return [2, result];

finally {
debug(trigger + ("->throw(\"" + JSON.stringify(error) + "\") =>"), JSON.stringify(result));
debug(trigger + ("->throw('" + JSON.stringify(error) + "') =>"), JSON.stringify(result));
}
return result;
}
},
});
}
},
}); };

@@ -156,18 +156,26 @@ var LoggingLink = (function (_super) {

else {
observable.subscribe(function (result) {
debug(JSON.stringify(result) + " <= " + formatRequest(operation));
return result;
return new Observable(function (observer) {
debug("subscribe <= " + formatRequest(operation));
var observerProxy = {
next: function (value) {
debug(JSON.stringify(value) + " <= " + formatRequest(operation));
if (observer.next) {
observer.next(value);
}
},
error: function (errorValue) {
debug(JSON.stringify(errorValue) + " <= " + formatRequest(operation));
if (observer.error) {
observer.error(errorValue);
}
},
complete: function () {
debug("unsubscribe <= " + formatRequest(operation));
if (observer.complete) {
observer.complete();
}
},
};
observable.subscribe(observerProxy);
});
return {
subscribe: function () {
debug("subscribe <= " + formatRequest(operation));
var result = observable.subscribe.apply(observable, arguments);
return {
unsubscribe: function () {
debug("unsubscribe <= " + formatRequest(operation));
return result.unsubscribe.apply(observable, arguments);
}
};
},
};
}

@@ -183,5 +191,5 @@ };

else {
throw new Error("Unknown object passed to Apollo Logger:" + JSON.stringify(obj));
throw new Error('Unknown object passed to Apollo Logger:' + JSON.stringify(obj));
}
};
//# sourceMappingURL=index.js.map
{
"name": "apollo-logger",
"version": "0.1.0",
"version": "0.1.1",
"description": "Apollo GraphQL Logger",

@@ -15,3 +15,3 @@ "main": "./lib/bundle.umd.js",

"watch": "tsc -w",
"lint": "tslint 'src/*.ts*' -p tsconfig.json --type-check && tslint 'test/*.ts*' -p tsconfig.json --type-check",
"lint": "tslint --fix 'src/*.ts*' -p tsconfig.json --type-check && tslint 'test/*.ts*' -p tsconfig.json --type-check",
"test": "echo \"Error: no test specified\" && exit 1",

@@ -46,4 +46,5 @@ "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js",

"@types/node": "^7.0.18",
"apollo-link": "^0.6.1-beta.4",
"graphql": "^0.10.5",
"@types/zen-observable": "^0.5.3",
"apollo-link": "^1.0.0",
"graphql": "^0.11.7",
"rimraf": "^2.6.2",

@@ -55,4 +56,4 @@ "rollup": "^0.50.0",

"peerDependencies": {
"apollo-link": "^0.6.1-beta.4",
"graphql": ">=0.10.0"
"apollo-link": ">= 0.5.0",
"graphql": ">= 0.10.0"
},

@@ -59,0 +60,0 @@ "dependencies": {

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

import { print } from 'graphql';
import { ApolloLink } from 'apollo-link';
import { ApolloLink, NextLink, Operation, Observable } from 'apollo-link';

@@ -44,3 +43,3 @@ function debug(...args) {

} finally {
debug(JSON.stringify(result), "<= " + trigger + "->next");
debug(JSON.stringify(result), '<= ' + trigger + '->next');
}

@@ -54,12 +53,12 @@ return result;

} finally {
debug(trigger + `->throw("${JSON.stringify(error)}") =>`, JSON.stringify(result));
debug(trigger + `->throw('${JSON.stringify(error)}') =>`, JSON.stringify(result));
}
return result;
}
},
});
}
},
});
export class LoggingLink extends ApolloLink {
request(operation, forward) {
request(operation: Operation, forward: NextLink): Observable<any> {
const observable = forward(operation);

@@ -74,19 +73,29 @@

} else {
observable.subscribe(result => {
debug(`${JSON.stringify(result)} <= ${formatRequest(operation)}`);
return new Observable(observer => {
debug(`subscribe <= ${formatRequest(operation)}`);
const observerProxy = {
next(value) {
debug(`${JSON.stringify(value)} <= ${formatRequest(operation)}`);
return result;
if (observer.next) {
observer.next(value);
}
},
error(errorValue) {
debug(`${JSON.stringify(errorValue)} <= ${formatRequest(operation)}`);
if (observer.error) {
observer.error(errorValue);
}
},
complete() {
debug(`unsubscribe <= ${formatRequest(operation)}`);
if (observer.complete) {
observer.complete();
}
},
};
observable.subscribe(observerProxy);
});
return {
subscribe() {
debug(`subscribe <= ${formatRequest(operation)}`);
const result = observable.subscribe.apply(observable, arguments);
return {
unsubscribe() {
debug(`unsubscribe <= ${formatRequest(operation)}`);
return result.unsubscribe.apply(observable, arguments);
}
}
},
};
}

@@ -98,6 +107,6 @@ }

if (obj.publish) {
return addPubSubLogger(obj)
return addPubSubLogger(obj);
} else {
throw new Error("Unknown object passed to Apollo Logger:" + JSON.stringify(obj));
throw new Error('Unknown object passed to Apollo Logger:' + JSON.stringify(obj));
}
};

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