{"id":24194906,"url":"https://github.com/newraina/ts-plugin-mst-async-action","last_synced_at":"2025-09-21T20:31:48.005Z","repository":{"id":57381011,"uuid":"147319489","full_name":"newraina/ts-plugin-mst-async-action","owner":"newraina","description":"Converts mobx-state-tree async actions to flows ","archived":false,"fork":false,"pushed_at":"2018-09-27T07:25:40.000Z","size":40,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T08:12:27.155Z","etag":null,"topics":["mobx","mobx-state-tree","plugin","typescript"],"latest_commit_sha":null,"homepage":null,"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/newraina.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}},"created_at":"2018-09-04T09:13:51.000Z","updated_at":"2023-07-07T10:22:04.000Z","dependencies_parsed_at":"2022-09-26T16:41:35.138Z","dependency_job_id":null,"html_url":"https://github.com/newraina/ts-plugin-mst-async-action","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newraina%2Fts-plugin-mst-async-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newraina%2Fts-plugin-mst-async-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newraina%2Fts-plugin-mst-async-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newraina%2Fts-plugin-mst-async-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newraina","download_url":"https://codeload.github.com/newraina/ts-plugin-mst-async-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233791248,"owners_count":18730815,"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":["mobx","mobx-state-tree","plugin","typescript"],"created_at":"2025-01-13T18:40:09.576Z","updated_at":"2025-09-21T20:31:42.687Z","avatar_url":"https://github.com/newraina.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts-plugin-mst-async-action\n\n[![npm](https://img.shields.io/npm/v/ts-plugin-mst-async-action.svg)](https://www.npmjs.com/package/ts-plugin-mst-async-action)\n[![travis-ci](https://travis-ci.com/newraina/ts-plugin-mst-async-action.svg?branch=master)](https://travis-ci.com/newraina/ts-plugin-mst-async-action)\n\nConverts mobx-state-tree async actions to flows. inspired by [babel-plugin-mobx-async-action](https://github.com/Strate/babel-plugin-mobx-async-action)\n\n## Example\n\n### In\n\n```ts\nimport { types } from 'mobx-state-tree'\n\nconst store = types.model({ count: 0 }).actions(self =\u003e ({\n  async getCount() {\n    self.count = await api.getCount()\n  }\n}))\n```\n\n### Out\n\n```ts\nimport { types } from 'mobx-state-tree'\nimport { flow } from 'mobx-state-tree'\n\nconst store = types.model({ count: 0 }).actions(self =\u003e ({\n  getCount: flow(function*() {\n    self.count = yield api.getCount()\n  })\n}))\n```\n\n## Usage\n\n### With ts-loader\n\n```js\n// webpack.config.js\nconst tsMstAsyncActionPluginFactory = require('ts-plugin-mst-async-action')\n\nmodule.exports = {\n  // ...\n  module: {\n    rules: [\n      {\n        test: /\\.(tsx|ts)$/,\n        loader: 'ts-loader',\n        options: {\n          getCustomTransformers: () =\u003e ({\n            before: [tsMstAsyncActionPluginFactory(/** options */)]\n          }),\n          compilerOptions: {\n            module: 'es2015'\n          }\n        }\n      }\n    ]\n  }\n  // ...\n}\n```\n\n### Options\n\n- mstPackage `string`\n\n  if you use wrapper for \"mobx-state-tree\" package, you can pass it's name to plugin\n\n  default: `'mobx-state-tree'`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewraina%2Fts-plugin-mst-async-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewraina%2Fts-plugin-mst-async-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewraina%2Fts-plugin-mst-async-action/lists"}