{"id":19877239,"url":"https://github.com/timursevimli/dataset-transaction","last_synced_at":"2025-05-02T12:30:42.795Z","repository":{"id":184877287,"uuid":"672614864","full_name":"timursevimli/dataset-transaction","owner":"timursevimli","description":"Transaction and transaction dataset realization with proxy on JavaScript","archived":false,"fork":false,"pushed_at":"2024-05-09T10:03:54.000Z","size":93,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T01:23:47.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timursevimli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-30T17:19:31.000Z","updated_at":"2024-09-10T15:30:09.000Z","dependencies_parsed_at":"2023-07-30T18:39:32.166Z","dependency_job_id":"b63164b5-aaf9-4a95-87a7-037459a6a226","html_url":"https://github.com/timursevimli/dataset-transaction","commit_stats":null,"previous_names":["timursevimli/datasettransaction"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursevimli%2Fdataset-transaction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursevimli%2Fdataset-transaction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursevimli%2Fdataset-transaction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timursevimli%2Fdataset-transaction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timursevimli","download_url":"https://codeload.github.com/timursevimli/dataset-transaction/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252038094,"owners_count":21684624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T16:36:55.072Z","updated_at":"2025-05-02T12:30:42.521Z","avatar_url":"https://github.com/timursevimli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transaction Class\n\nThe Transaction class is a utility that allows you to create transactions for managing changes to an object's properties. It provides methods to start, commit, and rollback transactions, as well as events to track changes.\n\n## Features\n\n- Create and manage transactions for an object's properties.\n- Emit events for actions such as getting, setting, deleting, committing, rolling back, and timeout.\n- Handle transaction timeout, automatically committing or rolling back changes after a specified duration.\n- Revocable proxy object to track property changes.\n\n## Installation\n\nTo install and use `dataset-transaction`, follow these steps:\n\n```bash\n    npm install dataset-transaction\n```\n\n## Usage\n\nHere's a quick example demonstrating how to use the `Transaction` class:\n\n```javascript\nconst { Transaction } = require('dataset-transaction');\n\n// Create initial data\nconst data = {\n  name: 'John Doe',\n  age: 30,\n  email: 'johndoe@example.com',\n};\n\n// Start a transaction\nconst { transaction, proxy } = Transaction.start(data);\n\n// Listen to events\ntransaction.on('get', () =\u003e {\n  console.log('Property accessed.');\n});\n\ntransaction.on('set', () =\u003e {\n  console.log('Property set.');\n});\n\ntransaction.on('delete', () =\u003e {\n  console.log('Property deleted.');\n});\n\ntransaction.on('commit', () =\u003e {\n  console.log('Transaction committed.');\n});\n\ntransaction.on('rollback', () =\u003e {\n  console.log('Transaction rolled back.');\n});\n\ntransaction.on('timeout', () =\u003e {\n  console.log('Transaction timed out.');\n});\n\n// Access and modify the properties using the proxy\nconst name = proxy.name; // This will trigger 'get' event\nproxy.age = 31; // This will trigger 'set' event\ntransaction.delete('email'); // This will trigger 'delete' event\n\n// Commit or rollback the transaction\ntransaction.commit(); // This will trigger 'commit' event\ntransaction.rollback(); // This will trigger 'rollback' event\n\n// Stop the transaction\ntransaction.stop();\n```\n\n## License\n\n[MIT LICENSE](https://github.com/timursevimli/dataset-transaction/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimursevimli%2Fdataset-transaction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimursevimli%2Fdataset-transaction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimursevimli%2Fdataset-transaction/lists"}