New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lwce/apollo-client

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lwce/apollo-client - npm Package Compare versions

Comparing version

to
0.1.0

CHANGELOG.md

1

dist/es6/index.js

@@ -10,2 +10,3 @@ /*

export { useMutation } from './mutation';
export { getErrorString } from './error-helpers';
//# sourceMappingURL=index.js.map

22

dist/es6/query.js

@@ -10,20 +10,2 @@ /*

export const useQuery = Symbol('apollo-use-query');
function errorString(error) {
if (error) {
if (Array.isArray(error)) {
let s = "";
for (let i of error) {
if (s)
s += "\n";
s += errorString(i);
}
return s;
}
if (typeof error !== 'string') {
error = error.toString();
}
return error;
}
return undefined;
}
register(useQuery, (eventTarget) => {

@@ -58,3 +40,3 @@ let connected, apolloOptions, observableQuery, subscription, pendingResult = {

data,
error: errorString(errors),
error: errors,
initialized: true

@@ -69,3 +51,3 @@ });

data: undefined,
error: errorString(error),
error,
initialized: true

@@ -72,0 +54,0 @@ });

export { getClient, setClient } from './client';
export { useQuery } from './query';
export { useMutation } from './mutation';
export { getErrorString } from './error-helpers';
{
"name": "@lwce/apollo-client",
"version": "0.0.2",
"version": "0.1.0",
"description": "Apollo client integration for Lightning Web Components",

@@ -5,0 +5,0 @@ "license": "BSD-3-Clause",

@@ -227,1 +227,21 @@ # @lwce/apollo-client

The options are a merge between the global options defined at the `@wire` level, and the ones passed to the `mutate` method (the later overrides the former).
### Error Helpers
Easily convert GraphQL error responses into a human readable string:
```js
import { getErrorString } from '@lwce/apollo-client';
@wire(useQuery, { query: QUERY, lazy: false, variables: '$variables'})
update(response) {
if (response.initialized) {
if (response.error) {
console.error(getErrorString(response.error));
} else {
this.data = response.data;
}
}
}
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet