{"id":"qaptivator/capstore","name":"capstore","scope":"qaptivator","platform":"roblox","description":"Roblox Library to easily setup simple data storing","version":"0.1.8","latest":"0.1.8","versions":["0.1.0","0.1.4","0.1.5","0.1.6","0.1.7","0.1.8"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"nidoxs/profileservice":{"version":"^1.0.0","alias":"profileservice"},"evaera/promise":{"version":"^4.0.0","alias":"promise"},"brittonfischer/replicaservice":{"version":"^0.1.0","alias":"replicaservice"},"sleitnick/signal":{"version":"^1.5.0","alias":"signal"}},"integrity":"6c50e96019e8afd7a5d3a197b537e94f26dc517950413e42abc75c1832075f32","likes":0,"downloads":0,"install":"forest install qaptivator/capstore","url":"https://forest.dev/p/roblox/qaptivator/capstore","files":"https://api.forest.dev/ai/package/roblox/qaptivator/capstore/files","readme":"# CapStore\r\n\r\nRoblox Library to easily setup simple data storing.\r\nThis library uses ProfileService along with ReplicaService.\r\nMade by captivater.\r\n\r\n<p>\r\n  <a href=\"https://wally.run/package/qaptivator/capstore?version=0.1.8\">\r\n    <img alt=\"Wally\" src=\"https://img.shields.io/badge/Wally-0.1.8-AD4646\" />\r\n  </a>\r\n  <a href=\"https://www.roblox.com/library/13779687697/CapStore\">\r\n    <img alt=\"Roblox\" src=\"https://img.shields.io/badge/Roblox-CapStore-blue\" />\r\n  </a>\r\n</p>\r\n\r\n# Features\r\n\r\nHere are the main features of CapStore, which show why should you use this library.\r\n\r\n- Really easy setup\r\n- Datastore handling using ProfileService\r\n- Server-to-client profile replication using ReplicaService\r\n- Support for global updates from ProfileService\r\n- Leaderstats for data display (COMING SOON)\r\n\r\n# Installation\r\n\r\nWally:\r\n\r\n```toml\r\ncapstore = \"qaptivator/capstore@0.1.8\"\r\n```\r\n\r\nRoblox studio model:\r\nhttps://www.roblox.com/library/13779687697/CapStore\r\n\r\n# Usage\r\n\r\n1. Install the module\r\n2. Require the module on server and client side\r\n3. Initialize both sides of CapStore using CapStore.Initialize()\r\n\r\n**WARNING: The default ProfileStore name had been changed, so the data saved on versions before and on 0.1.7 would remain on the old ProfileStore**\r\n\r\n# Profiles and Replicas\r\n\r\nProfile is the object which holds the player data. It will be saved to DataStores when player leaves the game.\r\nReplicas are objects, which replicate the profile from server to client side using events.\r\nProfiles should be used only for reading, because writing something to it will not replicate to the client,\r\nwhich will cause issues. Writing to replicas can be done using built-in mutators of ReplicaService.\r\n\r\nIn this module, you cannot get the player profile from client side,\r\nonly using listeners and on initalization of the replica.\r\nBut you can make is yourself using RemoteFunctions and some server code.\r\nListening to the changes can be done using built-in listeners of ReplicaService.\r\nYou can also get the initialized data from the replica.\r\nReplicas can be used for something like currency counters, because they only need to update on initalization and data changes.\r\n\r\nEvery mutator and listener is arleady documented and explained at the [ReplicaService API](https://madstudioroblox.github.io/ReplicaService/api/)\r\n\r\n# API\r\n\r\n## Server-side\r\n\r\n### CapStore.Initialize(profileTemplate: { any })\r\n\r\nInitializes the CapStore on the server-side. You should provide a template which\r\nnew profiles will default to when no data was saved previously.\r\nYou should call this function before everything you do in CapStore server-side.\r\nReturns nothing.\r\n\r\n### CapStore.GetReplica(player: Player | number)\r\n\r\nGets replica of provided player. Returns a promise. You can also use UserId instead of Player instance.\r\nYou can modify and sync the player data using built-in replica mutators of ReplicaService.\r\nYou can skip the `player` parameter and it will return the replica of every player in server.\r\n\r\n### CapStore.GetProfile(player: Player | number)\r\n\r\nGets profile of provided player. Returns a promise. You can also use UserId instead of Player instance.\r\nIt's not recommended to change the data directly in Profile.\r\nIf you do so, it will not replicate to the player.\r\nYou can skip the `player` parameter and it will return the profile of every player in server.\r\n\r\n### CapStore.CreateGlobalUpdates(player: Player | number, callback: (any) -> ())\r\n\r\nWrapper function for `ProfileStore:GlobalUpdateProfileAsync()`. You can also use UserId instead of Player instance.\r\nRead more about ProfileService's global updates on their [API](https://madstudioroblox.github.io/ProfileService/api/#global-updates).\r\n\r\n### CapStore.Initialized\r\n\r\nSignal which fires when the server-side CapStore was finished initializing.\r\n\r\n### CapStore.HandleLockedUpdate\r\n\r\nSignal which fires when the there is a new locked update received. As arguments, it gives the update data, player's profile and the player. Read more about ProfileService's locked updates on their [API](https://madstudioroblox.github.io/ProfileService/api/#global-updates).\r\n\r\n## Client-side\r\n\r\n### CapStore.Initialize()\r\n\r\nInitializes the CapStore on the client-side.\r\nYou should call this function before everything you do in CapStore Client-side.\r\nReturns nothing.\r\n\r\n### CapStore.GetReplica()\r\n\r\nGets the replica of the current player (client). Returns a promise.\r\nYou can listen for the data changes using built-in listeners of ReplicaService.\r\n\r\n### CapStore.ReplicaCreated\r\n\r\nSignal which fires when the client-side CapStore had received the created replica for profile synchronization.\r\n","readmeTruncated":false}