{"id":15561878,"url":"https://github.com/doodzik/hydraulik","last_synced_at":"2025-03-29T04:43:15.292Z","repository":{"id":28750242,"uuid":"32272256","full_name":"doodzik/hydraulik","owner":"doodzik","description":"Hydraulik is an experimental library for writing state handling React components. ","archived":false,"fork":false,"pushed_at":"2015-09-30T08:31:03.000Z","size":422,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T12:48:17.550Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doodzik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-15T16:56:17.000Z","updated_at":"2015-08-23T18:29:27.000Z","dependencies_parsed_at":"2022-09-05T01:30:24.594Z","dependency_job_id":null,"html_url":"https://github.com/doodzik/hydraulik","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodzik%2Fhydraulik","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodzik%2Fhydraulik/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodzik%2Fhydraulik/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doodzik%2Fhydraulik/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doodzik","download_url":"https://codeload.github.com/doodzik/hydraulik/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140541,"owners_count":20729797,"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-02T16:10:33.218Z","updated_at":"2025-03-29T04:43:15.271Z","avatar_url":"https://github.com/doodzik.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hydraulik\n\n[![Build Status](https://travis-ci.org/doodzik/hydraulik.svg?branch=master)](https://travis-ci.org/doodzik/hydraulik)\n[![Dependencies Status](https://david-dm.org/doodzik/hydraulik.svg)](https://david-dm.org/doodzik/hydraulik)\n[![DevDependencies Status](https://david-dm.org/doodzik/hydraulik/dev-status.svg)](https://david-dm.org/doodzik/hydraulik#info=devDependencies)\n\nHydraulik is an experimental react library for writing state handling components.\n\n# Usage\n\nThere is a separate documentation for the [cli] (https://github.com/doodzik/hydraulik-cli) and [types] (https://github.com/doodzik/hydraulik-types) available.\n\n```jsx\nimport React, { Component }          from 'react'\nimport { Schema, type, skip, Klass } from 'hydraulik'\nimport { Str }                       from 'hydraulik-types'\n\n@type(Str, name = 'first_name')\nclass Users extend Schema {}\n\nvar klass = new Klass()\n    klass.push(Users)\n    klass.push(User)\n\nvar users = klass.sets.users,\n    user  = klass.sets.user\n\nusers.create({ name: 'testName'})\nusers.create({ name: 'Second' })\n\n// these components automatically listen for changed data\nvar UserList = users.Component(class {\n  render(){\n    let Lis = this.params.users.map(user =\u003e \u003cli\u003euser.first_name\u003c/li\u003e)\n    return \u003cul\u003e\u003cLis /\u003e\u003c/ul\u003e\n  }\n}\n\nvar UserCreate = users.ComponentError(class {\n  onClick() {\n    users.create({ name: '' })\n  }\n\n  render(){\n    return (\n      \u003cdiv\u003e\n        \u003cspan\u003e\n          { this.params.users_error.name }\n        \u003c/span\u003e\n        \u003cbutton onClick={this.onClick} /\u003e\n      \u003c/div\u003e\n    )\n  }\n})\n\n// ...\n  render(){\n    return (\n      \u003cUserList /\u003e\n      \u003cUserCreateState /\u003e\n    )\n  }\n// ...\n```\n\n#Motivation\n\nAfter writing several apis and single page apps I've got frustrated with repeating myself over and over again. I want to define how my data behaves declaritive. With as little mental overhead as possible.\n\n#Installation\n\nRequirements: [nvm] (https://github.com/creationix/nvm)\n\n```bash\nmkdir $projectName\ncd $_\nnpm init\nnpm install hydraulik-cli --save-dev\n(npm bin)/hydraulik init\nnpm install\n\n# or in one line\nmkdir $projectName \u0026\u0026 cd $_ \u0026\u0026 npm init \u0026\u0026 npm install hydraulik-cli --save-dev \u0026\u0026 (npm bin)/hydraulik init \u0026\u0026 npm install\n\n```\n\n#Test\n\nHydraulik uses jest for testing. You can run its test by\n`$ npm test`.\nIf it dosn't work try running `$ nvm use` in the hydraulik dir and reinstall the dependencies.\n\n#API\n##Schema - Set\n\n###`@type(type: Type, [name = typeName], [preset = null])`\n\nTakes a Type that implement this [interface] (https://github.com/doodzik/hydraulik-types).\nThe name of the type is the Types name downcased.\nYou can overwrite the type behavior on an child class.\npreset == default value. Only if value null or undefiend.\n\n###`@skip([val: Int])`\n\n@skip() skips as many matches as provided in props.skip. defaults to 0 if params.skip isn't defined\n@skip(int) skips as many as are defined for int\n\nif skip is 0 nothing is skiped\n\n###`@limit([val: Int])`\n\n@limit() limits as many matches as provided in props.limit. defaults to 0 if params.limit isn't defined\n@limit(int) limits as many as are defined for int\n\nif limit is 0 nothing is limited\nif limit is 1 it returns the element without the surrounding array\n\n###`#filter(filterFn: function(val))`\n\nfilters the set. FilterFn has to return a boolean. Val is an element of the set. You can access args from outside via val.params. Params from the component\n\n##ObserverSet/ObserverSubset\n\ninstances of the ObserverSet/ObserverSubset are stored in the Klass instance variable sets.\n\n###`create(argObj: Object)`\n\n###`update(argObj: Object, query: Object)`\n\n###`destroy(query: Object)`\n\n###`Component(ComposedComponent: Component)`\n\n###`ComponentError(ComposedComponent: Component)`\n\n#Contributing\n\n##[Code of Conduct] (https://github.com/doodzik/hydraulik/blob/master/CODE_OF_CONDUCT.md)\n\n##Issues \u0026 Feature Requests\n\nIf you encounter a bug, inconsistencies or if anything isn't clear or clear enough open an issue.\nIf you want a feature. Open an issue and we will discuss it. I'm happy to introduce you to hydraulik's code base.\nFeel free to reopen issues and claim unassigned issues for yourself to solve.\nThe issue doesn't have to be code relatet. If you think that there can be something done with this projects organization open an issue.\n\n##Guide\n\nThe source code lives in the src folder.\n\n###hydraulik.jsx\nexports all classes that can be accessible through `import * from 'hydraulik'`\n\n###klass.jsx\nThe [Class] (http://en.wikipedia.org/wiki/Class_(set_theory)) contains all sets.\nBuilds sets if #sets is called the first time. Build with the klassBuilder.\n\n###klassBuilder.jsx\nIt makes that the BaseSet and SubSet share the same storage.\nConverts sets into observed sets\n\n###observerSet.jsx\ninherits from observerSubset and registers new action to the dispatcher\n\n###observerSubset.jsx\nThe adapter for the different set types.\nThe user interacts with its methods.\n\n###schema.jsx\nThe DSL for Hydraulik.\n\n###schema-decorators.jsx\ndecorators for the schema.\n\n###\\*-set.jsx\nTODO - move to own module\nsets provide crud operations and validation for an data table\n\n###setEvents.jsx\nThe events an observer set listens to.\n\n##Roadmap\n\n1. add a server/websocket set\n2. add relations and co-dependent constrains.\n3. remove the need to register a schema manually.\n\n#[License] (http://www.gnu.org/licenses/gpl-3.0.en.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoodzik%2Fhydraulik","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoodzik%2Fhydraulik","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoodzik%2Fhydraulik/lists"}