{"id":15389301,"url":"https://github.com/geotrev/core-flux","last_synced_at":"2025-09-15T12:41:10.060Z","repository":{"id":51345530,"uuid":"360417533","full_name":"geotrev/core-flux","owner":"geotrev","description":"½kb functional flux utility. Control the flow of state data between subscribers.","archived":false,"fork":false,"pushed_at":"2025-08-31T11:05:25.000Z","size":921,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-31T13:06:46.362Z","etag":null,"topics":["architecture","bindings","dispatch","flux","payload","reducer","redux","state","state-management","subscription"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/geotrev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-22T06:39:20.000Z","updated_at":"2022-01-01T17:27:27.000Z","dependencies_parsed_at":"2024-01-17T08:35:27.750Z","dependency_job_id":"59919a07-70cf-4822-ab66-e985a29b7280","html_url":"https://github.com/geotrev/core-flux","commit_stats":{"total_commits":132,"total_committers":5,"mean_commits":26.4,"dds":0.5833333333333333,"last_synced_commit":"f02180d53ab58f0356a6beaf69a97f1fb2e70ed8"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/geotrev/core-flux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geotrev%2Fcore-flux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geotrev%2Fcore-flux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geotrev%2Fcore-flux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geotrev%2Fcore-flux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geotrev","download_url":"https://codeload.github.com/geotrev/core-flux/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geotrev%2Fcore-flux/sbom","scorecard":{"id":423423,"data":{"date":"2025-08-11","repo":{"name":"github.com/geotrev/core-flux","commit":"f02180d53ab58f0356a6beaf69a97f1fb2e70ed8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.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":"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":"Code-Review","score":0,"reason":"Found 0/10 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":"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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/geotrev/core-flux/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/geotrev/core-flux/test.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand 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":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":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"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 20 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":"18 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-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","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-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-cchq-frgv-rjh5","Warn: Project is vulnerable to: GHSA-g644-9gfx-q4q4","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"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-19T01:45:55.687Z","repository_id":51345530,"created_at":"2025-08-19T01:45:55.687Z","updated_at":"2025-08-19T01:45:55.687Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275260465,"owners_count":25433378,"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-09-15T02:00:09.272Z","response_time":75,"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":["architecture","bindings","dispatch","flux","payload","reducer","redux","state","state-management","subscription"],"created_at":"2024-10-01T14:59:57.780Z","updated_at":"2025-09-15T12:41:10.036Z","avatar_url":"https://github.com/geotrev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCore Flux\u003c/h1\u003e\n\u003cp align=\"center\"\u003e½kb functional flux utility. Control the flow of state data between subscribers.\u003c/p\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/core-flux\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/core-flux.svg?sanitize=true\u0026style=flat-square\" alt=\"Version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/geotrev/core-flux/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/core-flux.svg?sanitize=true\u0026style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/geotrev/core-flux/actions/workflows/test.yml?query=branch%3Amain\"\u003e\u003cimg src=\"https://badgen.net/github/checks/geotrev/core-flux/main?style=flat-square\" alt=\"CI status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://bundlephobia.com/package/core-flux\"\u003e\u003cimg src=\"https://badgen.net/bundlephobia/minzip/core-flux?style=flat-square\" alt=\"bundle size\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.libraries.io/npm/core-flux\"\u003e\u003cimg src=\"https://img.shields.io/librariesio/release/npm/core-flux\" alt=\"dependency status\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[See a demo of Core Flux in action!](https://todo-rotom.netlify.app/)\n\n- [Install](#install)\n- [API](#api)\n  - [`createStore()`](#createstore)\n  - [`subscribe()`](#subscribe)\n  - [`dispatch()`](#dispatch)\n- [Exposing the store](#exposing-the-store)\n- [Data model](#data-model)\n- [Data flow](#data-flow)\n\n## Install\n\n### NPM / Yarn\n\n```sh\n$ npm i core-flux\n```\n\n```sh\n$ yarn i core-flux\n```\n\n### CDN\n\nThe CDN puts the library on `window.CoreFlux`.\n\n```html\n\u003c!-- The unminified bundle for development --\u003e\n\u003cscript\n  type=\"text/javascript\"\n  src=\"https://cdn.jsdelivr.net/npm/core-flux@2.0.0/dist/core-flux.js\"\n  integrity=\"sha256-yRWVHNaxTvbEj7ZEytgW2nmJAAf18mYs+5s3eeqLojc=\"\n  crossorigin=\"anonymous\"\n\u003e\u003c/script\u003e\n\n\u003c!-- Minified/uglified bundle for production --\u003e\n\u003cscript\n  type=\"text/javascript\"\n  src=\"https://cdn.jsdelivr.net/npm/core-flux@2.0.0/dist/core-flux.min.js\"\n  integrity=\"sha256-FXNzEKAxvH7fIAl913+qHOpG233431Ug3RBpghM3b+U=\"\n  crossorigin=\"anonymous\"\n\u003e\u003c/script\u003e\n```\n\n## API\n\n\u003ch3 id=\"createstore\"\u003e\u003ccode\u003ecreateStore(initialSate, reducer, bindSubscriber, bindState)\u003c/code\u003e\u003c/h3\u003e\n\nThe one and only export of Core Flux. Use it to create a store instance. You can create as few or as many stores as your heart desires! They will all be independent from one another.\n\n_**NOTE**: The base state type must be a plain object. Invalid types will throw an error._\n\nThe function **requires** all four of its arguments, including [bindings](#bindings):\n\n```js\n// foo-store.js\n\nimport { createStore } from \"core-flux\"\nimport { reducer, bindSubscriber, bindState } from \"./foo-bindings\"\n\nconst initialState = {\n  foo: [],\n  bar: { baz: 0, beep: \"hello\" },\n}\n\nconst { subscribe, dispatch } = createStore(\n  initialState,\n  reducer,\n  bindSubscriber,\n  bindState\n)\n\nexport { subscribe, dispatch }\n```\n\nOnce a store is created, you'll be able to add subscriptions with `subscribe` and request state updates with `dispatch`.\n\n\u003ch3 id=\"subscribe\"\u003e\u003ccode\u003esubscribe(subscriber, data)\u003c/code\u003e\u003c/h3\u003e\n\nAdds a subscription to your store. It will always be tied to a single store, and subsequently state object.\n\n```js\nimport { subscribe } from \"./foo-store\"\n\nclass FooItems {\n  constructor() {\n    subscribe(this, [\"foo\"])\n  }\n\n  get items() {\n    return this.foo\n  }\n}\n```\n\nIn the above example, we've designed the subscriber, the `FooItems` class, to declare an array of strings correlating to properties in the store's state. If you're from the Redux world, this is akin to \"connecting\" a consumer to a provider via higher-order function/component.\n\nAfter the subscribe call is made, your `bindSubscriber` function will be called where you can pass along the default values as you see fit.\n\n_**NOTE:** In general, you should try to use a simple data structure as the second argument to `subscribe`; this ensures your bindings have generic and consistent expectations._\n\n\u003ch3 id=\"dispatch\"\u003e\u003ccode\u003edispatch(type, payload)\u003c/code\u003e\u003c/h3\u003e\n\nRequests a state change in your store.\n\nWe can extend the previous example with a setter to call `dispatch`:\n\n```js\nimport { subscribe, dispatch } from \"./foo-store\"\n\nclass FooItems {\n  constructor() {\n    subscribe(this, [\"foo\"])\n  }\n\n  get items() {\n    return this.foo\n  }\n\n  addItem(item) {\n    dispatch(\"ADD_ITEM\", { item })\n  }\n}\n\nconst fooBar = new FooItems()\nfooBar.addItem(\"bop\")\n```\n\nNow when the `addItem` method is called, Core Flux will pass along the action type and payload to your reducer.\n\nThe reducer could have a logic branch on the action type called `ADD_ITEM` which adds the given item to state, then returns the resulting new state (containing the full items list).\n\nFinally, the result would then be handed over to your `bindState` binding.\n\n_**NOTE:** Much like in `subscribe`, it's best to maintain data types in the payload so your reducer can have consistent expectations._\n\n#### Bindings\n\nHere's a breakdown of each binding needed when initializing a new store:\n\n##### **`bindSubscriber(subscription, state)`**\n\n\u003e `subscription ([subscriber, data])`: A tuple containing the subscribed object and its state-relational data.\u003cbr/\u003e`state (object)`: The current state object.\n\nCalled after a new `subscribe` is made and a subscription has been added to the store. Use it to _set initial state_ on the new subscriber. Use the `data` provided to infer a new operation, e.g., setting a stateful property to the subscriber.\n\n##### **`reducer(state, action)`**\n\n\u003e `state (object)`: Snapshot of the current state object.\u003cbr/\u003e`action ({ type: string, payload: object })`: The dispatched action type and its payload.\n\nCalled during a new `dispatch`. Create a new version of state and return it.\n\n##### **`bindState(subscriptions, reducedState, setState)`**\n\n\u003e `subscriptions (subscription[])`: An array containing all subscriptions.\u003cbr/\u003e`reducedState (object)`: The state object as returned by the reducer.\u003cbr/\u003e`setState (function)`:\n\nCalled at the end of a `dispatch` call, after your reducer callback has processed the next state value. Set your new state back to subscribers **and** back to the store. It's possible and expected for you to call `bindSubscriber` again to DRYly apply these updates. You can return from this function safely to noop.\n\n## Exposing the store\n\nFor utility or debugging reasons, you may want to look at the store you're working with. To do so, you can use the `__data` property when creating a store:\n\n```js\nconst fooStore = createStore(initialState, reducer, bindSubscriber, bindState)\n\nwindow.fooStoreData = fooStore.__data\n\nconsole.log(window.fooStoreData) // { state: {...}, subscriptions: [...] }\n```\n\n_**NOTE:** Avoid over-referencing or depending on `__data` too deeply. The data is mutable and changing it directly will cause unexpected behavior._\n\n## Data model\n\nCore Flux has a relatively simple data model that you should understand when creating [bindings](#bindings).\n\nHere is how state looks in all cases:\n\n```js\nStore {\n  state: { ... },\n  subscriptions: [\n    [subscriber, data],\n    [subscriber, data],\n    [subscriber, data],\n    // ...\n  ]\n}\n```\n\nEach item in `subscriptions` contains a `subscriber` and some form of `data` that informs a relationship between `state` and `subscriber`.\n\n_**NOTE:** \\_You_ define `data` in the above model. This ensures that ultimately you control communicating state relationships to subscribers.\\_\n\n## Data flow\n\nHere is the general lifecycle of subscribing to the store \u0026 dispatching a state update.\n\n- `subscribe` \u003e `bindSubscriber`\n- `dispatch` \u003e `reducer` \u003e `bindState`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeotrev%2Fcore-flux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeotrev%2Fcore-flux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeotrev%2Fcore-flux/lists"}