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

aki-api

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aki-api - npm Package Compare versions

Comparing version 6.0.7 to 6.0.8

16

dist/src/Akinator.js

@@ -38,3 +38,3 @@ "use strict";

async start() {
const server = await functions_1.regionURL(this.region);
const server = await (0, functions_1.regionURL)(this.region);
if (!server)

@@ -44,3 +44,3 @@ throw new Error(`Could not find a server matching the region ${this.region}`);

this.urlApiWs = server.urlWs;
this.uriObj = await functions_1.getSession();
this.uriObj = await (0, functions_1.getSession)();
if (this.uriObj instanceof Error) {

@@ -51,3 +51,4 @@ throw this.uriObj;

this.frontaddr = this.uriObj.frontaddr;
const result = await functions_1.request(`${this.uri}/new_session?callback=${Client_1.jQuery + new Date().getTime()}&urlApiWs=${this.urlApiWs}&partner=1&childMod=${this.childMode.childMod}&player=website-desktop&uid_ext_session=${this.uid}&frontaddr=${this.frontaddr}&constraint=ETAT<>'AV'&soft_constraint=${this.childMode.softConstraint}&question_filter=${this.childMode.questionFilter}`, 'identification', this.region);
const url = `${this.uri}/new_session?callback=${Client_1.jQuery + new Date().getTime()}&urlApiWs=${this.urlApiWs}&partner=1&childMod=${this.childMode.childMod}&player=website-desktop&uid_ext_session=${this.uid}&frontaddr=${this.frontaddr}&constraint=ETAT<>'AV'&soft_constraint=${this.childMode.softConstraint}&question_filter=${this.childMode.questionFilter}`;
const result = await (0, functions_1.request)(url, 'identification', this.region, this.config);
if (result instanceof functions_1.AkinatorAPIError) {

@@ -74,3 +75,4 @@ throw result;

throw new Error(this.noSession);
const result = await functions_1.request(`${this.uri}/answer_api?callback=${Client_1.jQuery + new Date().getTime()}&urlApiWs=${this.urlApiWs}&childMod=${this.childMode.childMod}&session=${this.session}&signature=${this.signature}&step=${this.currentStep}&answer=${answerID}&frontaddr=${this.frontaddr}&question_filter=${this.childMode.questionFilter}`, 'answers', this.region);
const url = `${this.uri}/answer_api?callback=${Client_1.jQuery + new Date().getTime()}&urlApiWs=${this.urlApiWs}&childMod=${this.childMode.childMod}&session=${this.session}&signature=${this.signature}&step=${this.currentStep}&answer=${answerID}&frontaddr=${this.frontaddr}&question_filter=${this.childMode.questionFilter}`;
const result = await (0, functions_1.request)(url, 'answers', this.region, this.config);
if (result instanceof functions_1.AkinatorAPIError) {

@@ -95,3 +97,4 @@ throw result;

throw new Error(this.noSession);
const result = await functions_1.request(`${this.urlApiWs}/cancel_answer?&callback=${Client_1.jQuery + new Date().getTime()}&session=${this.session}&childMod=${this.childMode.childMod}&signature=${this.signature}&step=${this.currentStep}&answer=-1&question_filter=${this.childMode.questionFilter}`, 'answers', this.region);
const url = `${this.urlApiWs}/cancel_answer?&callback=${Client_1.jQuery + new Date().getTime()}&session=${this.session}&childMod=${this.childMode.childMod}&signature=${this.signature}&step=${this.currentStep}&answer=-1&question_filter=${this.childMode.questionFilter}`;
const result = await (0, functions_1.request)(url, 'answers', this.region, this.config);
if (result instanceof functions_1.AkinatorAPIError) {

@@ -116,3 +119,4 @@ throw result;

throw new Error(this.noSession);
const result = await functions_1.request(`${this.urlApiWs}/list?callback=${Client_1.jQuery + new Date().getTime()}&signature=${this.signature}${this.childMode.childMod === true ? `&childMod=${this.childMode.childMod}` : ''}&step=${this.currentStep}&session=${this.session}`, 'elements', this.region);
const url = `${this.urlApiWs}/list?callback=${Client_1.jQuery + new Date().getTime()}&signature=${this.signature}${this.childMode.childMod === true ? `&childMod=${this.childMode.childMod}` : ''}&step=${this.currentStep}&session=${this.session}`;
const result = await (0, functions_1.request)(url, 'elements', this.region, this.config);
if (result instanceof functions_1.AkinatorAPIError) {

@@ -119,0 +123,0 @@ throw result;

@@ -71,4 +71,5 @@ "use strict";

// example output: jQuery331023608747682107778_1615444627875({"completion":"OK","parameters":{"identification":{"channel":0,"session":"459","signature":"223731835","challenge_auth":"8ebe521c-5991-4625-b081-6066352649e5"},"step_information":{"question":"Does your character really exist?","answers":[{"answer":"Yes"},{"answer":"No"},{"answer":"Don't know"},{"answer":"Probably"},{"answer":"Probably not"}],"step":"0","progression":"0.00000","questionid":"266","infogain":"0.607602"}}}
const request = async (url, checkParamProperty, region) => {
const { status, data } = await axios_1.default.get(url, { headers, params });
const request = async (url, checkParamProperty, region, config) => {
const axiosConfig = (config || {});
const { status, data } = await axios_1.default.get(url, Object.assign({ headers, params }, axiosConfig));
if (status !== 200 || !data) {

@@ -75,0 +76,0 @@ throw new Error(`A problem occurred with making the request. status: ${status}`);

{
"author": "Joshua Goralczyk",
"version": "6.0.7",
"version": "6.0.8",
"main": "./dist/src/index.js",

@@ -39,9 +39,9 @@ "types": "typings/src/index.d.ts",

"devDependencies": {
"@types/node": "^16.3.1",
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"@types/node": "^16.7.10",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"eslint": "^7.30.0",
"ts-node": "^10.2.0",
"typescript": "^4.3.5"
"ts-node": "^10.2.1",
"typescript": "^4.4.2"
}
}
import { guess } from './functions';
import { region } from './constants/Client';
import { HttpsProxyAgent, HttpsProxyAgentOptions } from 'https-proxy-agent';
import { HttpsProxyAgentOptions } from 'https-proxy-agent';
import { configOptions } from './functions/Request';
interface AkinatorConstructor {

@@ -36,6 +37,3 @@ region: region;

guessCount: number;
config: {
httpsAgent: HttpsProxyAgent | undefined;
proxy: boolean;
} | undefined;
config: configOptions;
constructor({ region, childMode, proxyOptions }: AkinatorConstructor);

@@ -42,0 +40,0 @@ /**

@@ -0,1 +1,2 @@

import { HttpsProxyAgent } from 'https-proxy-agent';
import { region } from '../constants/Client';

@@ -81,3 +82,7 @@ export declare type guess = {

}
export declare const request: (url: string, checkParamProperty: checkParamProperty, region: "en" | "en_objects" | "en_animals" | "ar" | "cn" | "de" | "de_animals" | "es" | "es_animals" | "fr" | "fr_objects" | "fr_animals" | "il" | "it" | "it_animals" | "jp" | "jp_animals" | "kr" | "nl" | "pl" | "pt" | "ru" | "tr" | "id") => Promise<AkinatorAPIError | AkinatorResult>;
export declare type configOptions = {
httpsAgent: HttpsProxyAgent | undefined;
proxy: boolean;
} | undefined;
export declare const request: (url: string, checkParamProperty: checkParamProperty, region: "en" | "en_objects" | "en_animals" | "ar" | "cn" | "de" | "de_animals" | "es" | "es_animals" | "fr" | "fr_objects" | "fr_animals" | "il" | "it" | "it_animals" | "jp" | "jp_animals" | "kr" | "nl" | "pl" | "pt" | "ru" | "tr" | "id", config: configOptions) => Promise<AkinatorAPIError | AkinatorResult>;
/**

@@ -84,0 +89,0 @@ * Returns the url from the correct region.

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