Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@subql/apollo-links

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@subql/apollo-links - npm Package Compare versions

Comparing version 1.1.1-0 to 1.1.1-1

dist/core/orderManager.d.ts

4

dist/authHttpLink.d.ts
import { ApolloLink } from '@apollo/client/core';
import { Options } from './core';
import { Logger } from './utils/logger';
import { IStore } from './utils/store';
interface BaseAuthOptions {

@@ -9,4 +10,3 @@ authUrl: string;

fallbackServiceUrl?: string;
cacheEnabled?: boolean;
ttl?: number;
scoreStore?: IStore;
}

@@ -13,0 +13,0 @@ interface DictAuthOptions extends BaseAuthOptions {

"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 });

@@ -12,5 +9,4 @@ exports.deploymentHttpLink = exports.dictHttpLink = void 0;

const types_1 = require("./types");
const cache_1 = require("./utils/cache");
const logger_1 = require("./utils/logger");
const orderManager_1 = __importDefault(require("./utils/orderManager"));
const orderManager_1 = require("./core/orderManager");
function dictHttpLink(options) {

@@ -26,6 +22,5 @@ const { chainId } = options;

function authHttpLink(options) {
const { deploymentId, httpOptions, fallbackServiceUrl, authUrl, projectType, logger: _logger, cacheEnabled, ttl, } = options;
const { deploymentId, httpOptions, fallbackServiceUrl, authUrl, projectType, logger: _logger, } = options;
const logger = _logger !== null && _logger !== void 0 ? _logger : (0, logger_1.silentLogger)();
const cache = cacheEnabled !== false ? (0, cache_1.createCache)({ ttl: ttl !== null && ttl !== void 0 ? ttl : 86400000 }) : undefined;
const orderManager = new orderManager_1.default({
const orderManager = new orderManager_1.OrderManager({
authUrl,

@@ -35,3 +30,2 @@ projectId: deploymentId,

logger,
cache,
});

@@ -38,0 +32,0 @@ const retryLink = (0, core_2.createRetryLink)({ orderManager, logger });

import { ApolloLink, FetchResult, NextLink, Observable, Operation } from '@apollo/client/core';
import { OrderManager } from './orderManager';
import { Logger } from '../utils/logger';
import OrderMananger from '../utils/orderManager';
export declare type AuthOptions = {
authUrl: string;
projectId: string;
orderManager: OrderMananger;
orderManager: OrderManager;
logger: Logger;

@@ -9,0 +9,0 @@ };

import { ApolloLink } from '@apollo/client/core';
import { Logger } from '../utils/logger';
import OrderManager from '../utils/orderManager';
import { OrderManager } from './orderManager';
export declare type ErrorLinkOption = {

@@ -5,0 +5,0 @@ orderManager: OrderManager;

import { RetryLink } from '@apollo/client/link/retry';
import { Logger } from '../utils/logger';
import OrderManager from '../utils/orderManager';
import { OrderManager } from './orderManager';
export declare type RetryLinkOption = {

@@ -5,0 +5,0 @@ orderManager: OrderManager;

{
"name": "@subql/apollo-links",
"version": "1.1.1-0",
"version": "1.1.1-1",
"description": "SubQuery Network - graphql links",

@@ -31,3 +31,3 @@ "main": "dist/index.js",

},
"stableVersion": "1.1.0"
"stableVersion": "1.1.1-0"
}

@@ -106,2 +106,18 @@ # @subql/apollo-links

## Score Store
We have an internal store for indexer scores so bad performed, bad progressed or unreachable indexers will be punished and not getting new requests.
For browser side usage, after page refresh, the score will lose though. To solve that, you can instantiate a LocalStorageStore and pass in when constructing the link object.
```ts
const store = createLocalStorageStore({ttl: 86_400_000});
const { link, cleanup } = deploymentHttpLink({
authUrl: 'https://kepler-auth.subquery.network',
deploymentId: 'your_deployment_id_here',
httpOptions: { fetchOptions: { timeout: 5000 } },
scoreStore: store,
});
```
## Other options

@@ -108,0 +124,0 @@

@@ -16,5 +16,5 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

import { ProjectType } from './types';
import { createCache } from './utils/cache';
import { Logger, silentLogger } from './utils/logger';
import OrderMananger from './utils/orderManager';
import { OrderManager } from './core/orderManager';
import { IStore } from './utils/store';

@@ -26,4 +26,3 @@ interface BaseAuthOptions {

fallbackServiceUrl?: string; // fall back service url for `AuthLink`
cacheEnabled?: boolean; // enable cache for `AuthLink`
ttl?: number; // ttl for cache, milliseconds, 1 day by default
scoreStore?: IStore; // pass store in, so it doesn't get lost between page refresh
}

@@ -65,9 +64,6 @@

logger: _logger,
cacheEnabled,
ttl,
} = options;
const logger = _logger ?? silentLogger();
const cache = cacheEnabled !== false ? createCache({ ttl: ttl ?? 86_400_000 }) : undefined;
const orderManager = new OrderMananger({
const orderManager = new OrderManager({
authUrl,

@@ -77,3 +73,2 @@ projectId: deploymentId,

logger,
cache,
});

@@ -80,0 +75,0 @@

@@ -7,6 +7,6 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

import { OrderManager } from './orderManager';
import { isTokenExpired } from '../auth';
import { ChannelAuth, OrderType } from '../types';
import { Logger } from '../utils/logger';
import OrderMananger from '../utils/orderManager';
import { POST } from '../utils/query';

@@ -17,3 +17,3 @@

projectId: string; // chainId or deploymentId for the project
orderManager: OrderMananger; // agreement manager for managing agreements
orderManager: OrderManager; // agreement manager for managing agreements
logger: Logger; // logger for logging

@@ -38,3 +38,3 @@ };

private logger: Logger;
private orderManager: OrderMananger;
private orderManager: OrderManager;

@@ -41,0 +41,0 @@ constructor(options: AuthOptions) {

@@ -7,3 +7,3 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

import { Logger } from '../utils/logger';
import OrderManager from '../utils/orderManager';
import { OrderManager } from './orderManager';

@@ -10,0 +10,0 @@ export type ErrorLinkOption = {

@@ -7,3 +7,3 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

import { Logger } from '../utils/logger';
import OrderManager from '../utils/orderManager';
import { OrderManager } from './orderManager';

@@ -10,0 +10,0 @@ export type RetryLinkOption = {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc