{"id":15731555,"url":"https://github.com/tuchk4/action-history","last_synced_at":"2025-03-31T02:49:13.711Z","repository":{"id":74997870,"uuid":"55781852","full_name":"tuchk4/action-history","owner":"tuchk4","description":null,"archived":false,"fork":false,"pushed_at":"2017-07-24T10:00:19.000Z","size":4,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T07:46:47.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tuchk4.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2016-04-08T13:41:55.000Z","updated_at":"2016-07-01T17:43:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"113ee506-8a57-4f37-8034-2c306d7c9274","html_url":"https://github.com/tuchk4/action-history","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"6f48cb56caf8a5b3d0bfc1a6287ba411b2e3c33f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Faction-history","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Faction-history/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Faction-history/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuchk4%2Faction-history/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuchk4","download_url":"https://codeload.github.com/tuchk4/action-history/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246408101,"owners_count":20772229,"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-04T00:02:10.742Z","updated_at":"2025-03-31T02:49:13.695Z","avatar_url":"https://github.com/tuchk4.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bivrost (data layer for JS applications)\n\n[![NPM Version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n\nBivrost allows to organize a simple interface to asyncronous APIs.\n\nThe main idea of Bivrost is grouping several API methods into data-sources.\nEach data-source is ES6 class.\n\n## Installation\n\n## Usage\n\n### bivrost/http/api\n\n`Api` is simple HTTP client wrapper that lets us define REST methods in single line of code.\n\n```js\nimport axios from 'axios';\nimport HttpAdapterAxios from 'bivrost/http/adapter/axios';\nimport Api from 'bivrost/http/api';\n\n//setup Api client\nconst WeatherApi = Api.extend({\n  base: 'http://api.openweathermap.org',\n  prefix: '/data/2.5/',\n  adapter: HttpAdapterAxios(axios),\n});\n\n//define API method\nconst dailyForecast = WeatherApi('GET /forecast/daily');\n\n//call API method\ndailyForecast({q: 'Kiev'})\n  .then((response) =\u003e console.log(response));\n\n```\n\n### bivrost/data/source\n\n`DataSource` lets us define REST resources declaratively.\n\nBy default, every method call passes the following steps:\n\n * **`inputType`** — type-check the input params\n * **`prepare`** — prepare the request (make high-level transformations, e.g., add any kinds of meta-data to the request, etc)\n * **`serialize`** — convert the request to the format understood by the server\n * **`api`** — call the API method\n * **`unserialize`** — convert the server request to the format understood by our application\n * **`process`** — process the request (make high-level transformations)\n * **`outputType`** — type-check the result\n\nNote: type checking plays well with [tcomb](http://gcanti.github.io/tcomb/) runtime type checking library.\n\nIn `methodProperties()` we can define any step from this list for any API method.\n\nSee [full example](https://github.com/frankland/bivrost/blob/master/src/example/weather/index.js)\n\n```js\nimport DataSource from 'bivrost/data/source';\n\nclass WeatherDataSource extends DataSource {\n  dailyForecast(city) {\n    return this.invokeMethod('dailyForecast', {q:city});\n  }\n\n  methodProperties() {\n    return {\n      //API methods (our interface to the external world):\n      api: {\n        dailyForecast: WeatherApi('GET /forecast/daily')\n      },\n      //Type checking:\n      inputType: {\n        dailyForecast: t.struct({q: t.Str}) //input data is checked against tcomb structure\n      },\n      outputType: {\n        dailyForecast: TWeatherForecast //output data is checked against tcomb structure\n      },\n      //Caching:\n      cache: {\n        dailyForecast: {\n          enabled: true,  //The results of `dailyForecast` method call will be cached\n          ttl: 60 * 60 * 1000, //for an hour.\n          isGlobal: true, //Share the same cache for all instances of WeatherDataSource. (default - no)\n        }\n      },\n    };\n  }\n}\n\n```\n\n\n\n[npm-image]: https://img.shields.io/npm/v/bivrost.svg\n[npm-url]: https://npmjs.org/package/bivrost\n[travis-image]: https://travis-ci.org/frankland/bivrost.svg?branch=master\n[travis-url]: https://travis-ci.org/frankland/bivrost\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuchk4%2Faction-history","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuchk4%2Faction-history","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuchk4%2Faction-history/lists"}