{"id":22367728,"url":"https://github.com/hugojosefson/deno-kv-entity","last_synced_at":"2026-05-05T12:33:54.139Z","repository":{"id":165337152,"uuid":"640679426","full_name":"hugojosefson/deno-kv-entity","owner":"hugojosefson","description":"Typed library for specifying and storing entities in a Deno.Kv database.","archived":false,"fork":false,"pushed_at":"2024-04-06T13:22:05.000Z","size":94,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T15:55:21.184Z","etag":null,"topics":["database","db","deno","deno-kv","key-value","kv"],"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/hugojosefson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2023-05-14T21:45:32.000Z","updated_at":"2024-05-03T16:49:17.000Z","dependencies_parsed_at":"2024-04-06T14:23:24.108Z","dependency_job_id":"e71f0c37-931e-4515-a028-109062d76f15","html_url":"https://github.com/hugojosefson/deno-kv-entity","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/hugojosefson/deno-kv-entity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fdeno-kv-entity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fdeno-kv-entity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fdeno-kv-entity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fdeno-kv-entity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hugojosefson","download_url":"https://codeload.github.com/hugojosefson/deno-kv-entity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hugojosefson%2Fdeno-kv-entity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32649596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","db","deno","deno-kv","key-value","kv"],"created_at":"2024-12-04T18:20:44.457Z","updated_at":"2026-05-05T12:33:54.117Z","avatar_url":"https://github.com/hugojosefson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kv_entity\n\nTyped library for specifying and storing entities in a\n[Deno.Kv](https://deno.com/kv) database.\n\n[![deno module](https://shield.deno.dev/x/kv_entity)](https://deno.land/x/kv_entity)\n[![CI](https://github.com/hugojosefson/deno-kv-entity/actions/workflows/ci.yaml/badge.svg)](https://github.com/hugojosefson/deno-kv-entity/actions/workflows/ci.yaml)\n\n## Requirements\n\nRequires [Deno](https://deno.land/) v1.42.1 or later, with the `--unstable-kv`\nflag.\n\n## API\n\nPlease see the\n[auto-generated API documentation](https://deno.land/x/kv_entity?doc).\n\n## Example usage\n\n```typescript\nimport {\n  EntityDb,\n  EntityDefinition,\n} from \"https://deno.land/x/kv_entity/mod.ts\";\n\n// What your data looks like. These are yours. You define them,\n// but each must have at least one unique property.\ninterface Person {\n  email: string;\n  name: string;\n}\ninterface Invoice {\n  invoiceNumber: string;\n  customerEmail: string;\n  amount: number;\n}\n\n// Describe them to the EntityDb\nconst personDefinition: EntityDefinition\u003cPerson\u003e = {\n  id: \"person\",\n  uniqueProperties: [\"email\"],\n  indexedPropertyChains: [],\n  _exampleEntityInstance: {} as Person,\n};\nconst invoiceDefinition: EntityDefinition\u003cInvoice\u003e = {\n  id: \"invoice\",\n  uniqueProperties: [\"invoiceNumber\"],\n  indexedPropertyChains: [\n    [\"customerEmail\"],\n  ],\n  _exampleEntityInstance: {} as Invoice,\n};\n\n// Create the EntityDb, using the definitions\nconst db = new EntityDb\u003cPerson | Invoice\u003e({\n  dbFilePath: \"example-person-invoice.db\",\n  entityDefinitions: {\n    person: personDefinition,\n    invoice: invoiceDefinition,\n  },\n});\n\n// Use the EntityDb\nconst alice: Person = {\n  email: \"alice@example.com\",\n  name: \"Alice\",\n};\nconst invoice1: Invoice = {\n  invoiceNumber: \"1\",\n  customerEmail: \"alice@example.com\",\n  amount: 100,\n};\n\nawait db.save(\"person\", alice);\nawait db.save(\"invoice\", invoice1);\n\n// Find the objects\nconst aliceFromDb: Person | undefined = await db.find(\n  \"person\",\n  \"email\",\n  \"alice@example.com\",\n);\nconsole.log({ aliceFromDb });\n\nconst invoicesForAlice: Invoice[] | undefined = await db.findAll(\"invoice\", [[\n  \"customerEmail\",\n  \"alice@example.com\",\n]]);\nconsole.log({ invoicesForAlice });\n```\n\nYou may run the above example with:\n\n```sh\ndeno run --unstable-kv --reload --allow-write=example-person-invoice.db --allow-read=example-person-invoice.db https://deno.land/x/kv_entity/readme/person-invoice.ts\n```\n\nFor further usage examples, see the tests:\n\n- [test/entity-db.test.ts](test/entity-db.test.ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Fdeno-kv-entity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhugojosefson%2Fdeno-kv-entity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhugojosefson%2Fdeno-kv-entity/lists"}