{"id":"nightcycle/midas","name":"midas","scope":"nightcycle","platform":"roblox","description":"Turn every game you touch to gold with a comprehensive analytics suite. ","version":"5.4.6","latest":"5.4.6","versions":["4.0.0","4.0.1","4.0.2","4.1.0","4.2.0","4.2.1","4.2.2","4.2.3","4.2.4","4.2.5","4.2.6","5.0.0","5.0.1","5.1.0","5.1.1","5.2.0","5.3.0","5.4.0","5.4.1","5.4.2","5.4.3","5.4.4","5.4.5","5.4.6"],"license":"Apache-2.0","licenseRating":"safe","licenseCaveats":["Modified files must carry a notice of changes. If the package ships a NOTICE file, its attributions must be preserved.","License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{"nightcycle/compression-util":{"version":"^4.1.1","alias":"CompressionUtil"},"boatbomber/hashlib":{"version":"^1.0.0","alias":"HashUtil"},"nightcycle/maid":{"version":"^2.0.0","alias":"Maid"},"nightcycle/network-util":{"version":"^1.7.0","alias":"NetworkUtil"},"nightcycle/queue":{"version":"^2.3.0","alias":"Queue"},"nightcycle/service-proxy":{"version":"^1.0.0","alias":"ServiceProxy"},"nightcycle/signal":{"version":"^1.0.2","alias":"Signal"},"nightcycle/table-util":{"version":"^1.1.0","alias":"TableUtil"}},"integrity":"d20be771b43e6e5a7e29c3ea3c56bbaa1d2a1d49013ae671b769ae86f4d6ea76","likes":0,"downloads":0,"install":"forest install nightcycle/midas","url":"https://forest.dev/p/roblox/nightcycle/midas","files":"https://api.forest.dev/ai/package/roblox/nightcycle/midas/files","readme":"# Midas Wally Package\r\nThis 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.\r\n\r\n## Usage\r\nTo 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.\r\n\r\n### 1. Initialize Midas\r\n```lua\r\n\r\n\tMidas.init()\r\n\tMidas.ProjectId = \"abcdef1234567\"\r\n\r\n```\r\n\r\n### 2. Define a Storage Solution\r\n\r\n#### MongoDB\r\nOne solution I personally use is MongoDB Atlas. You can read how to set that up [here](https://www.mongodb.com/docs/atlas/getting-started/), 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](https://www.mongodb.com/try/download/shell) MongoDB tools and solutions for that as well.\r\n\r\n```lua\r\n\tlocal mongoDB = Midas.StorageProviders.MongoDB.new(\r\n\t\t\"api-key-123\", \r\n\t\t\"https://us-east-2.aws.data.mongodb-api.com/app/data-abcdef\"\r\n\t)\r\n\tmongoDB.DebugPrintEnabled = RunService:IsStudio()\r\n\tMidas:SetOnBatchInsertInvoke(\r\n\t\tfunction(\r\n\t\t\tprojectId: string,\r\n\t\t\tdataSetId: string,\r\n\t\t\tdataTableId: string,\r\n\t\t\tdataList: { [number]: { [string]: unknown } },\r\n\t\t\tformat: { [string]: DataType },\r\n\t\t\tonPayloadSizeKnownInvoke:(number) -> ()\r\n\t\t): boolean\r\n\t\t\treturn mongoDB:InsertMany(\r\n\t\t\t\tprojectId, \r\n\t\t\t\tdataSetId, \r\n\t\t\t\tdataTableId, \r\n\t\t\t\tdataList, \r\n\t\t\t\tformat, \r\n\t\t\t\tonPayloadSizeKnownInvoke\r\n\t\t\t)\r\n\t\tend\r\n\t)\r\n```\r\n\r\n### 3. Define a Table\r\n```lua\r\n\t-- midas accepts the rowData as a variadic type, allowing you to have type safety when recording data\r\n\ttype RowData = {\r\n\t\tserver_id: string,\r\n\t\tsession_id: string,\r\n\t\ttimestamp: DateTime,\r\n\t\tuser_id: number,\r\n\t\tis_premium: boolean,\r\n\t\tfriends_in_game: number?,\r\n\t\tpos_x: number?,\r\n\t\tpos_y: number?,\r\n\t}\r\n\r\n\t-- level of organization for datatables\r\n\tlocal dataSet = Midas:CreateDataSet(\"UserData\", \"abc123\")\r\n\r\n\t-- a table with rows and columns\r\n\tlocal dataTable = dataSet:CreateDataTable(\"Session\", \"def456\") :: Midas.DataTable<RowData>\r\n\tdataTable:AddColumn(\"server_id\", \"String\", false)\r\n\tdataTable:AddColumn(\"session_id\", \"String\", false)\r\n\tdataTable:AddColumn(\"timestamp\", \"Date\", false)\r\n\tdataTable:AddColumn(\"user_id\", \"Int64\", false)\r\n\tdataTable:AddColumn(\"friends_in_game\", \"Int32\", true)\r\n\tdataTable:AddColumn(\"is_premium\", \"boolean\", false)\r\n\tdataTable:AddColumn(\"pos_x\", \"Double\", true)\r\n\tdataTable:AddColumn(\"pos_z\", \"Double\", true)\r\n\r\n```\r\n\r\n### 4. Add Rows\r\n```lua\r\n\tlocal playerPosition: Vector3?\r\n\r\n\tdataTable:AddRow({\r\n\t\tserver_id = game.JobId,\r\n\t\tsession_id = \"abc-123\",\r\n\t\ttimestamp = DateTime.now(),\r\n\t\tuser_id = 123456,\r\n\t\tis_premium = true,\r\n\t\tfriends_in_game = nil,\r\n\t\tpos_x = if playerPosition then playerPosition.X else nil,\r\n\t\tpos_z = if playerPosition then playerPosition.Z else nil,\r\n\t})\r\n\r\n```\r\n\r\n### 5. Post\r\n\r\n#### Manual\r\nIf you want to post all tables at once you can\r\n```lua\r\n\tMidas:Post(50, 400, 1, false)\r\n```\r\n\r\nOtherwise if you want to post a specific table that is available as well.\r\n```lua\r\n\tdataTable:Post(50, 400)\r\n```\r\n\r\n#### Automated\r\nIf you just want to forget about posting, you can tell Midas to try to manage it for you.\r\n```lua\r\n\tMidas:Automate(RunService:IsStudio())\r\n```\r\n\r\n","readmeTruncated":false}