Project files

This commit is contained in:
2023-11-09 18:47:11 +01:00
parent 695abe054b
commit c415135aae
8554 changed files with 858111 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
# 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.2.4
- No changes
### 1.2.3
- 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)
### 1.2.2
- Update apollo-link [#559](https://github.com/apollographql/apollo-link/pull/559)
- export graphql types and add @types/graphql as a regular dependency [PR#576](https://github.com/apollographql/apollo-link/pull/576)
- moved @types/node to dev dependencies in package.josn to avoid collisions with other projects. [PR#540](https://github.com/apollographql/apollo-link/pull/540)
### 1.2.1
- update apollo link with zen-observable-ts to remove import issues [PR#515](https://github.com/apollographql/apollo-link/pull/515)
### 1.2.0
- Add `fromError` Observable helper
- change import method of zen-observable for rollup compat
### 1.1.0
- Expose `#execute` on ApolloLink as static
### 1.0.7
- Update to graphql@0.12
### 1.0.6
- update rollup
### 1.0.5
- fix bug where context wasn't merged when setting it
### 1.0.4
- export link util helpers
### 1.0.3
- removed requiring query on initial execution check
- moved to move efficent rollup build
### 1.0.1, 1.0.2
<!-- never published as latest -->
- preleases for dev tool integation
### 0.8.0
- added support for `extensions` on an operation
### 0.7.0
- new operation API and start of changelog

View 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.

View File

@@ -0,0 +1,69 @@
# apollo-link
## Purpose
`apollo-link` is a standard interface for modifying control flow of GraphQL requests and fetching GraphQL results, designed to provide a simple GraphQL client that is capable of extensions.
The targeted use cases of `apollo-link` are highlighted below:
* fetch queries directly without normalized cache
* network interface for Apollo Client
* network interface for Relay Modern
* fetcher for
Apollo Link is the interface for creating new links in your application.
The client sends a request as a method call to a link and can recieve one or more (in the case of subscriptions) responses from the server. The responses are returned using the Observer pattern.
![Apollo Link Chain](https://cdn-images-1.medium.com/max/1600/1*62VLGUaU-9ULCoBCGvgdkQ.png)
Results from the server can be provided by calling `next(result)` on the observer. In the case of a network/transport error (not a GraphQL Error) the `error(err)` method can be used to indicate a response will not be recieved. If multiple responses are not supported by the link, `complete()` should be called to inform the client no further data will be provided.
In the case of an intermediate link, a second argument to `request(operation, forward)` is the link to `forward(operation)` to. `forward` returns an observable and it can be returned directly or subscribed to.
```js
forward(operation).subscribe({
next: result => {
handleTheResult(result)
},
error: error => {
handleTheNetworkError(error)
},
});
```
## Implementing a basic custom transport
```js
import { ApolloLink, Observable } from 'apollo-link';
export class CustomApolloLink extends ApolloLink {
request(operation /*, forward*/) {
//Whether no one is listening anymore
let unsubscribed = false;
return new Observable(observer => {
somehowGetOperationToServer(operation, (error, result) => {
if (unsubscribed) return;
if (error) {
//Network error
observer.error(error);
} else {
observer.next(result);
observer.complete(); //If subscriptions not supported
}
});
function unsubscribe() {
unsubscribed = true;
}
return unsubscribe;
});
}
}
```
## Installation
`npm install apollo-link --save`

View File

@@ -0,0 +1,72 @@
{
"name": "apollo-link",
"version": "1.2.14",
"description": "Flexible, lightweight transport layer for GraphQL",
"author": "Evans Hauser <evanshauser@gmail.com>",
"contributors": [
"James Baxley <james@meteor.com>",
"Jonas Helfer <jonas@helfer.email>",
"jon wong <j@jnwng.com>",
"Sashko Stubailo <sashko@stubailo.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-utilities": "^1.3.0",
"ts-invariant": "^0.4.0",
"tslib": "^1.9.3",
"zen-observable-ts": "^0.8.21"
},
"peerDependencies": {
"graphql": "^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0 || ^15.0.0"
},
"devDependencies": {
"@types/graphql": "14.2.3",
"@types/jest": "24.9.0",
"@types/node": "9.6.55",
"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"
}