@subql/apollo-links
Advanced tools
Comparing version 0.5.9-2 to 0.5.9-3
@@ -1,6 +0,7 @@ | ||
import { ApolloLink, HttpOptions } from '@apollo/client/core'; | ||
import { ApolloLink } from '@apollo/client/core'; | ||
import { Options } from './core'; | ||
import { Logger } from './utils/logger'; | ||
interface BaseAuthOptions { | ||
authUrl: string; | ||
httpOptions: HttpOptions; | ||
httpOptions: Options['httpOptions']; | ||
logger?: Logger; | ||
@@ -7,0 +8,0 @@ fallbackServiceUrl?: string; |
import { ApolloLink, FetchResult, HttpOptions, NextLink, Observable, Operation } from '@apollo/client/core'; | ||
import { Logger } from '../utils/logger'; | ||
declare type Options = { | ||
httpOptions: HttpOptions; | ||
export declare type Options = { | ||
httpOptions: { | ||
/** | ||
* @remarks | ||
* Please confirm your `fetch` attaches headers `Content-Type` and `Content-Length`. | ||
*/ | ||
fetch?: HttpOptions['fetch']; | ||
} & HttpOptions; | ||
logger?: Logger; | ||
@@ -14,2 +20,1 @@ }; | ||
} | ||
export {}; |
"use strict"; | ||
// Copyright 2020-2022 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DynamicHttpLink = void 0; | ||
const core_1 = require("@apollo/client/core"); | ||
const cross_fetch_1 = __importDefault(require("cross-fetch")); | ||
class DynamicHttpLink extends core_1.ApolloLink { | ||
@@ -28,3 +32,3 @@ constructor(options) { | ||
createHttpLink(uri) { | ||
return new core_1.HttpLink(Object.assign(Object.assign({}, this.options.httpOptions), { uri })); | ||
return new core_1.HttpLink(Object.assign(Object.assign({}, this.options.httpOptions), { fetch: this.options.httpOptions.fetch ? this.options.httpOptions.fetch : cross_fetch_1.default, uri })); | ||
} | ||
@@ -31,0 +35,0 @@ } |
{ | ||
"name": "@subql/apollo-links", | ||
"version": "0.5.9-2", | ||
"version": "0.5.9-3", | ||
"description": "SubQuery Network - graphql links", | ||
@@ -16,2 +16,3 @@ "main": "dist/index.js", | ||
"buffer": "^6.0.3", | ||
"cross-fetch": "^4.0.0", | ||
"ethers": "^5.6.8", | ||
@@ -30,3 +31,3 @@ "jwt-decode": "^3.1.2", | ||
}, | ||
"stableVersion": "0.5.9-1" | ||
"stableVersion": "0.5.9-2" | ||
} |
// Copyright 2020-2022 SubQuery Pte Ltd authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { ApolloLink, HttpOptions, from } from '@apollo/client/core'; | ||
import { ApolloLink, from } from '@apollo/client/core'; | ||
import { | ||
ClusterAuthLink, | ||
DynamicHttpLink, | ||
@@ -12,2 +11,4 @@ FallbackLink, | ||
creatErrorLink, | ||
ClusterAuthLink, | ||
Options, | ||
createRetryLink, | ||
@@ -22,3 +23,3 @@ } from './core'; | ||
authUrl: string; // auth service url | ||
httpOptions: HttpOptions; // http options for init `HttpLink` | ||
httpOptions: Options['httpOptions']; // http options for init `HttpLink` | ||
logger?: Logger; // logger for `AuthLink` | ||
@@ -25,0 +26,0 @@ fallbackServiceUrl?: string; // fall back service url for `AuthLink` |
@@ -14,5 +14,12 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors | ||
import { Logger } from '../utils/logger'; | ||
import fetch from 'cross-fetch'; | ||
type Options = { | ||
httpOptions: HttpOptions; // http options for init `HttpLink` | ||
export type Options = { | ||
httpOptions: { | ||
/** | ||
* @remarks | ||
* Please confirm your `fetch` attaches headers `Content-Type` and `Content-Length`. | ||
*/ | ||
fetch?: HttpOptions['fetch']; | ||
} & HttpOptions; // http options for init `HttpLink` | ||
logger?: Logger; | ||
@@ -50,2 +57,3 @@ }; | ||
...this.options.httpOptions, | ||
fetch: this.options.httpOptions.fetch ? this.options.httpOptions.fetch : fetch, | ||
uri, | ||
@@ -52,0 +60,0 @@ }); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
202519
1914
14
10
+ Addedcross-fetch@^4.0.0
+ Addedcross-fetch@4.0.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)