{"id":19120036,"url":"https://github.com/hrsh7th/immer-deps","last_synced_at":"2025-10-08T03:59:20.447Z","repository":{"id":57272695,"uuid":"167300453","full_name":"hrsh7th/immer-deps","owner":"hrsh7th","description":"Auto update dependencies, when immer's produce.","archived":false,"fork":false,"pushed_at":"2019-01-29T12:29:29.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"design","last_synced_at":"2025-09-20T13:49:51.318Z","etag":null,"topics":["graph","immer","normalize","state-management","tree"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hrsh7th.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-24T04:02:15.000Z","updated_at":"2022-12-26T14:44:24.000Z","dependencies_parsed_at":"2022-09-06T21:52:40.847Z","dependency_job_id":null,"html_url":"https://github.com/hrsh7th/immer-deps","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hrsh7th/immer-deps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fimmer-deps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fimmer-deps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fimmer-deps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fimmer-deps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrsh7th","download_url":"https://codeload.github.com/hrsh7th/immer-deps/tar.gz/refs/heads/design","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrsh7th%2Fimmer-deps/sbom","scorecard":{"id":470564,"data":{"date":"2025-08-11","repo":{"name":"github.com/hrsh7th/immer-deps","commit":"76e96a34b461eb86422d7cb87ac3431f93d0df41"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/13 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'design'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T13:48:48.701Z","repository_id":57272695,"created_at":"2025-08-19T13:48:48.701Z","updated_at":"2025-08-19T13:48:48.701Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278886411,"owners_count":26062975,"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-08T02:00:06.501Z","response_time":56,"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":["graph","immer","normalize","state-management","tree"],"created_at":"2024-11-09T05:12:22.932Z","updated_at":"2025-10-08T03:59:20.425Z","avatar_url":"https://github.com/hrsh7th.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Immer-deps\nAuto update dependencies, when immer's produce.\n\nThis providing way to manage `normalized (tree|graph) structure`.\n\nCurrent status: API designing\n\n# Conepts\n- Strongly typed\n- Keep immer's produce API\n- Support tree and graph structure\n\n# Why?\nSee below, Thats two state are same structure in mental model.\n\n### 1. de-normalized tree state.\n```ts\nconst state = {\n  tasks: [{\n    id: 1,\n    name: 'task1',\n    children: [{\n      id: 2,\n      name: 'task2',\n      children: [{\n        id: 3,\n        name: 'task3'\n      }]\n    }]\n  }]\n};\n\nconst next = produce(state, draft =\u003e {\n  draft.tasks.children[0].children[0].name = 'task3 - updated';\n});\n\n// `task1` updated. ✓\nexpect(next.tasks[0]).not.toEqual(state.tasks);\n// `task2` updated. ✓\nexpect(next.tasks[0].children[0]).not.toEqual(state.tasks.children[0]);\n// `task3` updated. ✓\nexpect(next.tasks[0].children[0].children[0]).not.toEqual(state.tasks.children[0].children[0]);\n```\n\n### 2. normalized tree state.\n```ts\nconst state = {\n  tasks: [\n    { id: 1, name: 'task1', parentId: null },\n    { id: 2, name: 'task2', parentId: 1 },\n    { id: 3, name: 'task3', parentId: 2 }\n  ]\n};\n\nconst next = produce(state, draft =\u003e {\n  draft.tasks[2].name = 'task3 - updated';\n});\n\n// `task1` updated. 💥\nexpect(next.tasks[0]).not.toEqual(state.tasks[0]);\n// `task2` updated. 💥\nexpect(next.tasks[1]).not.toEqual(state.tasks[1]);\n// `task3` updated. ✓\nexpect(next.tasks[2]).not.toEqual(state.tasks[2]);\n```\n\n`immer-deps` solve this mismatching in mental model.\n\n\n# Usage\n\n```ts\nimport { produce } from 'immer';\nimport { deps } from 'immer-deps';\n\ntype State = {\n  tasks: {\n    id: number;\n    name: string;\n    parentId: number | null;\n  }[];\n};\n\n/**\n * Wrap produce function.\n */\nconst produceWithDeps = deps\u003cState\u003e(produce, define =\u003e ([\n\n  /**\n   * Define dependencies on part of state.\n   */\n  define('tasks', Number)((state, task) =\u003e (\n    state.tasks.filter(t =\u003e t.id === task.parentId\n  ) /* will needs option here? */)\n\n]));\n\nconst state: State = {\n  tasks: [\n    { id: 1, name: 'todo1', parentId: null },\n    { id: 2, name: 'todo2', parentId: 1 },\n    { id: 3, name: 'todo3', parentId: 2 },\n  ]\n};\n\nconst next = produceWithDeps(state, state =\u003e {\n  state.tasks[2].name = 'todo3 - updated';\n});\n\n// `state.tasks[0]` was updated via dependent on `state.tasks[1]`.\n// `state.tasks[1]` was updated via dependent on `state.tasks[2]`.\n// `state.tasks[2]` was updated via it self`.\n```\n\n# Todo\n- Support immer's produce API\n- Support environments without `Symbol`\n- Support adding/deleting state\n- Testing in real world apps\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrsh7th%2Fimmer-deps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrsh7th%2Fimmer-deps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrsh7th%2Fimmer-deps/lists"}