{"id":20517180,"url":"https://github.com/shevernitskiy/persistent-object","last_synced_at":"2026-05-15T18:31:38.315Z","repository":{"id":108876160,"uuid":"603496805","full_name":"shevernitskiy/persistent-object","owner":"shevernitskiy","description":"Persistent object with proxy features. Every mutation synced to storage.","archived":false,"fork":false,"pushed_at":"2023-04-30T15:24:12.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T23:00:54.655Z","etag":null,"topics":["deno","persistence","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/shevernitskiy.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-02-18T17:34:46.000Z","updated_at":"2023-04-29T17:22:58.000Z","dependencies_parsed_at":"2024-11-15T21:34:23.253Z","dependency_job_id":"ca2f7dda-ea84-408d-8b8a-4cdfcce3d968","html_url":"https://github.com/shevernitskiy/persistent-object","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/shevernitskiy/persistent-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shevernitskiy%2Fpersistent-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shevernitskiy%2Fpersistent-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shevernitskiy%2Fpersistent-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shevernitskiy%2Fpersistent-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shevernitskiy","download_url":"https://codeload.github.com/shevernitskiy/persistent-object/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shevernitskiy%2Fpersistent-object/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279667733,"owners_count":26207976,"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","status":"online","status_checked_at":"2025-10-18T02:00:06.492Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["deno","persistence","typescript"],"created_at":"2024-11-15T21:34:14.393Z","updated_at":"2025-10-19T03:14:08.925Z","avatar_url":"https://github.com/shevernitskiy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JS/TS Persistent object\n\nThis tiny function provide persistences for json serializable object. It's possible with using proxy and set/get\ncallbacks. Everytime you mutate the object, it calls defined `save` callback. Default value needed for deep nesting\nsupport.\n\n## Example\n\nExample with storage in simple json file.\n\n```ts\nimport { persistent } from \"https://deno.land/x/persistent@v1.2.0/mod.ts\";\n\ntype Schema = {\n  name: string;\n  age: number;\n  job: {\n    salary: number;\n  };\n};\n\nconst path = \"./state.json\";\nconst defaults: Schema = {\n  name: \"\",\n  age: 0,\n  job: {\n    salary: 0,\n  },\n};\n\nconst state = await persistent\u003cSchema\u003e(defaults, {\n  read: () =\u003e {\n    let data: Schema = defaults;\n    try {\n      data = JSON.parse(Deno.readTextFileSync(path));\n    } catch {\n      //\n    }\n    return data;\n  },\n  save: (value: Schema) =\u003e Deno.writeTextFileSync(path, JSON.stringify(value, null, 2)),\n}); // read json from path and return proxyfied object\n\nstate.job.salary = 35; // saved with provided callback\n```\n\n# Contribution\n\nPull request, issues and feedback are very welcome. Code style is formatted with `deno fmt`.\n\n# License\n\nCopyright 2023, shevernitskiy. MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshevernitskiy%2Fpersistent-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshevernitskiy%2Fpersistent-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshevernitskiy%2Fpersistent-object/lists"}