{"id":21030185,"url":"https://github.com/varharrie/persiston","last_synced_at":"2026-04-16T04:31:23.053Z","repository":{"id":62422611,"uuid":"460528860","full_name":"varHarrie/persiston","owner":"varHarrie","description":"Simple persistent store with database-like API.","archived":false,"fork":false,"pushed_at":"2022-02-23T01:45:32.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T08:02:01.310Z","etag":null,"topics":["database","deno","storage"],"latest_commit_sha":null,"homepage":"https://deno.land/x/persiston","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/varHarrie.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}},"created_at":"2022-02-17T17:02:56.000Z","updated_at":"2022-02-24T11:23:11.000Z","dependencies_parsed_at":"2022-11-01T17:31:31.892Z","dependency_job_id":null,"html_url":"https://github.com/varHarrie/persiston","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/varHarrie/persiston","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fpersiston","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fpersiston/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fpersiston/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fpersiston/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varHarrie","download_url":"https://codeload.github.com/varHarrie/persiston/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varHarrie%2Fpersiston/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259879596,"owners_count":22925795,"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":["database","deno","storage"],"created_at":"2024-11-19T12:16:43.178Z","updated_at":"2026-04-16T04:31:23.012Z","avatar_url":"https://github.com/varHarrie.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Persiston for Deno\n\nSimple persistent store with database-like API.\n\n## Usage\n\n```javascript\nconst adapter = new FileAdapter('./data.json')\nconst store = new Persiston({ adapter })\n\nstore.load()\n  .then(() =\u003e store.collection('users').insert({ name: 'foo' }))\n  .then(() =\u003e store.collection('users').findOne())\n  .then((user) =\u003e console.log(user)) // { name: 'foo' }\n```\n\nWith type declaration:\n\n```typescript\ninterface User {\n  name: string\n}\n\nclass Store extends Persiston {\n  users = this.collection\u003cUser\u003e('users')\n  pets = this.collection\u003cUser\u003e('pets')\n}\n\nconst adapter = new FileAdapter('./data.json')\nconst store = new Store({ adapter })\n\nstore.load()\n  .then(() =\u003e store.collection('users').insert({ name: 'foo' }))\n  .then(() =\u003e store.collection('users').findOne())\n  .then((user) =\u003e console.log(user)) // { name: 'foo' }\n```\n\n## APIs\n\n### Persiston\n\n- `store.load(): Promise\u003cPersiston\u003e`\n\nLoads data by adapter. It should be called before all collection operations.\n\n- `store.save(): Promise\u003cPersiston\u003e`\n\nSaves data by adapter. You probably won't call it by yourself.\n\n- `store.collection(): Collection\u003cT\u003e`\n\nGets a collection object.\n\n### Collection\n\n- `collection.find(query?: Query\u003cT\u003e, fields?: string[]): Promise\u003cT[]\u003e`\n\nFinds items by query.\n\n- `collection.findOne(query?: Query\u003cT\u003e, fields?: string[]): Promise\u003cT | undefined\u003e`\n\nFinds an item by query.\n\n- `collection.insert(items: T | T[]): Promise\u003cnumber\u003e`\n\nSaves given item or items.\n\n- `collection.update(query: Query\u003cT\u003e, changes: Partial\u003cT\u003e): Promise\u003cnumber\u003e`\n\nPartially updates by query.\n\n- `collection.updateOne(query: Query\u003cT\u003e, changes: Partial\u003cT\u003e): Promise\u003cnumber\u003e`\n\nPartially updates an item by query.\n\n- `collection.remove(query?: Query\u003cT\u003e): Promise\u003cnumber\u003e`\n\nRemoves items by query.\n\n- `collection.removeOne(query: Query\u003cT\u003e): Promise\u003cnumber\u003e`\n\nRemoves an item by query.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarharrie%2Fpersiston","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarharrie%2Fpersiston","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarharrie%2Fpersiston/lists"}