New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

boxrec-requests

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boxrec-requests - npm Package Compare versions

Comparing version 5.2.1 to 5.2.2

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 5.2.2 (2022-03-14)
### Changed
- If GDPR error message occurs, the username/login error shouldn't override it
## 5.2.1 (2022-03-14)

@@ -2,0 +8,0 @@

1

dist/boxrec-requests.constants.d.ts

@@ -8,2 +8,3 @@ export interface BoxrecRatingsParams {

}
export declare type ScoreCard = Array<[number, number]>;
export interface PersonRequestParams {

@@ -10,0 +11,0 @@ offset?: number;

import { CookieJar } from "request";
import { BoxrecLocationEventParams, BoxrecLocationsPeopleParams, BoxrecRatingsParams, BoxrecResultsParams, BoxrecRole, BoxrecScheduleParams, BoxrecSearchParams, BoxrecStatus, BoxrecTitlesParams } from "./boxrec-requests.constants";
import { BoxrecLocationEventParams, BoxrecLocationsPeopleParams, BoxrecRatingsParams, BoxrecResultsParams, BoxrecRole, BoxrecScheduleParams, BoxrecSearchParams, BoxrecStatus, BoxrecTitlesParams, ScoreCard } from "./boxrec-requests.constants";
/**

@@ -132,2 +132,23 @@ * Makes API requests to BoxRec and returns the HTML body

/**
* Makes a request to BoxRec to list all the scores of the user
* @param jar contains cookie information about the user
* @returns {Promise<string>}
*/
static listScores(jar: CookieJar): Promise<string>;
/**
* Makes a request to BoxRec to list all the scores of a single bout (including the user and fans)
* @param jar contains cookie information about the user
* @param boutId the ID of the bout
* @returns {Promise<string>}
*/
static getScoresByBoutId(jar: CookieJar, boutId: number): Promise<string>;
/**
* Makes a request to BoxRec to update the user's score of a bout
* @param jar contains cookie information about the user
* @param boutId the ID of the bout
* @param scorecard an array of numbers that represent the points for each fighter per round
* @returns {Promise<string>}
*/
static updateScoreByBoutId(jar: CookieJar, boutId: number, scorecard: ScoreCard): Promise<string>;
/**
* Makes a request to BoxRec to the specific title URL to get a belt's history

@@ -134,0 +155,0 @@ * @param jar contains cookie information about the user

@@ -374,2 +374,60 @@ "use strict";

/**
* Makes a request to BoxRec to list all the scores of the user
* @param jar contains cookie information about the user
* @returns {Promise<string>}
*/
BoxrecRequests.listScores = function (jar) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, helpers_1.requestWrapper({
jar: jar,
method: "GET",
url: "https://boxrec.com/en/my_scores",
})];
});
});
};
/**
* Makes a request to BoxRec to list all the scores of a single bout (including the user and fans)
* @param jar contains cookie information about the user
* @param boutId the ID of the bout
* @returns {Promise<string>}
*/
BoxrecRequests.getScoresByBoutId = function (jar, boutId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, helpers_1.requestWrapper({
jar: jar,
method: "GET",
url: "https://boxrec.com/en/scoring/" + boutId,
})];
});
});
};
/**
* Makes a request to BoxRec to update the user's score of a bout
* @param jar contains cookie information about the user
* @param boutId the ID of the bout
* @param scorecard an array of numbers that represent the points for each fighter per round
* @returns {Promise<string>}
*/
BoxrecRequests.updateScoreByBoutId = function (jar, boutId, scorecard) {
return __awaiter(this, void 0, void 0, function () {
var qs;
return __generator(this, function (_a) {
qs = {};
scorecard.forEach(function (round, idx) {
qs["a" + (idx + 1)] = "" + round[0];
qs["b" + (idx + 1)] = "" + round[1];
});
return [2 /*return*/, helpers_1.requestWrapper({
jar: jar,
method: "GET",
qs: qs,
url: "https://boxrec.com/en/scoring/historical/submit/" + boutId,
})];
});
});
};
/**
* Makes a request to BoxRec to the specific title URL to get a belt's history

@@ -469,3 +527,3 @@ * @param jar contains cookie information about the user

return __awaiter(this, void 0, void 0, function () {
var boxrecDomain, jar, options, data, errorMessage, requiredCookies;
var boxrecDomain, jar, options, data, errorMessage, $, requiredCookies;
return __generator(this, function (_a) {

@@ -498,3 +556,3 @@ switch (_a.label) {

data = _a.sent();
errorMessage = "";
errorMessage = null;
// if the user hasn't given consent, the user is redirected to a page that contains `gdpr`

@@ -504,12 +562,10 @@ if (data.request.uri.pathname.includes("gdpr")) {

}
// the following are when login has failed
// an unsuccessful login returns a 200, we'll look for phrases to determine the error
if (data.body.includes("your password is incorrect")) {
errorMessage = "Your password is incorrect";
if (!errorMessage) {
$ = cheerio.load(data.body);
if ($("input#username").length) {
errorMessage = "Please check your credentials, could not log into BoxRec";
}
}
if (data.body.includes("username does not exist")) {
errorMessage = "Username does not exist";
}
if (data.statusCode !== 200 || errorMessage !== "") {
throw new Error(errorMessage);
throw new Error(errorMessage || "unknown error");
}

@@ -516,0 +572,0 @@ requiredCookies = ["PHPSESSID", "REMEMBERME"];

2

package.json
{
"name": "boxrec-requests",
"version": "5.2.1",
"version": "5.2.2",
"description": "make API requests to BoxRec using NodeJS and returns the HTML body",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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