{"id":"paramacode/vault","name":"vault","scope":"paramacode","platform":"roblox","description":"A resource management system for Roblox with automatic cleanup","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"e0cb4807a3da6c9cd7d3b57dd55e3cf196e105319fcd5b8585f2d6c89526d15b","likes":0,"downloads":0,"install":"forest install paramacode/vault","url":"https://forest.dev/p/roblox/paramacode/vault","files":"https://api.forest.dev/ai/package/roblox/paramacode/vault/files","readme":"# VAULT\n\n**Vault** is a high-performance, type-safe resource management library for Roblox Luau. It provides automatic cleanup of connections, instances, promises, threads, and custom objects with intelligent method detection, hierarchical organization, and zero memory leaks.\n\n## FEATURES\n\n### High Performance\n- **`--!optimize 2 --!strict`** compiler flags for maximum runtime efficiency\n- **`rawget()` direct lookups** bypass table prototype chains for method detection\n- **Global `CLEANUP_CACHE`** stores cleanup functions by `typeof()` - no recreation overhead\n- **Sequential numeric tokens** enable O(1) `Add()`/`Remove()` operations\n- **Weak metatable** (`__mode = 'k'`) for automatic internal state cleanup\n- **O(1) critical path**: `Add`, `Remove`, `Size`, `Contains` operations\n\n### Type Safe\n- **15+ `CleanableObject` union types**: Instance, RBXScriptConnection, Promise, thread, functions\n- **Generic signal support**: `<T...>` for RBXScriptSignal + CustomSignal\n- **Constructor generics**: `<T, A...>` with perfect type inference\n- **Metatable method detection** with full `__index` support\n\n### Hierarchical Management\n```\nMainVault\n├── Child1 (Extend)\n│   └── DeferredScope (Defer)\n├── Child2 (Extend)  \n└── ImportedVault (Import)\n```\n- **Automatic cascade cleanup** - `Clean()` recursively cleans all children\n- **Parent-child unlink** - children automatically removed from parent array\n- **Scoped inheritance** - children inherit parent's cleanup lifecycle\n\n### Intelligent Detection\n```\nDetection Priority (fast → slow):\n1. Custom CleanupStrategy (function or method string)\n2. typeof() cached cleanup (Instance→Destroy(), RBXScriptConnection→Disconnect())\n3. Promise status validation (getStatus() + cancel if 'Started')\n4. Direct methods: Destroy/destroy, Disconnect/disconnect\n5. Metatable.__index: Destroy/destroy, Disconnect/disconnect\n```\n\n## API COMPLEXITY\n\n| Operation | Complexity | Description |\n|-----------|------------|-------------|\n| `Add()` | O(1) | Token assignment + hash insert |\n| `Remove()` | O(1) | Token/object lookup + hash remove |\n| `Clean()` | O(n) | Required for deterministic cleanup |\n| `Connect()` | O(1) | Signal connection + auto-add |\n| `Size()` | O(1) | Cached entry counter |\n\n**Vault guarantees zero memory leaks with deterministic cleanup across all Roblox resource types while maintaining industry-leading performance.**","readmeTruncated":false}