Project files
This commit is contained in:
52
receipeServer/frontend_old/node_modules/apollo-link-error/CHANGELOG.md
generated
vendored
Normal file
52
receipeServer/frontend_old/node_modules/apollo-link-error/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# Change log
|
||||
|
||||
----
|
||||
|
||||
**NOTE:** This changelog is no longer maintained. Changes are now tracked in
|
||||
the top level [`CHANGELOG.md`](https://github.com/apollographql/apollo-link/blob/master/CHANGELOG.md).
|
||||
|
||||
----
|
||||
|
||||
### 1.1.2
|
||||
|
||||
- No changes
|
||||
|
||||
### 1.1.1
|
||||
- Added `graphql` 14 to peer and dev deps; Updated `@types/graphql` to 14 <br/>
|
||||
[@hwillson](http://github.com/hwillson) in [#789](https://github.com/apollographql/apollo-link/pull/789)
|
||||
- Update types to be compatible with `@types/graphql@0.13.3`
|
||||
|
||||
### 1.1.0
|
||||
- Pass `forward` into error handler for ErrorLink to support retrying a failed request
|
||||
|
||||
### 1.0.9
|
||||
- Correct return type to FetchResult [#600](https://github.com/apollographql/apollo-link/pull/600)
|
||||
|
||||
### 1.0.8
|
||||
- Update apollo-link [#559](https://github.com/apollographql/apollo-link/pull/559)
|
||||
|
||||
### 1.0.7
|
||||
- update apollo link with zen-observable-ts [PR#515](https://github.com/apollographql/apollo-link/pull/515)
|
||||
|
||||
### 1.0.6
|
||||
- ApolloLink upgrade
|
||||
|
||||
### 1.0.5
|
||||
- ApolloLink upgrade
|
||||
|
||||
### 1.0.4
|
||||
- ApolloLink upgrade
|
||||
|
||||
### 1.0.3
|
||||
- export options as named interface [TypeScript]
|
||||
|
||||
### 1.0.2
|
||||
- changed peer-dependency of apollo-link to actual dependency
|
||||
- graphQLErrors alias networkError.result.errors on a networkError
|
||||
|
||||
### 1.0.1
|
||||
- moved to better rollup build
|
||||
|
||||
### 1.0.0
|
||||
- Added the operation and any data to the error handler callback
|
||||
- changed graphqlErrors to be graphQLErrors to be consistent with Apollo Client
|
||||
21
receipeServer/frontend_old/node_modules/apollo-link-error/LICENSE
generated
vendored
Normal file
21
receipeServer/frontend_old/node_modules/apollo-link-error/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 - 2017 Meteor Development Group, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
92
receipeServer/frontend_old/node_modules/apollo-link-error/README.md
generated
vendored
Normal file
92
receipeServer/frontend_old/node_modules/apollo-link-error/README.md
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
title: apollo-link-error
|
||||
description: Handle and inspect errors in your GraphQL network stack.
|
||||
---
|
||||
|
||||
Use this link to do some custom logic when a GraphQL or network error happens:
|
||||
|
||||
```js
|
||||
import { onError } from "apollo-link-error";
|
||||
|
||||
const link = onError(({ graphQLErrors, networkError }) => {
|
||||
if (graphQLErrors)
|
||||
graphQLErrors.forEach(({ message, locations, path }) =>
|
||||
console.log(
|
||||
`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
|
||||
)
|
||||
);
|
||||
if (networkError) console.log(`[Network error]: ${networkError}`);
|
||||
});
|
||||
```
|
||||
|
||||
Apollo Link is a system of modular components for GraphQL networking. [Read the docs](https://www.apollographql.com/docs/link/#usage) to learn how to use this link with libraries like Apollo Client and graphql-tools, or as a standalone client.
|
||||
|
||||
## Callback
|
||||
|
||||
Error Link takes a function that is called in the event of an error. This function is called with an object containing the following keys:
|
||||
|
||||
* `operation`: The Operation that errored
|
||||
* `response`: The result returned from lower down in the link chain
|
||||
* `graphQLErrors`: An array of errors from the GraphQL endpoint
|
||||
* `networkError`: Any error during the link execution or server response, that wasn't delivered as part of the `errors` field in the GraphQL result
|
||||
* `forward`: A reference to the next link in the chain. Calling `return forward(operation)` in the callback will retry the request, returning a new observable for the upstream link to subscribe to.
|
||||
|
||||
Returns: `Observable<FetchResult> | void` The error callback can optionally return an observable from calling `forward(operation)` if it wants to retry the request. It should not return anything else.
|
||||
|
||||
## Error categorization
|
||||
|
||||
An error is passed as a `networkError` if a link further down the chain called the `error` callback on the observable. In most cases, `graphQLErrors` is the `errors` field of the result from the last `next` call.
|
||||
|
||||
A `networkError` can contain additional fields, such as a GraphQL object in the case of a [failing HTTP status code](http#errors) from [`apollo-link-http`](http). In this situation, `graphQLErrors` is an alias for `networkError.result.errors` if the property exists.
|
||||
|
||||
## Retrying failed requests
|
||||
|
||||
An error handler might want to do more than just logging errors. You can check for a certain failure condition or error code, and retry the request if rectifying the error is possible. For example, when using some form of token based authentication, there is a need to handle re-authentication when the token expires. Here is an example of how to do this using `forward()`.
|
||||
```js
|
||||
onError(({ graphQLErrors, networkError, operation, forward }) => {
|
||||
if (graphQLErrors) {
|
||||
for (let err of graphQLErrors) {
|
||||
switch (err.extensions.code) {
|
||||
case 'UNAUTHENTICATED':
|
||||
// error code is set to UNAUTHENTICATED
|
||||
// when AuthenticationError thrown in resolver
|
||||
|
||||
// modify the operation context with a new token
|
||||
const oldHeaders = operation.getContext().headers;
|
||||
operation.setContext({
|
||||
headers: {
|
||||
...oldHeaders,
|
||||
authorization: getNewToken(),
|
||||
},
|
||||
});
|
||||
// retry the request, returning the new observable
|
||||
return forward(operation);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (networkError) {
|
||||
console.log(`[Network error]: ${networkError}`);
|
||||
// if you would also like to retry automatically on
|
||||
// network errors, we recommend that you use
|
||||
// apollo-link-retry
|
||||
}
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
Here is a diagram of how the request flow looks like now:
|
||||

|
||||
|
||||
One caveat is that the errors from the new response from retrying the request does not get passed into the error handler again. This helps to avoid being trapped in an endless request loop when you call forward() in your error handler.
|
||||
|
||||
## Ignoring errors
|
||||
|
||||
If you want to conditionally ignore errors, you can set `response.errors = undefined;` within the error handler:
|
||||
|
||||
```js
|
||||
onError(({ response, operation }) => {
|
||||
if (operation.operationName === "IgnoreErrorsQuery") {
|
||||
response.errors = undefined;
|
||||
}
|
||||
});
|
||||
```
|
||||
61
receipeServer/frontend_old/node_modules/apollo-link-error/package.json
generated
vendored
Normal file
61
receipeServer/frontend_old/node_modules/apollo-link-error/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "apollo-link-error",
|
||||
"version": "1.1.13",
|
||||
"description": "Error Apollo Link for GraphQL Network Stack",
|
||||
"author": "James Baxley <james@meteor.com>",
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"module": "./lib/bundle.esm.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/apollographql/apollo-link.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/apollographql/apollo-link/issues"
|
||||
},
|
||||
"homepage": "https://github.com/apollographql/apollo-link#readme",
|
||||
"scripts": {
|
||||
"build": "tsc && rollup -c",
|
||||
"clean": "rimraf lib/* && rimraf coverage/*",
|
||||
"coverage": "jest --coverage",
|
||||
"filesize": "../../scripts/minify",
|
||||
"lint": "tslint -c \"../../tslint.json\" -p tsconfig.json -c ../../tslint.json src/*.ts",
|
||||
"prebuild": "npm run clean",
|
||||
"prepare": "npm run build",
|
||||
"test": "npm run lint && jest",
|
||||
"watch": "tsc -w -p . & rollup -c -w"
|
||||
},
|
||||
"dependencies": {
|
||||
"apollo-link": "^1.2.14",
|
||||
"apollo-link-http-common": "^0.2.16",
|
||||
"tslib": "^1.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graphql": "14.2.3",
|
||||
"@types/jest": "24.9.0",
|
||||
"graphql": "15.0.0",
|
||||
"graphql-tag": "2.10.1",
|
||||
"jest": "24.9.0",
|
||||
"rimraf": "2.7.1",
|
||||
"rollup": "1.29.1",
|
||||
"ts-jest": "22.4.6",
|
||||
"tslint": "5.20.1",
|
||||
"typescript": "3.0.3"
|
||||
},
|
||||
"jest": {
|
||||
"transform": {
|
||||
".(ts|tsx)": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"json"
|
||||
],
|
||||
"testURL": "http://localhost"
|
||||
},
|
||||
"gitHead": "1012934b4fd9ab436c4fdcd5e9b1bb1e4c1b0d98"
|
||||
}
|
||||
Reference in New Issue
Block a user