{"id":13847425,"url":"https://github.com/ngxs-labs/select-snapshot","last_synced_at":"2026-01-15T00:50:42.734Z","repository":{"id":34896431,"uuid":"187811254","full_name":"ngxs-labs/select-snapshot","owner":"ngxs-labs","description":"🌊 Flexibile decorator that allows to get a snapshot of the state","archived":false,"fork":false,"pushed_at":"2024-09-13T10:34:09.000Z","size":2832,"stargazers_count":42,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-22T21:04:03.260Z","etag":null,"topics":["angular","ngxs","select","stage-3","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/ngxs-labs.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":"2019-05-21T10:00:37.000Z","updated_at":"2025-07-24T14:35:58.000Z","dependencies_parsed_at":"2024-11-22T00:01:09.393Z","dependency_job_id":null,"html_url":"https://github.com/ngxs-labs/select-snapshot","commit_stats":{"total_commits":139,"total_committers":5,"mean_commits":27.8,"dds":"0.19424460431654678","last_synced_commit":"7c81606574e9d89d9985ccc2ae37e8198c2e1d95"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/ngxs-labs/select-snapshot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngxs-labs%2Fselect-snapshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngxs-labs%2Fselect-snapshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngxs-labs%2Fselect-snapshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngxs-labs%2Fselect-snapshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngxs-labs","download_url":"https://codeload.github.com/ngxs-labs/select-snapshot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngxs-labs%2Fselect-snapshot/sbom","scorecard":{"id":683716,"data":{"date":"2025-08-11","repo":{"name":"github.com/ngxs-labs/select-snapshot","commit":"fe48123390b77d361c12a799dd8685ff3d6ce94d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 2/26 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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/select-snapshot.yml:1","Info: no jobLevel write permissions found"],"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/select-snapshot.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/ngxs-labs/select-snapshot/select-snapshot.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/select-snapshot.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/ngxs-labs/select-snapshot/select-snapshot.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/select-snapshot.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/ngxs-labs/select-snapshot/select-snapshot.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned"],"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":"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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"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 'master'"],"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"51 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-r7jx-5m6m-cpg9","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-q9mw-68c2-j6m5","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T00:00:07.179Z","repository_id":34896431,"created_at":"2025-08-22T00:00:07.180Z","updated_at":"2025-08-22T00:00:07.180Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28440550,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:34:46.850Z","status":"ssl_error","status_checked_at":"2026-01-15T00:34:46.551Z","response_time":107,"last_error":"SSL_read: 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":["angular","ngxs","select","stage-3","typescript"],"created_at":"2024-08-04T18:01:19.918Z","updated_at":"2026-01-15T00:50:42.716Z","avatar_url":"https://github.com/ngxs-labs.png","language":"TypeScript","funding_links":[],"categories":["State Management","TypeScript"],"sub_categories":["NGXS"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/ngxs-labs/emitter/master/docs/assets/logo.png\"\u003e\n\u003c/p\u003e\n\n---\n\n\u003e Flexibile decorator, an alternative for the `@Select` but selects a snapshot of the state\n\n![@ngxs-labs/select-snapshot](https://github.com/ngxs-labs/select-snapshot/workflows/@ngxs-labs/select-snapshot/badge.svg)\n[![NPM](https://badge.fury.io/js/%40ngxs-labs%2Fselect-snapshot.svg)](https://badge.fury.io/js/%40ngxs-labs%2Fselect-snapshot)\n[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/ngxs-labs/select-snapshot/blob/master/LICENSE)\n\n## Table of Contents\n\n- [Compatibility with Angular Versions](#compatibility-with-angular-versions)\n- [Install](#📦-install)\n- [Usage](#🔨-usage)\n- [API](#api)\n  - [SelectSnapshot](#selectsnapshot)\n  - [ViewSelectSnapshot](#viewselectsnapshot)\n- [Summary](#summary)\n\n## Compatibility with Angular Versions\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003e@ngxs-labs/select-snapshot\u003c/th\u003e\n      \u003cth\u003eAngular\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        3.x\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003e= 10.0.5 \u003c 13\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        4.x\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003e= 13 \u003c 15\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        5.x\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003e= 15\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## 📦 Install\n\nTo install `@ngxs-labs/select-snapshot`, run the following command:\n\n```sh\n$ npm install @ngxs-labs/select-snapshot\n# Or if you're using yarn\n$ yarn add @ngxs-labs/select-snapshot\n# Or if you're using pnpm\n$ pnpm install @ngxs-labs/select-snapshot\n```\n\n## 🔨 Usage\n\nImport the `NgxsSelectSnapshotModule` into your root application module:\n\n```typescript\nimport { NgModule } from '@angular/core';\nimport { NgxsModule } from '@ngxs/store';\nimport { NgxsSelectSnapshotModule } from '@ngxs-labs/select-snapshot';\n\n@NgModule({\n  imports: [NgxsModule.forRoot(states), NgxsSelectSnapshotModule.forRoot()],\n})\nexport class AppModule {}\n```\n\n## API\n\n`@ngxs-labs/select-snapshot` exposes `@SelectSnapshot` and `@ViewSelectSnapshot` decorators, they might be used to decorate class properties.\n\n### SelectSnapshot\n\n`@SelectSnapshot` decorator should be used similarly to the `@Select` decorator. It will decorate the property to always return the latest selected value, whereas `@Select` decorates properties to return observable. Given the following example:\n\n```ts\nimport { SelectSnapshot } from '@ngxs-labs/select-snapshot';\n\n@Injectable()\nexport class TokenInterceptor {\n  @SelectSnapshot(AuthState.token) token: string | null;\n\n  intercept(req: HttpRequest\u003cany\u003e, next: HttpHandler): Observable\u003cHttpEvent\u003cany\u003e\u003e {\n    if (this.token) {\n      req = req.clone({\n        setHeaders: {\n          Authorization: `Bearer ${this.token}`,\n        },\n      });\n    }\n\n    return next.handle(req);\n  }\n}\n```\n\nWe don't have to inject the `Store` and call the `selectSnapshot`.\n\nBehind the scenes, `@SelectSnapshot` sets up a getter that calls `store.selectSnapshot` with the provided selector on each access.\nIn the above example, it roughly equates to setting up this property getter:\n\n```ts\nget token(): string | null {\n  // ... inject `Store` in variable `store`\n  return store.selectSnapshot(AuthState.token);\n}\n```\n\n### ViewSelectSnapshot\n\n`@ViewSelectSnapshot` is a decorator that should decorate class properties that are used in templates (e.g. _renderable_ or passed as _bindings_). Given the following example:\n\n```ts\n@Component({\n  selector: 'app-progress',\n  template: `\n    \u003cdiv\u003e\n      \u003cdiv [style.width.%]=\"progress\"\u003e\u003c/div\u003e\n    \u003c/div\u003e\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ProgressComponent {\n  // 🚫 Do not use `SelectSnapshot` since `progress` is used in the template.\n  @SelectSnapshot(ProgressState.getProgress) progress: number;\n}\n```\n\nThe `@ViewSelectSnapshot` decorator will force the template to be updated whenever the `progress` property is changed on the state:\n\n```ts\n@Component({\n  selector: 'app-progress',\n  template: `\n    \u003cdiv\u003e\n      \u003cdiv [style.width.%]=\"progress\"\u003e\u003c/div\u003e\n    \u003c/div\u003e\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ProgressComponent {\n  // ✔️ Our view will be checked and updated.\n  @ViewSelectSnapshot(ProgressState.getProgress) progress: number;\n}\n```\n\nThe decorator internally subscribes to `store.select` with the provided selector and calls `markForCheck()` whenever the state is updated (and the selector emits).\n\n## Summary\n\nWe have looked at several examples of using both decorators. Consider to use the `@SelectSnapshot` if decorated properties are not used in templates! Consider to use the `@ViewSelectSnapshot` if decorated properties are used in templates (e.g. _renderable_ or passed as _bindings_).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngxs-labs%2Fselect-snapshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngxs-labs%2Fselect-snapshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngxs-labs%2Fselect-snapshot/lists"}