{"id":23414392,"url":"https://github.com/benstepp/tays","last_synced_at":"2025-04-09T05:17:07.251Z","repository":{"id":65514864,"uuid":"54864467","full_name":"benstepp/tays","owner":"benstepp","description":null,"archived":false,"fork":false,"pushed_at":"2016-06-09T05:11:52.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T19:17:27.933Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benstepp.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}},"created_at":"2016-03-28T04:04:33.000Z","updated_at":"2016-03-28T04:09:53.000Z","dependencies_parsed_at":"2023-01-26T21:15:16.623Z","dependency_job_id":null,"html_url":"https://github.com/benstepp/tays","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benstepp%2Ftays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benstepp%2Ftays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benstepp%2Ftays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benstepp%2Ftays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benstepp","download_url":"https://codeload.github.com/benstepp/tays/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980849,"owners_count":21027809,"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-12-22T19:58:44.390Z","updated_at":"2025-04-09T05:17:07.231Z","avatar_url":"https://github.com/benstepp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#no this doesnt work yet\n\nGeneral Idea:\ndecorators just build an ast and return noop function decorators\nwhen activerecord is called (last in file) the association and\ncallback asts are parsed into an underlying framework class and the\nuser defined class is copied on top of it. This will maintain the\nsuper functionality without a Proxy method being called on every\nsingle method call. Take advantage of the prototype system in js rather\nthan shoving everything into method_missing / proxy.get\n\nStuff in /lib/meta works. Thinking about including under a class with\na copy on top of it so that super would work for included stuff. Public\ninterface would remain the same.\n\nArel mostly copy pastad from ruby. Interface for ActiveRecord is too stronk\nfor most projects not to copy pasta. Implementation will have to change\nbecause javascript differently strong from ruby. All licenses can be\nfound in LICENCE.md.\n\nSome desired syntax abusing decorators as not decorators and as just\ncarefully placed functions to look beautiful.\n\n```javascript\n// models/user.js\nimport { CustomValidator } from './validators'\nimport { NullRole } from './null_role'\nimport {\n  ActiveRecord,\n  before_save,\n  belongs_to,\n  has_many,\n  scope,\n  validates_presence_of\n  validates_with,\n} from 'tays'\n\nclass User extends ActiveRecord.Base {\n  @belongs_to('role')\n  @has_many('posts', { class_name: 'ShitPost' })\n\n  @validates_presence_of('email')\n  @validates_with(CustomValidator)\n\n  @scope('admin', () =\u003e this.joins('role').where({ admin: true }))\n\n  custom_method() {\n    //do anything you want\n  }\n\n  @before_save\n  method_called_before_save() {\n    // do some stuff\n  }\n\n  get role() {\n    return super.role || new NullRole()\n  }\n\n}\n\nexport ActiveRecord(User)\n```\n\nNo, I have no idea what the hell I'm doing. Just bored and what to\nwrite some bootyful havascript.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenstepp%2Ftays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenstepp%2Ftays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenstepp%2Ftays/lists"}