{"_id":"@aoitelegram/database","_rev":"7-7d4743ff58151adad4e797c7710539f2","name":"@aoitelegram/database","dist-tags":{"latest":"1.1.1"},"versions":{"0.0.1":{"name":"@aoitelegram/database","version":"0.0.1","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@0.0.1","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"450115997f06ec6242d3721a18842d5f90f733f3","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-0.0.1.tgz","fileCount":11,"integrity":"sha512-axz+2Ditzig8oEju9hvGk0oWjdPBBrEHTIMKHwHS2P8Uk6gM16PmBYYocP9VHrpHGumerc3qBlFxP3D1sp1+lQ==","signatures":[{"sig":"MEYCIQDN6siO7qawayuBWPhpntz9jpAVQqme9Q24czdVWSpDkQIhAKu/NMN/YhWhb1Oy3aHITIBGqa0uLf1LkCptlVxqoSRr","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26882},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","typing":"./dist/index.d.ts","gitHead":"3172e6d1b40ae7f64b097c31159b97f6168bbea9","private":false,"_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"9.5.1","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4"},"_npmOperationalInternal":{"tmp":"tmp/database_0.0.1_1702583647467_0.5185622444850382","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@aoitelegram/database","version":"0.0.2","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@0.0.2","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"a9480a3ea2cc82a4ffad67ec0b10a02fde7dab79","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-0.0.2.tgz","fileCount":11,"integrity":"sha512-05uzmmY3k4nYj1l1y4i4mKC9Fw1Zx8Q7PfyLezsRY3sbtjzHh0wb6Br0uIGXGObSWlV2h2S4edNXE7npQl2QtQ==","signatures":[{"sig":"MEQCIE0XYsMsT7sJvna3D6I+oM4WR/+Sv82rq5kuWPC50JRjAiBXZoAbTJufY/d2BsW+qZ6onxaHASWS+UKYy+EZ5pGXfA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27157},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","typing":"./dist/index.d.ts","gitHead":"3172e6d1b40ae7f64b097c31159b97f6168bbea9","_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"9.5.1","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4"},"_npmOperationalInternal":{"tmp":"tmp/database_0.0.2_1702840207485_0.14777311415192296","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@aoitelegram/database","version":"0.0.3","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@0.0.3","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"a625a58d38537aab05a5491deac19394648dc970","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-0.0.3.tgz","fileCount":11,"integrity":"sha512-IUPkBaJTYMuca5YQ97wHNYF0LgBDHOiT9mb21U+5IF9CrOB796dB9D/fCN/bEqDgxzANcvBlBF7NZMmcZYj56Q==","signatures":[{"sig":"MEYCIQCCwoyeUIRWRlULF5goXMlNq5qhrD9nx36hAOGWU3pESAIhAN1fx/deQW8opReppE/Vx62WcZvomCCgD47cIrOXuklS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27207},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","typing":"./dist/index.d.ts","gitHead":"a4290c4ac6cb3a14067d9a6a496837880a178f9e","_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"9.5.1","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"18.16.1","_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4"},"_npmOperationalInternal":{"tmp":"tmp/database_0.0.3_1703164092459_0.4674693091096107","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@aoitelegram/database","version":"0.1.0","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@0.1.0","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"18c98b6aa0da55700482929df91cea02850be1ce","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-0.1.0.tgz","fileCount":13,"integrity":"sha512-0dr8pRtJnORl7rvzKDAnUu8xnCctAGhKsIDnLxE4IgKCMMmfimtULhWRVAebRjNbrybqPkplrCnzymNPh3Z9SQ==","signatures":[{"sig":"MEUCIFAJVem/Ou2WskJmp1tfgTJ/UlmZwxVRGlTO+acHnIsjAiEAp3V29MkPzGKsIk2A4wsExcaW2C9fs4tsd949Umohlkw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41761},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","typing":"./dist/index.d.ts","gitHead":"3a5e80120487aba290e14b9915ac12fe9ed5c289","_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"9.5.1","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"18.16.1","dependencies":{"mongodb":"^6.3.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4"},"_npmOperationalInternal":{"tmp":"tmp/database_0.1.0_1705242973734_0.31240340824901724","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"@aoitelegram/database","version":"0.2.0","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@0.2.0","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"e75070c1d760e8a21d0e373ea0884a1e0bdb82d9","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-0.2.0.tgz","fileCount":13,"integrity":"sha512-sLDzjZE2vEQusLk1xgMEgrhacif7JM3ukvBA8YOZ57cqoEYTn+1JIjxerV59t0/1RqxGZcgPmhLQPBVJgbvRxw==","signatures":[{"sig":"MEUCIQD8COViYi8MHDn7tBygylh67O9FhK13VrO6p8/RAZy4jwIgNCvkV0C4aSyZ7ogqidl7Lvo6/wAmXs2csN8K40K5fzY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":40923},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","typing":"./dist/index.d.ts","gitHead":"3a5e80120487aba290e14b9915ac12fe9ed5c289","_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"9.5.1","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"18.16.1","dependencies":{"mongodb":"^6.3.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4"},"_npmOperationalInternal":{"tmp":"tmp/database_0.2.0_1705257579456_0.7245381218001246","host":"s3://npm-registry-packages"}},"0.2.1":{"name":"@aoitelegram/database","version":"0.2.1","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@0.2.1","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"d3ebfbe470d9b0477ac0999f589265c7559eb3df","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-0.2.1.tgz","fileCount":13,"integrity":"sha512-Tr9g8d3xNXpV6yXGj1ydKe4xzQGE8fTQwKeCPaHT+1rjpfvBDGwfeBqxOVwzMXGzlpqIfwqzU9CYt6YsTfr+Hw==","signatures":[{"sig":"MEUCIAkwEQsUzQtKKb3cbX28F2s4DxDvxgGRJbnLuVuX1YegAiEA4oa2Sm2RbxiIkmbbcGLwHoeYIFgEhQNmwdRs47FJnz8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":39742},"main":"./dist/index.js","type":"commonjs","types":"./dist/index.d.ts","typing":"./dist/index.d.ts","gitHead":"3a5e80120487aba290e14b9915ac12fe9ed5c289","_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"9.5.1","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"18.16.1","dependencies":{"mongodb":"^6.3.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4"},"_npmOperationalInternal":{"tmp":"tmp/database_0.2.1_1705265587256_0.8921542424282072","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@aoitelegram/database","version":"1.0.0","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","_id":"@aoitelegram/database@1.0.0","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"dist":{"shasum":"4e555d9f4003ffcfa48efa012ff895f20c0e7104","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-1.0.0.tgz","fileCount":20,"integrity":"sha512-7fjEa0jMGR2+OmkiQ8WM+A5z/N8Ml1gVbmK+i1me/uGJRHECtqaT4ovG9XaPQSWSb+cyKyS/wrIUaUsc4MQtIQ==","signatures":[{"sig":"MEYCIQCKTXY+GKeGCocAlvqrZRs6LGhz5NiSj2to58D8+hDqUgIhANboPNmFwRQpSxNDmcv9suXJuXkoyi2mCjzh6ZCNFFj9","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":60498},"main":"./dist/src/index.js","types":"./dist/src/index.d.ts","typing":"./dist/src/index.d.ts","exports":{".":{"import":{"types":"./dist/src/index.d.mts","default":"./dist/src/index.mjs"},"require":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}}},"gitHead":"61bf052d42f2315393c9328cc942336161edc858","_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"_npmVersion":"10.2.4","description":"A custom database designed specifically for aoitelegram","directories":{},"_nodeVersion":"20.11.1","dependencies":{"mongodb":"^6.3.0","get-stream":"^6.0.1","@firebase/app":"^0.9.27","@firebase/firestore":"4.4.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^20.10.4","@types/get-stream":"^3.0.2"},"_npmOperationalInternal":{"tmp":"tmp/database_1.0.0_1714291467277_0.1441235240590375","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@aoitelegram/database","version":"1.1.1","description":"A custom database designed specifically for aoitelegram","main":"./dist/index.js","typing":"./dist/index.d.ts","license":"MIT","exports":{".":{"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"}}},"keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"devDependencies":{"@types/get-stream":"^3.0.2","@types/long-timeout":"^0.1.2","@types/node":"^20.10.4"},"dependencies":{"@aoitelegram/util":"^1.0.1","@firebase/app":"^0.9.27","@firebase/firestore":"4.4.2","aoitelegram":"^1.0.0","get-stream":"^6.0.1","long-timeout":"^0.1.1","mongodb":"^6.3.0","mysql2":"^3.10.1"},"_id":"@aoitelegram/database@1.1.1","gitHead":"370746e5748eabe98a0d2623c78ca2c3c30993c0","types":"./dist/index.d.ts","_nodeVersion":"20.15.1","_npmVersion":"10.7.0","dist":{"integrity":"sha512-OqIlMF8khswVpQjvkdA4Xvt3X0mzGKEavn9Im9zIZCVlEBlIRZ63+b0tk+hy5k2oTqrU4Zx0lEmqF2loQNPT0Q==","shasum":"132825a18af9354f869d887a16fbcb0b88c0e112","tarball":"https://registry.npmjs.org/@aoitelegram/database/-/database-1.1.1.tgz","fileCount":101,"unpackedSize":163363,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCBVOPNXUP/79wWJ7jIaiArel9m/t4v2OmOsM4XZooqZAIhAMf5wjvdTmHhJMPyCADrSdPEBNZETa1sjlugbteDxhwJ"}]},"_npmUser":{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"},"directories":{},"maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/database_1.1.1_1721541642799_0.2053094490949785"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-14T19:54:07.364Z","modified":"2024-07-21T06:00:43.253Z","0.0.1":"2023-12-14T19:54:07.673Z","0.0.2":"2023-12-17T19:10:07.657Z","0.0.3":"2023-12-21T13:08:12.670Z","0.1.0":"2024-01-14T14:36:13.896Z","0.2.0":"2024-01-14T18:39:39.621Z","0.2.1":"2024-01-14T20:53:07.414Z","1.0.0":"2024-04-28T08:04:27.449Z","1.1.1":"2024-07-21T06:00:43.056Z"},"author":{"name":"Sempai","email":"zadmanthegreat@gmail.com"},"license":"MIT","keywords":["javascript","typescript","telegram","library","telegramapi","bot","aoi","aoitelegram","bds.js","@aoitelegram","aoi.js"],"description":"A custom database designed specifically for aoitelegram","maintainers":[{"name":"crazy-sempai07","email":"suhozadvova7@gmail.com"}],"readme":"# **@aoitelegram/database**\n\n[![NPM Version](https://img.shields.io/npm/v/@aoitelegram/database)](https://www.npmjs.com/package/@aoitelegram/database)\n[![Bot API](https://img.shields.io/badge/Bot%20API-v.7.2-00aced.svg?style=flat-square&logo=telegram)](https://core.telegram.org/bots/api)\n[![NPM Downloads](https://img.shields.io/npm/dt/@aoitelegram/database.svg?maxAge=3600)](https://www.npmjs.com/package/@aoitelegram/database)\n[![License](https://img.shields.io/npm/l/@aoitelegram/database)](https://github.com/aoitelegram/database/blob/main/LICENSE)\n\n`@aoitelegram/database` is a Node.js library for managing various types of databases, including Firebase Realtime Database, MongoDB, and a generic file-based storage solution. It provides a unified interface for performing CRUD operations, managing events, and checking database responsiveness.\n\n## Installation\n\nYou can install the library via npm:\n\n```bash\nnpm install @aoitelegram/database\n```\n\n## Usage\n\n### AoiTelegram Connect\n\n```typescript\n// CommonJS\nconst { AoiClient } = require(\"aoitelegram\");\nconst { AoiDB } = require(\"@aoitelegram/database\");\n// Esm/TypeScript\nimport { AoiClient } from \"aoitelegram\";\nimport { AoiDB } from \"@aoitelegram/database\";\n\nconst database = new AoiDB({\n  type: \"storage\",\n  logger: true,\n  options: {\n    tables: [\"main\"],\n  },\n});\n\nconst bot = AoiClient(\"token\", {\n  extension: [database],\n  // ...other\n});\n\ndatabase.timeoutCommand({\n  id: \"other\",\n  code: \"$print[Yesssss!;$timeoutData[key]]\",\n});\n\nbot.addCommand({\n  command: \"start_timeout\",\n  code: \"$setTimeout[other;10m;{ key: 'Hello World' }]\",\n});\n\n// Set user variables in a table.\ndatabase.variables(\n  {\n    sempai: 10,\n    string: \"Hello, world!\",\n    aoijs: true,\n    webapp: false,\n    mz: [],\n  },\n  \"main\",\n);\n\nbot.connect();\n```\n\n### FirebaseDB\n\n```typescript\nimport { FirebaseDB } from \"@aoitelegram/database\";\n\n// Create a FirebaseDB instance\nconst db = new FirebaseDB(\"<your-firebase-database-url>\", {\n  projectId: \"<your-firebase-priject-id>\",\n  tables: [\"users\", \"posts\"], // Optional: specify tables\n});\n\n// Connect to the Firebase database\nawait db.connect();\n\n// Perform operations such as get, set, delete, etc.\nawait db.set(\"users\", \"user1\", { name: \"John\", age: 30 });\nconst user = await db.get(\"users\", \"user1\");\nconsole.log(user); // Output: { name: 'John', age: 30 }\n```\n\n### MongoDB\n\n```typescript\nimport { MongoDB } from \"@aoitelegram/database\";\n\n// Create a MongoDB instance\nconst db = new MongoDB(\"<your-mongodb-url>\", {\n  tables: [\"users\", \"posts\"], // Specify tables\n});\n\n// Connect to the MongoDB database\nawait db.connect();\n\n// Perform operations such as get, set, delete, etc.\nawait db.set(\"users\", \"user1\", { name: \"John\", age: 30 });\nconst user = await db.get(\"users\", \"user1\");\nconsole.log(user); // Output: { name: 'John', age: 30 }\n```\n\n### MySqlDB\n\n```typescript\nimport { MySqlDB } from \"@aoitelegram/database\";\n\n// Create a MongoDB instance\nconst db = new MySqlDB(<url> and <connection options> (host, user, password, port),\n  [\"users\", \"posts\"], // Specify tables\n);\n\n// Connect to the MongoDB database\nawait db.connect();\n\n// Perform operations such as get, set, delete, etc.\nawait db.set(\"users\", \"user1\", { name: \"John\", age: 30 });\nconst user = await db.get(\"users\", \"user1\");\nconsole.log(user); // Output: { name: 'John', age: 30 }\n```\n\n### StorageDB\n\n```typescript\nimport { StorageDB } from \"@aoitelegram/database\";\n\n// Create a StorageDB instance\nconst db = new StorageDB({\n  path: \"./data\", // Optional: specify data directory\n  tables: [\"users\", \"posts\"], // Optional: specify tables\n});\n\n// Connect to the storage database\nawait db.connect();\n\n// Perform operations such as get, set, delete, etc.\nawait db.set(\"users\", \"user1\", { name: \"John\", age: 30 });\nconst user = await db.get(\"users\", \"user1\");\nconsole.log(user); // Output: { name: 'John', age: 30 }\n```\n\n## API Documentation\n\nPlease refer to the [API Documentation](#) for detailed information on classes, methods, and usage examples.\n\n## Contributing\n\nContributions are welcome! If you find any issues or have suggestions for improvements, please create a `GitHub` issue or submit a pull request. Additionally, feel free to reach out to me on Telegram via my group [AoiTelegram](https://t.me/aoitegram) or on Discord using my username `sempaika_chess`.\n\n## License\n\nThis library is released under the [MIT License](https://github.com/aoitelegram/database/blob/main/LICENSE).\n","readmeFilename":"README.md"}