Socket
Socket
Sign inDemoInstall

@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 0.5.3 to 0.5.4-0

1

dist/utils/orderManager.d.ts

@@ -23,2 +23,3 @@ import { Logger } from './logger';

private refreshAgreements;
private getRandomStartIndex;
getNextOrderType(): Promise<OrderType | undefined>;

@@ -25,0 +26,0 @@ getNextAgreement(): Promise<Agreement | undefined>;

21

dist/utils/orderManager.js

@@ -16,4 +16,2 @@ "use strict";

this.logger = logger;
this.nextAgreementIndex = 0;
this.nextPlanIndex = 0;
this._init = this.refreshAgreements();

@@ -34,2 +32,5 @@ setInterval(this.refreshAgreements, this.interval);

}
getRandomStartIndex(n) {
return Math.floor(Math.random() * n);
}
async getNextOrderType() {

@@ -47,6 +48,7 @@ var _a, _b;

await this._init;
if (!this.healthy)
if (!this.healthy || !((_a = this.agreements) === null || _a === void 0 ? void 0 : _a.length))
return;
if (!((_a = this.agreements) === null || _a === void 0 ? void 0 : _a.length))
return;
if (this.nextAgreementIndex === undefined) {
this.nextAgreementIndex = this.getRandomStartIndex(this.agreements.length);
}
let agreement = this.agreements[this.nextAgreementIndex];

@@ -65,7 +67,8 @@ if (this.nextAgreementIndex < this.agreements.length - 1) {

await this._init;
if (!this.healthy)
if (!this.healthy || !((_a = this.plans) === null || _a === void 0 ? void 0 : _a.length))
return;
if (!((_a = this.plans) === null || _a === void 0 ? void 0 : _a.length))
return;
let plan = this.plans[this.nextAgreementIndex];
if (this.nextPlanIndex === undefined) {
this.nextPlanIndex = this.getRandomStartIndex(this.plans.length);
}
let plan = this.plans[this.nextPlanIndex];
if (this.nextPlanIndex < this.plans.length - 1) {

@@ -72,0 +75,0 @@ this.nextPlanIndex = this.nextPlanIndex + 1;

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

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

"graphql": "*"
}
},
"stableVersion": "0.5.3"
}

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

class OrderManager {
private nextAgreementIndex: number;
private nextAgreementIndex: number | undefined;
private agreements: Agreement[] | undefined;
private nextPlanIndex: number;
private nextPlanIndex: number | undefined;
private plans: Plan[] | undefined;

@@ -39,5 +39,2 @@

this.nextAgreementIndex = 0;
this.nextPlanIndex = 0;
this._init = this.refreshAgreements();

@@ -63,2 +60,6 @@ setInterval(this.refreshAgreements, this.interval);

private getRandomStartIndex(n: number) {
return Math.floor(Math.random() * n);
}
public async getNextOrderType(): Promise<OrderType | undefined> {

@@ -73,6 +74,9 @@ await this._init;

await this._init;
if (!this.healthy) return;
if (!this.agreements?.length) return;
if (!this.healthy || !this.agreements?.length) return;
if (this.nextAgreementIndex === undefined) {
this.nextAgreementIndex = this.getRandomStartIndex(this.agreements.length);
}
let agreement = this.agreements[this.nextAgreementIndex];

@@ -91,7 +95,10 @@ if (this.nextAgreementIndex < this.agreements.length - 1) {

await this._init;
if (!this.healthy) return;
if (!this.plans?.length) return;
if (!this.healthy || !this.plans?.length) return;
let plan = this.plans[this.nextAgreementIndex];
if (this.nextPlanIndex === undefined) {
this.nextPlanIndex = this.getRandomStartIndex(this.plans.length);
}
let plan = this.plans[this.nextPlanIndex];
if (this.nextPlanIndex < this.plans.length - 1) {

@@ -98,0 +105,0 @@ this.nextPlanIndex = this.nextPlanIndex + 1;

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