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

@nightcycle/midas

v6.1.8

Published

Turn every game you touch to gold with a comprehensive analytics suite.

Downloads

204

Readme

Midas Wally Package

This is a package for the easy tracking and validation of analytics data. The goal is to allow you to track as much data as you want, so you can focus on solving problems with the data, rather than just storing and collecting it in the first place.

Usage

To seamlessly integrate into the most common standards of data processing workflows, Midas has pivoted away from a free structured tree of data to that of tables.

1. Initialize Midas


	Midas.init()
	Midas.ProjectId = "abcdef1234567"

2. Define a Storage Solution

MongoDB

One solution I personally use is MongoDB Atlas. You can read how to set that up here, remember to enabled the "Data API" under the "Services" menu. MongoDB offers a terabyte of storage at a reasonable price. To get the data out there are also many official MongoDB tools and solutions for that as well.

	local mongoDB = Midas.StorageProviders.MongoDB.new(
		"api-key-123", 
		"https://us-east-2.aws.data.mongodb-api.com/app/data-abcdef"
	)
	mongoDB.DebugPrintEnabled = RunService:IsStudio()
	Midas:SetOnBatchInsertInvoke(
		function(
			projectId: string,
			dataSetId: string,
			dataTableId: string,
			dataList: { [number]: { [string]: unknown } },
			format: { [string]: DataType },
			onPayloadSizeKnownInvoke:(number) -> ()
		): boolean
			return mongoDB:InsertMany(
				projectId, 
				dataSetId, 
				dataTableId, 
				dataList, 
				format, 
				onPayloadSizeKnownInvoke
			)
		end
	)

3. Define a Table

	-- midas accepts the rowData as a variadic type, allowing you to have type safety when recording data
	type RowData = {
		server_id: string,
		session_id: string,
		timestamp: DateTime,
		user_id: number,
		is_premium: boolean,
		friends_in_game: number?,
		pos_x: number?,
		pos_y: number?,
	}

	-- level of organization for datatables
	local dataSet = Midas:CreateDataSet("UserData", "abc123")

	-- a table with rows and columns
	local dataTable = dataSet:CreateDataTable("Session", "def456") :: Midas.DataTable<RowData>
	dataTable:AddColumn("server_id", "String", false)
	dataTable:AddColumn("session_id", "String", false)
	dataTable:AddColumn("timestamp", "Date", false)
	dataTable:AddColumn("user_id", "Int64", false)
	dataTable:AddColumn("friends_in_game", "Int32", true)
	dataTable:AddColumn("is_premium", "boolean", false)
	dataTable:AddColumn("pos_x", "Double", true)
	dataTable:AddColumn("pos_z", "Double", true)

4. Add Rows

	local playerPosition: Vector3?

	dataTable:AddRow({
		server_id = game.JobId,
		session_id = "abc-123",
		timestamp = DateTime.now(),
		user_id = 123456,
		is_premium = true,
		friends_in_game = nil,
		pos_x = if playerPosition then playerPosition.X else nil,
		pos_z = if playerPosition then playerPosition.Z else nil,
	})

5. Post

Manual

If you want to post all tables at once you can

	Midas:Post(50, 400, 1, false)

Otherwise if you want to post a specific table that is available as well.

	dataTable:Post(50, 400)

Automated

If you just want to forget about posting, you can tell Midas to try to manage it for you.

	Midas:Automate(RunService:IsStudio())