{"id":20042206,"url":"https://github.com/creativecuriositystudio/squell","last_synced_at":"2026-03-10T08:04:27.756Z","repository":{"id":57368478,"uuid":"76010132","full_name":"creativecuriositystudio/squell","owner":"creativecuriositystudio","description":"A type-safe wrapper for the Sequelize library","archived":false,"fork":false,"pushed_at":"2018-08-17T04:06:30.000Z","size":644,"stargazers_count":10,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T08:41:13.947Z","etag":null,"topics":["database","decorators","node","orm","sequelize","sequelize-library","sql","typescript","typescript-library"],"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/creativecuriositystudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-12-09T06:56:57.000Z","updated_at":"2020-11-28T06:00:30.000Z","dependencies_parsed_at":"2022-09-05T20:51:33.653Z","dependency_job_id":null,"html_url":"https://github.com/creativecuriositystudio/squell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/creativecuriositystudio/squell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativecuriositystudio%2Fsquell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativecuriositystudio%2Fsquell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativecuriositystudio%2Fsquell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativecuriositystudio%2Fsquell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creativecuriositystudio","download_url":"https://codeload.github.com/creativecuriositystudio/squell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativecuriositystudio%2Fsquell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30327578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T05:25:20.737Z","status":"ssl_error","status_checked_at":"2026-03-10T05:25:17.430Z","response_time":106,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["database","decorators","node","orm","sequelize","sequelize-library","sql","typescript","typescript-library"],"created_at":"2024-11-13T10:49:18.386Z","updated_at":"2026-03-10T08:04:27.722Z","avatar_url":"https://github.com/creativecuriositystudio.png","language":"TypeScript","readme":"# Squell\n\n## Introduction\n\nSquell is a type-safe wrapper for the Sequelize library, usable in TypeScript 2.1+ projects.\nSquell takes the Sequelize type definitions a step further by allowing models to be designed\nusing [ModelSafe](https://github.com/creativecuriositystudio/modelsafe).\nEach model is defined as a class with all of its properties being decorated\nwith the relevant ModelSafe data types, which will be in turned mapped to Sequelize types.\n\nAdditionally to serializing ModelSafe models to SQL databases, Squell provides what is\nessentially a type-safe query language that compiles down to Sequelize queries.\nThis means that any queries on the database are partially checked at compile time,\nwhich obviously can't capture all errors, but stops small issues like type inconsistencies\nand typos.\n\n## Installation\n\n```sh\nnpm install --save squell\n```\n\n## Usage\n\nModel definitions (including associations/relationships) are written using the ModelSafe library.\n[See the ModelSafe documentation](https://github.com/creativecuriositystudio/modelsafe)\nfor more information on how to define models.\n\nAn example model definition for a basic user in our application might look like:\n\n```typescript\n@modelsafe.model('user')\nclass User extends modelsafe.Model {\n  @modelsafe.attr(modelsafe.STRING)\n  public username: string;\n\n  @modelsafe.attr(modelsafe.STRING)\n  public email: string;\n}\n```\n\nSquell also provides its own `@model`, `@attr` and `@assoc` decorators that\nare companion pieces to the ModelSafe decorators. These can be used to provide\nspecific Sequelize options, such as attribute options like `autoIncrement`\nwhich is not captured in ModelSafe. Take a look at the documentation for more information.\n\nTo query that model, you might do something like this:\n\n```typescript\nlet db = new squell.Database('mysql://username:password@localhost/db');\n\ndb.query(User)\n  .where(m =\u003e m.email.eq('test@example.com').or(m.id.lt(5)))\n  .find()\n  .then((users: User[]) =\u003e {\n    // Do something with `users`.\n  });\n```\n\nThis query would find a user with the email of exactly `test@example.com`,\nor an ID larger than 5, but with the benefit of the query being checked\nat compile time. Take a look at the API documentation for more information\non the query operators available - but for the most part they are the same\nas the Sequelize operators.\n\n## Documentatation\n\nThe API documentation generated using [TypeDoc](https://github.com/TypeStrong/typedoc)\nis [available online](http://creativecuriositystudio.github.io/squell).\n\nTo generate API documentation from the code into the `docs` directory, run:\n\n```sh\nnpm run docs\n```\n\n## Testing\n\nFirst install the library dependencies and the SQLite3 library:\n\n```sh\nnpm install\nnpm install sqlite3\n```\n\nTo execute the test suite using SQLite as the backend, run:\n\n```sh\nnpm run test\n```\n\nBy default, the tests will not log the SQL queries performed to keep the output sane.\nIf a test is giving particular trouble, run the tests with `LOG_TEST_SQL` turned on\nto inspect the generated SQL queries:\n\n```sh\nLOG_TEST_SQL=1 npm run test\n```\n\n## License\n\nThis project is licensed under the MIT license. Please see `LICENSE.md` for more details.\n\n## Limitations\n\n* Any static functions or methods on the model classes are not yet transferred over to Sequelize.\n  This means when trying to call them they will be undefined.\n* Calling update will do both an `update` and `findAll` call instead of just the single update call. This is because relationships have to be automatically assigned by Squell, which requires the updated instance model.\n* Associations will always be updated every `create`/`update` call, even if the association hasn't changed. These associations will only be updated if an `include` for that association model has be set, however.\n* `bulkCreate` cannot create objects with relationships.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreativecuriositystudio%2Fsquell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreativecuriositystudio%2Fsquell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreativecuriositystudio%2Fsquell/lists"}