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

transporttycoon

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transporttycoon - npm Package Compare versions

Comparing version 1.0.9 to 1.1.2

1

lib/index.d.ts

@@ -35,2 +35,3 @@ import { PlayerPositions } from './models/PlayerPositions';

getUserInventoryHtml(userId: string): Promise<Players>;
getUserSkillsHtml(userId: string): Promise<Players>;
getUserBusinesses(userId: string): Promise<Business>;

@@ -37,0 +38,0 @@ getUserOwnedVehicles(userId: string): Promise<OwnedVehicles>;

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

baseURL: `http://${tycoonServers[0]}/status`,
timeout: 10000
timeout: 5000
});

@@ -62,10 +62,18 @@ if (apiToken)

}
if (error.code === 'ECONNABORTED' && error.config) {
if ((error === null || error === void 0 ? void 0 : error.code) === 'ECONNABORTED' && (error === null || error === void 0 ? void 0 : error.config)) {
this.settings.serverIndex++;
if (this.settings.serverIndex > tycoonServers.length - 1)
this.settings.serverIndex = 0;
await this.tycoon.get(`http://${tycoonServers[this.settings.serverIndex]}/status/alive`);
return axios_1.default.request(error.config);
this.tycoon.defaults.baseURL = `http://${tycoonServers[this.settings.serverIndex]}/status`;
try {
await this.tycoon.get('/alive');
error.config.baseURL = this.tycoon.defaults.baseURL;
return axios_1.default.request(error.config);
// tslint:disable-next-line: no-empty
}
catch (err) { }
}
return Promise.reject(error);
else {
return Promise.reject(error);
}
});

@@ -76,2 +84,4 @@ }

const charges = await this.tycoon.get('/charges.json');
if (!(charges === null || charges === void 0 ? void 0 : charges.data[0]))
return Promise.resolve(false);
if (charges.data[0] === 0)

@@ -176,2 +186,15 @@ return Promise.reject({ msg: '[TransportTycoon] Charges returned 0. Is your key valid & does it have charges?', code: 'no_charges' });

}
async getUserSkillsHtml(userId) {
if ((userId.length === 18 || userId.length === 17))
userId = (await this.getUserFromDiscord(userId)).user_id.toString();
try {
if (this.charges.checking && this.charges.count > 0)
this.charges.count--;
const res = await this.tycoon.get(`/skills/${userId}`);
return Promise.resolve(res.data);
}
catch (err) {
return Promise.reject(err);
}
}
async getUserBusinesses(userId) {

@@ -178,0 +201,0 @@ if ((userId.length === 18 || userId.length === 17))

2

lib/models/PlayerWidget.d.ts
interface Server {
number: string;
dxp: [active: boolean, host: string];
dxp: [active: boolean, host: string, time_remaining: number, unk: number];
motd: string;

@@ -5,0 +5,0 @@ name: string;

{
"name": "transporttycoon",
"version": "1.0.9",
"version": "1.1.2",
"description": "Wrapper for the Transport Tycoon FiveM server API",

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

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