{"_id":"@afranioalves/memory-client","_rev":"6-ec10b8c40d9af3725d06f9fd38289d56","name":"@afranioalves/memory-client","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@afranioalves/memory-client","version":"1.0.0","keywords":["indexeddb","storage","memory","browser","react","nextjs"],"author":{"name":"Afrânio"},"license":"MIT","_id":"@afranioalves/memory-client@1.0.0","maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"dist":{"shasum":"d9ed6987658b83f86eacc6cf5ff3fde3094b8e79","tarball":"https://registry.npmjs.org/@afranioalves/memory-client/-/memory-client-1.0.0.tgz","fileCount":5,"integrity":"sha512-J/IJHi+v4dLaGowGhU/VmHNsQzIPZCMGBkgG+k+L57m5VB64SIIm1sEgIiq9BMRfPogJtpi4A+Ra1I/GjEUy8Q==","signatures":[{"sig":"MEUCIQDsmeBAl63jDTqyJL38r3J2Do2m6KpAGUdZYoE+6BN86gIgICOm69cdZy48ypUMr+l+gSb9F7p5nGRjyr0reYliqVg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8338},"main":"src/index.js","type":"module","exports":{".":"./src/index.js"},"gitHead":"6d2d5217f6ff00bac6db467887b57ba10717f24f","_npmUser":{"name":"afranio","email":"afranio777alves@gmail.com"},"_npmVersion":"10.9.2","description":"A simple memory management system using indexedDB files.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/memory-client_1.0.0_1760628597879_0.10862442056753885","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@afranioalves/memory-client","version":"1.0.1","keywords":["indexeddb","storage","memory","browser","react","nextjs"],"author":{"name":"Afrânio"},"license":"MIT","_id":"@afranioalves/memory-client@1.0.1","maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"dist":{"shasum":"02ea91fbf69498ca420ef744bf60e35d43395ea5","tarball":"https://registry.npmjs.org/@afranioalves/memory-client/-/memory-client-1.0.1.tgz","fileCount":5,"integrity":"sha512-4Ii6hQ5avEbFLcYmbV57M2U0bc+Hwa3HQ6DJNXiWZWtSsk80hqMaKFJbNVfffy/NLO0XHBWXxFRf8EvwqXhTmQ==","signatures":[{"sig":"MEQCIHqNni9BSWfM9NWNQTJxcnr0SGsUhfaOEm0XrkgTPFtbAiACtPT1GgYVcSQn+qSIVDzTlhbWF6qxwKs1Xj43f8IUkQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8374},"main":"src/index.js","type":"module","exports":{".":"./src/index.js"},"gitHead":"6c6d5565a75d7de73047cfe56547a0024714e072","_npmUser":{"name":"afranio","email":"afranio777alves@gmail.com"},"_npmVersion":"10.9.2","description":"A simple memory management system using indexedDB files.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/memory-client_1.0.1_1760628873613_0.24025366915495616","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@afranioalves/memory-client","version":"1.0.2","keywords":["indexeddb","storage","memory","browser","react","nextjs"],"author":{"name":"Afrânio"},"license":"MIT","_id":"@afranioalves/memory-client@1.0.2","maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"dist":{"shasum":"9b8fa577df7c904a0c052aea19801d62243b923d","tarball":"https://registry.npmjs.org/@afranioalves/memory-client/-/memory-client-1.0.2.tgz","fileCount":5,"integrity":"sha512-9dQKgW5FctE2pEqOYJZnWkQnKmZlkQf1JO638knADaQbOsNwij2QUGOm/uh8RedA0hlPaJOiwDJ8QRtf8Vtm7w==","signatures":[{"sig":"MEQCIHvOC+FrrHSh+ue/WOWqhon5ukksu7PxvKItcjAYgAE/AiBeOJ9O7I+vJoG4Z0hKEjvTkd/Y1E1hhngg3FunL9o2uQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9668},"main":"src/index.js","type":"module","exports":{".":"./src/index.js"},"gitHead":"0d8209608dc04c0954f53cd087170f52cd857417","_npmUser":{"name":"afranio","email":"afranio777alves@gmail.com"},"_npmVersion":"10.9.2","description":"A simple memory management system using indexedDB files.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/memory-client_1.0.2_1760629448106_0.09774316442197684","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@afranioalves/memory-client","version":"1.0.3","keywords":["indexeddb","storage","memory","browser","react","nextjs"],"author":{"name":"Afrânio"},"license":"MIT","_id":"@afranioalves/memory-client@1.0.3","maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"dist":{"shasum":"0c9ddb0a684b514058a720193465dccbc0bbee88","tarball":"https://registry.npmjs.org/@afranioalves/memory-client/-/memory-client-1.0.3.tgz","fileCount":5,"integrity":"sha512-tsfYqwSHrFcQtPGY2nlsIj6V6Td0JTkO8uDEKxXwMbOYujDMoh2aROHnrV38EbqyM0ieACY1x1sL7VCzrPn73g==","signatures":[{"sig":"MEQCIEH1Flw++hRAFSa/zDbGnxa4PgwOLzZY9q5tLcUW32EOAiBt8+66fjSiqiBGRoUGxZPp0vFmNxNle5HxWCUZ1I2Hrw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9657},"main":"src/index.js","type":"module","exports":{".":"./src/index.js"},"gitHead":"0b1e4ef442fa5fe4305f35e72a85936deb5803ec","_npmUser":{"name":"afranio","email":"afranio777alves@gmail.com"},"_npmVersion":"10.9.2","description":"A simple memory management system using indexedDB files.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/memory-client_1.0.3_1760673432937_0.37289044764820445","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@afranioalves/memory-client","version":"1.0.4","keywords":["indexeddb","storage","memory","browser","react","nextjs","client-storage","typescript","browser-db","memory"],"author":{"name":"Afrânio"},"license":"MIT","_id":"@afranioalves/memory-client@1.0.4","maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"dist":{"shasum":"d87371bf598e5240fb1fad9c0a5ef7e288a77cc0","tarball":"https://registry.npmjs.org/@afranioalves/memory-client/-/memory-client-1.0.4.tgz","fileCount":11,"integrity":"sha512-jIuVxbzeloPHSgRs2mBsvysvXyJ+sU5lq5D71kie/WiIsqwfWMVRjMW5kYAIz25KSGJmKlmyU730f849LMdxjg==","signatures":[{"sig":"MEYCIQDW3/4sGMOgViFb1DlwH2BF/+Nu1UFIW+S/VijGHzaJVAIhAMPbTh3unfzAfECDgLlliEupxr4/JErKW992M8NtaFrn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21390},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"9a0ea5bec3a8fd5cf02e3d54e2522da64bd85662","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"afranio","email":"afranio777alves@gmail.com"},"_npmVersion":"10.9.2","description":"A simple memory management system using indexedDB files.","directories":{},"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/memory-client_1.0.4_1760714409478_0.8655321889204333","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@afranioalves/memory-client","version":"1.0.5","description":"A simple memory management system using indexedDB files.","main":"dist/index.js","type":"module","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/Afranioalves/memory-client.git"},"keywords":["indexeddb","storage","memory","browser","react","nextjs","client-storage","typescript","browser-db","memory"],"author":{"name":"Afrânio"},"license":"MIT","scripts":{"build":"tsc","prepublishOnly":"npm run build","test":"echo \"Error: no test specified\" && exit 1"},"devDependencies":{"typescript":"^5.9.3"},"_id":"@afranioalves/memory-client@1.0.5","gitHead":"20c355ec7c55c10017646906b25cd3e3fdd3388e","bugs":{"url":"https://github.com/Afranioalves/memory-client/issues"},"homepage":"https://github.com/Afranioalves/memory-client#readme","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-M8xaYmWf/Y4gNkqYOFGe1IpB7EzcsOpIue0LcX5isoeJXs4N6PNkRZofvMBX9YyztaGjnUl6pTu65rTM5Sqtkg==","shasum":"443ccea6ec08658fff066c8401af08b881a128ec","tarball":"https://registry.npmjs.org/@afranioalves/memory-client/-/memory-client-1.0.5.tgz","fileCount":11,"unpackedSize":21495,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGZyzZMVFXhewcS8Bc7jSa5ErqLII7SyLmAWhzr/xWZ8AiEAsEgAWfrIPbcAdhzg35jFVP0/QIDvf2VTI1doh86sh/c="}]},"_npmUser":{"name":"afranio","email":"afranio777alves@gmail.com"},"directories":{},"maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/memory-client_1.0.5_1760954590423_0.6153503438395582"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-16T15:29:57.823Z","modified":"2025-10-20T10:03:10.807Z","1.0.0":"2025-10-16T15:29:58.075Z","1.0.1":"2025-10-16T15:34:33.821Z","1.0.2":"2025-10-16T15:44:08.321Z","1.0.3":"2025-10-17T03:57:13.144Z","1.0.4":"2025-10-17T15:20:09.667Z","1.0.5":"2025-10-20T10:03:10.615Z"},"author":{"name":"Afrânio"},"license":"MIT","keywords":["indexeddb","storage","memory","browser","react","nextjs","client-storage","typescript","browser-db","memory"],"description":"A simple memory management system using indexedDB files.","maintainers":[{"name":"afranio","email":"afranio777alves@gmail.com"}],"readme":"# @afranioalves/memory-client\r\n\r\nLightweight library for client-side data storage. It offers a simple asynchronous API to create, read, and delete data by key.\r\n\r\nVersion: 1.0.5\r\n\r\n## Description\r\n\r\nThis library exposes a singleton instance that simplifies basic storage operations in the browser. It is designed for use in front-end applications (e.g., web pages, React, Next.js).\r\n\r\nMain features:\r\n\r\n- Automatic initialization.\r\n- Simple async methods: `create`, `read`, `delete`.\r\n\r\n## Installation\r\n\r\nInstall via npm or yarn:\r\n\r\n```bash\r\nnpm install @afranioalves/memory-client\r\n# or\r\nyarn add @afranioalves/memory-client\r\n```\r\n\r\n> Note: The package uses ES modules (package.json has \"type\": \"module\").\r\n\r\n## Quick Usage\r\n\r\nImport the default instance and call the async methods:\r\n\r\n```javascript\r\nimport Memory from '@afranioalves/memory-client';\r\n\r\nasync function main() {\r\n  // Create a memory\r\n  const createResult = await Memory.create('my-key', { name: 'Afrânio', age: 18 });\r\n  console.log(createResult);\r\n\r\n  // Read the memory\r\n  const value = await Memory.read('my-key');\r\n  console.log('read value:', value);\r\n\r\n  // Delete the memory\r\n  const deleteResult = await Memory.delete('my-key');\r\n  console.log(deleteResult);\r\n}\r\n\r\nmain();\r\n```\r\n\r\n### HTML Example (browser)\r\n\r\n```html\r\n<!doctype html>\r\n<html>\r\n  <head><meta charset=\"utf-8\"><title>Memory Example</title></head>\r\n  <body>\r\n    <script type=\"module\">\r\n      import Memory from '/node_modules/@afranioalves/memory-client/src/index.js';\r\n\r\n      (async () => {\r\n        console.log(await Memory.create('ex1', 'Hello World'));\r\n        console.log(await Memory.read('ex1'));\r\n        console.log(await Memory.delete('ex1'));\r\n      })();\r\n    </script>\r\n  </body>\r\n</html>\r\n```\r\n\r\n> Note: When using bundlers or frameworks (Vite, Webpack, Next.js), prefer importing by package name: `import Memory from '@afranioalves/memory-client'`.\r\n\r\n### React Example\r\n\r\n```jsx\r\nimport React from 'react';\r\nimport Memory from '@afranioalves/memory-client';\r\n\r\nexport default function App() {\r\n  const createMemory = async () => {\r\n    const result = await Memory.create('user', { name: 'Ana' });\r\n    console.log(result);\r\n  };\r\n\r\n  const readMemory = async () => {\r\n    const user = await Memory.read('user');\r\n    console.log(user);\r\n  };\r\n\r\n  return (\r\n    <div>\r\n      <button onClick={createMemory}>Create Memory</button>\r\n      <button onClick={readMemory}>Read Memory</button>\r\n      Check the console for results.\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n## API\r\n\r\nAll methods are asynchronous and return Promises.\r\n\r\n- `create(memoryName, memoryValue)`\r\n  - Description: Creates an entry with key `memoryName` and value `memoryValue`.\r\n  - Returns: Promise resolving to an object `{ message: string, status: number }` on success, or rejects on error.\r\n  - Example status codes: `201` (created successfully), `409` (already exists), `500` (internal error).\r\n\r\n- `read(memoryName)`\r\n  - Description: Reads the stored value for `memoryName`.\r\n  - Returns: Promise resolving to the value (any stored data) or `{ message, status }` when not found or on error (e.g., `404` when not found, `500` on internal error).\r\n\r\n- `delete(memoryName)`\r\n  - Description: Deletes the entry with key `memoryName`.\r\n  - Returns: Promise resolving to `{ message: string, status: number }`.\r\n\r\nExample responses:\r\n\r\n- Successful creation: `{ message: 'Memory my-key created successfully.', status: 201 }`\r\n- Not found: `{ message: 'Memory my-key does not exist.', status: 404 }` (or the stored value when it exists)\r\n\r\n## Updates\r\n\r\n### Exciting New Features\r\n- **Database Class**: A powerful new addition for structured data storage, allowing for more complex data management.\r\n- **Table Management**: Easily create tables and define their structure with just a few lines of code.\r\n\r\nWith the Database from memory-client, data manipulation becomes easier. The data will be stored in a structure similar to a table, making it easier to perform CRUD (create, read, update, delete) operations.\r\n\r\n| name               | email  | age         |\r\n|------------------------|-----------------------------------------|------------------------|\r\n| Hugo Jorge          | jorge@example.com                 | 30|\r\n| Afrânio Alves      | afranio.alves@gmail.com     | 18           |\r\n| Andrade Antunes              | antunes@gmail.com                          | 20 |\r\n\r\n### Enhanced Usage Example\r\n\r\n```javascript\r\nimport Memory, { Database as database, type IColumn } from '@afranioalves/memory-client'\r\n\r\nconst App = () => {\r\n\r\n  // Create a new table for users with an auto-incrementing ID\r\n\r\n  const createTable = async () => {\r\n    \r\n    const columns: IColumn[] = [\r\n        { name: 'nome', type: 'string', unique: false }, \r\n        { name: 'email',  type: 'string', unique: true, }, \r\n        { name: 'age', type: 'number', unique: false }\r\n      ]\r\n\r\n    // id is the primary key of this table.\r\n    const result = await database.createTable('users', 'id', true, columns)\r\n    console.log(result)\r\n  }\r\n\r\n // Insert a new user into the table\r\n\r\n   const insertData = async () => {\r\n\r\n    const data = {\r\n      nome: \"Hugo Jorge\",\r\n      email: \"jorge@exemplo.com\",\r\n      age: 30,\r\n    }\r\n\r\n    const result = await database.insert(\"users\", data);\r\n    console.log(result)\r\n  }\r\n\r\n // find all data\r\n\r\n    const findAll = async () => {\r\n       const users = await database.selectAll('users')\r\n       console.log('users', users)\r\n    }\r\n\r\n    // find for a record\r\n\r\n      const findOne = async () => {\r\n        // email is the field where the search\r\n         const user = await database.selectOne('users', 'email', 'jorge@exemplo.com')\r\n         console.log(user)\r\n    }\r\n\r\n// updates a record\r\n\r\n    const updatedData = async () => {\r\n    const newValue = {email:'alfredo@gmail.com'}\r\n    const result = await database.update('users', 'email','jorge@exemplo.com', newValue)\r\n    console.log(result)\r\n  }\r\n\r\n\r\n      const deleteData = async () => {\r\n      const result = await database.delete('users', 1)\r\n      console.log(result)\r\n    }\r\n  \r\n}\r\n\r\nexport default App;\r\n\r\n```\r\n\r\n## Notes and Common Issues\r\n\r\n- This library is intended for client-side (browser) use. Persistence behavior may vary slightly between environments/browsers.\r\n- In contexts with very strict privacy policies or special browser modes, storage may be limited or temporary.\r\n\r\n\r\n## @afranioalves/memory-client vs localStorage\r\n\r\n| Feature                | @afranioalves/memory-client  | localStorage           |\r\n|------------------------|-----------------------------------------|------------------------|\r\n| Storage Limit          | Large (hundreds of MBs)                 | Small (~5MB per origin)|\r\n| Data Type Support      | Any JS type (objects, arrays, etc.)     | Only strings           |\r\n| Async API              | Yes (Promises)                          | No (synchronous)       |\r\n| Performance            | Fast for large/bulk data                | Fast for small data    |\r\n| Transactions          | Supported                               | Not supported          |\r\n| Browser Support        | All modern browsers                     | All browsers           |\r\n| Use Cases              | Complex, structured, or large data      | Simple key-value pairs |\r\n| API Complexity         | Simple via this library                 | Very simple            |\r\n| Persistence            | Persistent, survives browser restarts   | Persistent             |\r\n\r\n### When to use @afranioalves/memory-client\r\n- You need to store objects, arrays, or non-string data.\r\n- You expect to store more than a few megabytes.\r\n- You want async operations and better performance for large datasets.\r\n- You need transactional integrity.\r\n\r\n### When to use localStorage\r\n- You only need to store small amounts of string data.\r\n- You want a synchronous, simple API for quick tasks.\r\n- You do not need to store complex or large data.\r\n\r\n## License\r\n\r\nMIT — see the `LICENSE` file\r\n\r\n---\r\n\r\nAuthor: Afrânio Alves","readmeFilename":"README.md","homepage":"https://github.com/Afranioalves/memory-client#readme","repository":{"type":"git","url":"git+https://github.com/Afranioalves/memory-client.git"},"bugs":{"url":"https://github.com/Afranioalves/memory-client/issues"}}