{"id":23366692,"url":"https://github.com/d8corp/ajax-mobx","last_synced_at":"2025-10-07T00:41:34.516Z","repository":{"id":57175112,"uuid":"293084652","full_name":"d8corp/ajax-mobx","owner":"d8corp","description":"Ajax functionality for Mobx 3 and more.","archived":false,"fork":false,"pushed_at":"2020-11-21T18:09:20.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-04T12:57:48.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/d8corp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-09-05T13:47:47.000Z","updated_at":"2020-11-21T18:09:22.000Z","dependencies_parsed_at":"2022-08-29T00:11:04.403Z","dependency_job_id":null,"html_url":"https://github.com/d8corp/ajax-mobx","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/d8corp/ajax-mobx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fajax-mobx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fajax-mobx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fajax-mobx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fajax-mobx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d8corp","download_url":"https://codeload.github.com/d8corp/ajax-mobx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d8corp%2Fajax-mobx/sbom","scorecard":{"id":315938,"data":{"date":"2025-08-11","repo":{"name":"github.com/d8corp/ajax-mobx","commit":"7b9cd57029f1b7fe049d9559410667689b5da923"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"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":"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":"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":"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":"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":"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":"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":"Vulnerabilities","score":0,"reason":"30 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-93q8-gq69-wqmw","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-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"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-18T00:11:02.938Z","repository_id":57175112,"created_at":"2025-08-18T00:11:02.938Z","updated_at":"2025-08-18T00:11:02.938Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278703578,"owners_count":26031204,"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-06T02:00:05.630Z","response_time":65,"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":[],"created_at":"2024-12-21T14:17:18.776Z","updated_at":"2025-10-07T00:41:34.469Z","avatar_url":"https://github.com/d8corp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ajax-mobx\n[![NPM](https://img.shields.io/npm/v/ajax-mobx.svg)](https://github.com/d8corp/ajax-mobx/blob/master/CHANGELOG.md)\n[![downloads](https://img.shields.io/npm/dm/ajax-mobx.svg)](https://www.npmjs.com/package/ajax-mobx)\n[![license](https://img.shields.io/npm/l/ajax-mobx)](https://github.com/d8corp/ajax-mobx/blob/master/LICENSE)  \nAjax functionality for [Mobx 3+](https://mobx.js.org/README.html).  \nBased on [async-mobx](https://github.com/d8corp/async-mobx)\n### Installation\nnpm\n```bash\nnpm i ajax-mobx\n```\nyarn\n```bash\nyarn add ajax-mobx\n```\n### Using\n`Ajax` is a `Promise` like constructor\n```javascript\nimport Ajax from 'ajax-mobx'\n\nconst user = await new Ajax('https://reqres.in/api/users/1')\n// user === \"{...}\"\n```\n### then, catch, finally\nUse `then`, `catch` and `finally` like for `Promise`\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\nuser\n  .finally(value =\u003e console.log('finally', value))\n  .then(value =\u003e console.log('then', value))\n  .catch(value =\u003e console.log('catch', value))\n```\n### loading\nYou may check status of the request with `loading` field,\nit's `true` when data is loading. This field is observable.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\n// user.loading === true\n\nawait user\n// user.loading === false\n```\n### loaded\nYou may check status of the request with `loaded` field,\nit's `true` if the data is loaded at least one time.\nThis is an observable field.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\n// user.loaded === false\n\nawait user\n// user.loaded === true\n```\n### value\nYou may get result with `value`.\nThis is an observable field.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\n\nautorun(() =\u003e console.log(user.loading ? 'loading...' : user.value))\n// autorun from mobx\n```\n### error\nYou may handle errors or responses with error status by `error` field.  \nThis is an observable field.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/23')\n// returns 404 user not found\n\nautorun(() =\u003e console.log(\n  user.loading ? 'loading...' : user.error || user.value\n))\n```\n### type\nYou can convert the response to `json` | `text` | `blob` | `arrayBuffer` | `formData`.  \n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1', {type: 'json'})\n\nawait user\n// user.value.data.id === 1\n```\n### default\nYou may provide default `value` for `Ajax`\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1', {\n  type: 'json',\n  default: {data: {id: null}}\n})\n\n// user.value.data.id === null\n\nawait user\n// user.value.data.id === 1\n```\n### response\n`response` is the same `value` but without default value.  \nThis is an observable field.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1', {\n  type: 'json',\n  default: {data: {id: null}}\n})\n\n// user.value.data.id === null\n// user.response === undefined\n\nawait user\n// user.value.data.id === 1\n// user.response.data.id === 1\n```\n### data\nYou can change url of the request via `data` field or option.  \nReturns an observable object.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/{userId}', {\n  type: 'json',\n  data: {userId: 1}\n})\n// request to https://reqres.in/api/users/1\n\nawait user\n// user.value.data.id === 1\n```\n### update\nUnlike a `Promise`, you may reuse `Ajax` with `update` method\n```javascript\nconst user = new Ajax(\n  'https://reqres.in/api/users/{userId}',\n  {type: 'json'}\n)\n\nuser.data.userId = 1\n\nawait user // request to https://reqres.in/api/users/1\n// user.value.data.id === 1\n\nuser.data.userId = 2\nuser.update()\n\nawait user // request to https://reqres.in/api/users/2\n// user.value.data.id === 2\n```\n### query\n`query` works like data, but it changes URL search params.  \nReturns an observable object.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users', {\n  type: 'json',\n  query: {page: 1}\n})\n// request to https://reqres.in/api/users?page=1\n\nawait user\n// user.value.page === 1\n\nuser.query.page = 2\nuser.update()\n\nawait user\n// user.value.page === 2\n```\n### resolve\nYou may use `resolve` to set value without updating or loading.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/{user}', {data: {user: 1}, type: 'json'})\n\nuser.resolve({data: {id: 2}})\n\nawait user\n// user.value.data.id === 2\n\nuser.update()\n\nawait user\n// user.value.data.id === 1\n```\n### reject\nThe same as resolve, but it set an `error` instead of `value`.\n### on, once, off\nYou may add a listener to react on the next events `resolve` | `reject` | `update`\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\nlet test = false\n\nuser.on('resolve', value =\u003e test = value)\n\nawait user\n// test === '{...}'\n```\nYou may add a listener which reacts only once with `once` method.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\nlet test = false\n\nuser.once('resolve', value =\u003e test = value)\n\nawait user\n// test === '{...}'\n```\nYou may turn off a listener\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/1')\nlet test = false\n\nconst listenr = e =\u003e test = e\n\nuser.once('resolve', listenr)\nuser.off('resolve', listenr)\n\nawait user\n// test === undefined\n```\n### answer\nIf you wont to know the status of the response or headers you can use `answer` field.\n```javascript\nconst user = new Ajax('https://reqres.in/api/users/23')\n\n// user.answer === undefined\n\nawait user\n\n// user.answer.ok === false\n// user.answer.status === 404\n```\nIt's better if you extend `Ajax` class to get it.\n```typescript\nclass Api extends Ajax {\n  @computed get status (): number {\n    return this.answer?.status\n  }\n}\n\nconst user = new Api('https://reqres.in/api/users/23')\n\n// user.status === undefined\n\nawait user\n\n// user.status === 404\n```\n## Issues\nIf you find a bug, please file an issue on [GitHub](https://github.com/d8corp/ajax-mobx/issues)  \n[![issues](https://img.shields.io/github/issues-raw/d8corp/ajax-mobx)](https://github.com/d8corp/ajax-mobx/issues)  \n\u003e ---\n[![stars](https://img.shields.io/github/stars/d8corp/ajax-mobx?style=social)](https://github.com/d8corp/ajax-mobx/stargazers)\n[![watchers](https://img.shields.io/github/watchers/d8corp/ajax-mobx?style=social)](https://github.com/d8corp/ajax-mobx/watchers)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Fajax-mobx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd8corp%2Fajax-mobx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd8corp%2Fajax-mobx/lists"}