{"id":15857310,"url":"https://github.com/timmikeladze/redux-conductor","last_synced_at":"2025-08-04T12:35:38.674Z","repository":{"id":74921858,"uuid":"59882070","full_name":"TimMikeladze/redux-conductor","owner":"TimMikeladze","description":"Redux Conductor: Automatically conduct event traffic through Redux by reacting to actions","archived":false,"fork":false,"pushed_at":"2018-01-04T06:06:48.000Z","size":13,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T23:45:37.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/TimMikeladze.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,"publiccode":null,"codemeta":null}},"created_at":"2016-05-28T07:10:00.000Z","updated_at":"2016-05-28T07:10:00.000Z","dependencies_parsed_at":"2023-02-26T14:45:51.170Z","dependency_job_id":null,"html_url":"https://github.com/TimMikeladze/redux-conductor","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"c93679fee92b1821707cd1352ad00e7873d1ebe8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TimMikeladze/redux-conductor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fredux-conductor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fredux-conductor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fredux-conductor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fredux-conductor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimMikeladze","download_url":"https://codeload.github.com/TimMikeladze/redux-conductor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fredux-conductor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265768770,"owners_count":23825174,"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":[],"created_at":"2024-10-05T20:22:11.672Z","updated_at":"2025-07-18T13:34:09.982Z","avatar_url":"https://github.com/TimMikeladze.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux Conductor\n`npm install --save redux-conductor`\n\nAutomatically conduct event traffic through Redux by reacting to actions.\n\n### Quick overview\n\n- **`createConductor`** creates an object called a `Conductor` that wraps around a Redux store.\n- **`createRoute`** creates a route, which is a \"generator function\" of the store's current state. Routes get added to a\nconductor. Each route \"listens\" for changes in state that resulted from a certain kind of action. When it matches, the\nroute is called with a \"yield\" function and the resulting state. The route may then call \"yield\" repeatedly with a series\nof values, which are usually actions. A route can call \"yield\" once... never... multiple times... after a Promise\nresolves or rejects... or in any fashion. *This is the power of the route*.\n- Add a route to a conductor with `Conductor.route( ... ).to( ... )`. The function passed to `to` will be passed to the\nroute as its \"yield\" function. Use `.toDispatch()` instead of `.to( ... )` to use `store.dispatch` as the route's\n\"yield\" function. A route is a bit like an \"automatic\" Redux thunk.\n- Call `Conductor.start()` to dispatch an action of type `START` to the conductor's store. Now you can add a route that\n\"listens\" for a `START` action and dispatches something else.\n\n### NOTE: Redux Conductor's special reducer and actions\n\nRedux Conductor uses a special reducer to create its store. You do not write a reducer. The reducer begins with an\ninitial state of an empty [Immutable.js](https://facebook.github.io/immutable-js/) `Map`. Redux Conductor's reducer\nexpects a special type of action, which contains the following properties:\n- `type` - A string that is the action's type.\n- `path` (optional) - An array of keys that point to a value within state. This value itself is a `Map`.\n- `props` (optional) - An object with key-value pairs that will be set on the value at `path`.\n\nFor every action, the reducer sets two keys on state, `type` and `path`, which are equal to the corresponding properties\nof the action. If `action.path` is not present, then the reducer deletes `path` from state.\n\n- If `action.type === 'REMOVE'`, then the reducer deletes the key at `action.path`.\n- Otherwise, for any other `action.type`, the reducer first checks for the presence of `action.path`. If present, then...\n  1) If `action.props` is present, the reducer assigns each key-value pair in `action.props`, onto the value at `action.path`.\n  2) The reducer sets a key with the same name as the value at `action.type`, with a value equivalent to `Date.now()`,\n  onto the value at `action.path`. These \"last action\" timestamps can be useful when implementing certain kinds of routes.\n\n### API\n\n### `createConductor([ mapReducerToStore ])`\n- `mapReducerToStore` is an optional function that returns a Redux store based on a given reducer. Defaults to `createStore`.\n- You might use `mapReducerToStore` if you want Conductor to create a store with middleware or some other customization.\n- **Returns** a new instance of the `Conductor` class.\n- (*Note:* All methods of `Conductor` are composable, meaning that they all return `this`.)\n\n#### `Conductor.route(route)`\n- `route` is a function called immediately after state changes, with a \"yield\" function and the current state.\n`route` may asynchronously call the \"yield\" function, which is defined by the next call to `Conductor.to`.\n- **Returns** `this`.\n\n#### `Conductor.to(yield_function)`\n- Defines the yield function passed to a `route`, which is defined by the previous call to `Conductor.route`.\n- **Returns** `this`.\n\n#### `Conductor.toDispatch()`\n- Equivalent to `Conductor.to(this._store.dispatch)`. Routes to the `dispatch` method of the conductor's Redux store.\n- **Returns** `this`.\n\n#### `Conductor.start()`\n- Dispatches an action of type `START` to the conductor's Redux store.\n- **Returns** `this`.\n\n### `createRoute(options)`\n- `options.action` - An action-like object with optional `type` and `path` properties. If and only if the store's last\naction matches these properties, then the route will execute when state changes. `path` will successfully match against\na last action with the same path or any descendant path.\n- `options.route` - A function of a \"yield\" function and the current state.\n- This function is syntactic sugar for creating a route with a guard condition based on the \"last action\".\n- **Returns** a `function(Function, Immutable.Map)`.\n\n### `combineRoutes(routes)`\n- `routes` - An array or other iterable object (i.e. it must have a `forEach` property) of routes.\n- **Returns** a single route that yields the results of each route in `routes`.\n\n### `logger`\n- A route that yields a single-line log of the last action, with a relative millisecond timestamp.\n\n### `nextKey(map)`\n- `map` - An Immutable `Map`. Defaults to a new empty `Map`.\n- Return the maximum key in the given Map (or zero), plus one.\n\n### `onRequest`\n- A route that yields a `RESOLVE` or `REJECT` action after executing a Promise passed through the `promise` property of\na `REQUEST` action.\n\n### Future features?\n\n- Support for combining the default reducer with other reducers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimmikeladze%2Fredux-conductor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimmikeladze%2Fredux-conductor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimmikeladze%2Fredux-conductor/lists"}