npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

universalis.js

v2.0.0

Published

Promise-based Node.js wrapper for the FFXIV market board aggregator, Universalis

Downloads

5

Readme

universalis.js

universalis.js is a promise-driven wrapper for the Universalis API, written in Node.js.

Universalis is a crowd-sourced aggregator of market board data for FFXIV. This package is unofficial and is not supported by the Universalis developers.

Installation

npm i universalis.js --save

Usage & Examples

Import and initialize the module:

import Universalis from 'universalis.js'
const uni = new Universalis()

.getListings(worldDcRegion, itemIds, options)

Retrieves the current listings for an item. This data includes the quality, price, quantity and the time that the listing was created.

Parameters

worldDcRegion [string]

A specific world (e.g. Cerberus) or data center (e.g. Chaos) that you wish to retrieve the data for. Providing a data center will return data for all worlds within it.

itemIds [string][array]

An ID that corresponds to an item. IDs can be found via the Universalis app or via the marketableItems method.

By providing an array of IDs, you can retrieve data for multiple items at once. Make sure to do this to prevent hitting rate limits and to maximize performance.

options [object]

An object that contains the optional parameters that can be used to refine your results. These options include: listingLimit, tax, hq listingLimit [number]: The amount of listings that should be returned. The listings will be ordered by price from lowest to highest. tax [boolean]: If city-state tax should be included in the total price for each listing. hq [boolean]: If listings should be limited to HQ items only.

Example

Retrieve 10 HQ listings on the world 'Cerberus' for the item 'Fat Cat' (9347)

const getFatCatListings = async () => {
	const listings = await uni.getListings('cerberus', '9347', { hq: true, listingLimit: 10 })
}

.sortListingsByWorld(listings)

Sorts listings into an associative array with data grouped by world name.

Parameters

listings [array]

Data returned from the getListings method.

Example

Retrieve listings on the data center 'Chaos' for the item 'Fat Cat' (9347) and sort them by world.

const getFatCatListings = async () => {
	const listings = await uni.getListings('chaos', '9347')
	const sorted = uni.sortListingsByWorld(listings)
	// access listings on Spriggan:
	sorted['Spriggan']
}

.getSales(worldDcRegion, itemIds)

Retrieves the previous sales for an item. This includes the quality, price, quantity and time of the sale.

Parameters

worldDcRegion [string]

A specific world (e.g. Cerberus) or data center (e.g. Chaos) that you wish to retrieve the data for. Providing a data center will return data for all worlds within it.

itemIds [string][array]

An ID that corresponds to an item. IDs can be found via the Universalis app or via the marketableItems method.

By providing an array of IDs, you can retrieve data for multiple items at once. Make sure to do this to prevent hitting rate limits and to maximize performance.

Example

Retrieve previous sales on the world 'Cerberus' for the item 'Fat Cat' (9347)

const getFatCatSales = async () => {
	const sales = await uni.getSales('cerberus', '9347')
}

.sortSalesByDay(sales)

Sorts sales into an associative array with data grouped by the date of sale. Dates are in the YYYY-MM-DD format.

Parameters

sales [array]

Data returned from the getSales method.

Example

Retrieve sales on the world 'Cerberus' for the item 'Fat Cat' (9347) and sort them by the date of sale. Dates are in the YYYY-MM-DD format.

const getFatCatSales = async () => {
	const sales = await uni.getSales('cerberus', '9347')
	const sorted = uni.sortSalesByDay(sales)
	// access all sales on 2019-04-22:
	sorted['2019-04-22']
}

.validateMarketableItem(itemId)

Checks if a provided item ID can be sold on the market board. Returns either true or false.

Parameters

itemId [string]

The item ID that you wish to validate.

.getTaxRates(world)

Retrieves the tax rates for each city in which your retainers can list items on the market board.

Parameters

world [string]

The world (e.g. Cerberus) that you wish to retrieve data for.

.getMarketableItems()

Retrieves an array of every ID of items that can be listed on the market board.

.getMostRecentlyUpdatedItems(worldDc, options)

Retrieves an array of recently updated items on a specific world.

In this context, recently updated means that a player who is contributing to Universalis' data has searched for the item via the market board in-game.

Parameters

worldDc [string]

The world (e.g. Cerberus) or data center (e.g. Chaos) that you wish to retrieve data for.

options [object]

An object that contains the optional parameters that can be used to refine your results. Currently, these options only include: entries [int]: The amount of results to return. Valid values range from 1-200. Defaults to 50.

.getLeastRecentlyUpdatedItems(worldDc, options)

Retrieves an array of recently updated items on a specific world.

In this context, recently updated means that a player who is contributing to Universalis' data has searched for the item via the market board in-game.

Parameters

worldDc [string]

The world (e.g. Cerberus) or data center (e.g. Chaos) that you wish to retrieve data for.

options [object]

An object that contains the optional parameters that can be used to refine your results. Currently, these options only include: entries [int]: The amount of results to return. Valid values range from 1-200. Defaults to 50.

.getRecentlyUpdatedItemsLegacy()

Retrieves an array of recently updated items. This method provides no context to the data and is across every server and region.

.getUploadCounts()

Retrieves data regarding the contributions from users.

This method returns the following:

World Upload Counts

The total upload count per world and the percentage of the total data that it represents.

Upload Application Counts

The total upload count and name of each application that contributes data to Universalis.

Upload History

The number of uploads per day over the past 30 days.

Example

const getUploadData = async () => {
	const data = await uni.getUploadCounts()
	const worldCounts = data[0]
	const applicationCounts = data[1]
	const uploadHistory = data[2]
}