@subql/apollo-links
Advanced tools
Comparing version 0.4.1-1 to 0.4.1-2
@@ -6,4 +6,4 @@ import { ApolloLink, HttpOptions } from '@apollo/client/core'; | ||
} | ||
interface ProjectAuthOptions extends BaseAuthOptions { | ||
projectId: string; | ||
interface DeploymentAuthOptions extends BaseAuthOptions { | ||
deploymentId: string; | ||
} | ||
@@ -17,3 +17,3 @@ interface BaseAuthOptions { | ||
export declare function dictHttpLink(options: DictAuthOptions): ApolloLink; | ||
export declare function projectHttpLink(options: ProjectAuthOptions): ApolloLink; | ||
export declare function deploymentHttpLink(options: DeploymentAuthOptions): ApolloLink; | ||
export {}; |
@@ -8,3 +8,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.projectHttpLink = exports.dictHttpLink = void 0; | ||
exports.deploymentHttpLink = exports.dictHttpLink = void 0; | ||
const core_1 = require("@apollo/client/core"); | ||
@@ -20,9 +20,9 @@ const auth_link_1 = require("./auth-link"); | ||
const { chainId } = options; | ||
return projectHttpLink(Object.assign(Object.assign({}, options), { projectId: chainId })); | ||
return deploymentHttpLink(Object.assign(Object.assign({}, options), { deploymentId: chainId })); | ||
} | ||
exports.dictHttpLink = dictHttpLink; | ||
function projectHttpLink(options) { | ||
const { projectId, httpOptions, fallbackServiceUrl, authUrl, logger: _logger } = options; | ||
function deploymentHttpLink(options) { | ||
const { deploymentId, httpOptions, fallbackServiceUrl, authUrl, logger: _logger } = options; | ||
const logger = _logger !== null && _logger !== void 0 ? _logger : (0, logger_1.silentLogger)(); | ||
const agreementManager = new agreementManager_1.default({ authUrl, projectId, logger }); | ||
const agreementManager = new agreementManager_1.default({ authUrl, projectId: deploymentId, logger }); | ||
agreementManager.start(); | ||
@@ -32,3 +32,3 @@ const errorLink = (0, errorLink_1.creatErrorLink)(logger); | ||
const httpLink = new dynamicHttpLink_1.DynamicHttpLink({ httpOptions }); | ||
const authLink = new auth_link_1.ClusterAuthLink({ authUrl, projectId, logger, agreementManager }); | ||
const authLink = new auth_link_1.ClusterAuthLink({ authUrl, projectId: deploymentId, logger, agreementManager }); | ||
// 1. errorLink: This link helps in handling and logging any GraphQL or network errors that may occur down the chain. | ||
@@ -41,3 +41,3 @@ // Placing it at the beginning ensures that it catches any errors that may occur in any of the other links. | ||
} | ||
exports.projectHttpLink = projectHttpLink; | ||
exports.deploymentHttpLink = deploymentHttpLink; | ||
//# sourceMappingURL=authHttpLink.js.map |
{ | ||
"name": "@subql/apollo-links", | ||
"version": "0.4.1-1", | ||
"version": "0.4.1-2", | ||
"description": "SubQuery Network - graphql links", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
}, | ||
"stableVersion": "0.4.1-0" | ||
"stableVersion": "0.4.1-1" | ||
} |
@@ -18,4 +18,4 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors | ||
interface ProjectAuthOptions extends BaseAuthOptions { | ||
projectId: string; // deployment id | ||
interface DeploymentAuthOptions extends BaseAuthOptions { | ||
deploymentId: string; // deployment id | ||
} | ||
@@ -32,10 +32,10 @@ | ||
const { chainId} = options; | ||
return projectHttpLink({...options, projectId: chainId}); | ||
return deploymentHttpLink({...options, deploymentId: chainId}); | ||
} | ||
export function projectHttpLink(options: ProjectAuthOptions): ApolloLink { | ||
const { projectId, httpOptions, fallbackServiceUrl, authUrl, logger: _logger } = options; | ||
export function deploymentHttpLink(options: DeploymentAuthOptions): ApolloLink { | ||
const { deploymentId, httpOptions, fallbackServiceUrl, authUrl, logger: _logger } = options; | ||
const logger = _logger ?? silentLogger(); | ||
const agreementManager = new AgreementManager({ authUrl, projectId, logger }); | ||
const agreementManager = new AgreementManager({ authUrl, projectId: deploymentId, logger }); | ||
agreementManager.start(); | ||
@@ -46,3 +46,3 @@ | ||
const httpLink = new DynamicHttpLink({ httpOptions }); | ||
const authLink = new ClusterAuthLink({ authUrl, projectId, logger, agreementManager }); | ||
const authLink = new ClusterAuthLink({ authUrl, projectId: deploymentId, logger, agreementManager }); | ||
@@ -49,0 +49,0 @@ // 1. errorLink: This link helps in handling and logging any GraphQL or network errors that may occur down the chain. |
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
112859