{"id":13516715,"url":"https://github.com/graphile-contrib/constraint-error-tags","last_synced_at":"2025-09-17T21:18:07.320Z","repository":{"id":42693077,"uuid":"240503775","full_name":"graphile-contrib/constraint-error-tags","owner":"graphile-contrib","description":"A PostGraphile plugin for writing nicer error messages on constraints.","archived":false,"fork":false,"pushed_at":"2024-09-17T10:59:01.000Z","size":145,"stargazers_count":12,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-11T09:19:03.663Z","etag":null,"topics":["constraints","error","graphql","plugin","postgraphile","smart-tags"],"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/graphile-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-02-14T12:30:58.000Z","updated_at":"2025-02-06T23:55:18.000Z","dependencies_parsed_at":"2024-06-02T03:31:15.715Z","dependency_job_id":"59f91abb-572e-4936-b067-410840ebc020","html_url":"https://github.com/graphile-contrib/constraint-error-tags","commit_stats":{"total_commits":20,"total_committers":7,"mean_commits":2.857142857142857,"dds":0.75,"last_synced_commit":"4687812c92ce041d925bebc27bfec2b456ef9259"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/graphile-contrib/constraint-error-tags","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile-contrib%2Fconstraint-error-tags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile-contrib%2Fconstraint-error-tags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile-contrib%2Fconstraint-error-tags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile-contrib%2Fconstraint-error-tags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphile-contrib","download_url":"https://codeload.github.com/graphile-contrib/constraint-error-tags/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphile-contrib%2Fconstraint-error-tags/sbom","scorecard":{"id":443779,"data":{"date":"2025-08-11","repo":{"name":"github.com/graphile-contrib/constraint-error-tags","commit":"b891e67671ca2a3267fc3f9908afafc55fbdc625"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Code-Review","score":2,"reason":"Found 4/18 approved changesets -- score normalized to 2","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":"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":"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":"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":"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":5,"reason":"5 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-8cf7-32gw-wr33","Warn: Project is vulnerable to: GHSA-hjrf-2m68-5959","Warn: Project is vulnerable to: GHSA-qwph-4952-7xr6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"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-19T06:12:17.155Z","repository_id":42693077,"created_at":"2025-08-19T06:12:17.155Z","updated_at":"2025-08-19T06:12:17.155Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275665624,"owners_count":25506158,"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-09-17T02:00:09.119Z","response_time":84,"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":["constraints","error","graphql","plugin","postgraphile","smart-tags"],"created_at":"2024-08-01T05:01:25.180Z","updated_at":"2025-09-17T21:18:07.258Z","avatar_url":"https://github.com/graphile-contrib.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# @graphile-contrib/constraint-error-tags\n\nA PostGraphile plugin for writing nicer error messages on constraints. Adding the `@error \u003cmessage\u003e` smart tag to constraints will replace generic Postgres constraint violation message.\n\n## Installation:\n\n```bash\nnpm install --save @graphile-contrib/constraint-error-tags\n```\n\nor\n\n```bash\nyarn add @graphile-contrib/constraint-error-tags\n```\n\n## Usage:\n\n**Library:**\n\n```js\nconst {\n  ConstraintErrorTagsPlugin,\n  handleErrors,\n} = require(\"@graphile-contrib/constraint-error-tags\");\n\napp.use(\n  postgraphile(process.env.POSTGRES_ENDPOINT, process.env.POSTGRES_SCHEMA, {\n    appendPlugins: [ConstraintErrorTagsPlugin],\n    handleErrors: (errors) =\u003e handleErrors(errors),\n  })\n);\n```\n\n- `ConstraintErrorTagsPlugin` introspects all your constraints and extracts the ones with the `@error \u003cmessage\u003e` smart tag.\n- `handleErrors` violating a constraint with the above mentioned signature will replace the generic error with the `\u003cmessage\u003e` from the `@error` smart tag.\n\n## Example table constraint:\n\nSQL schema:\n\n```sql\ncreate table public.user (\n  id         serial primary key,\n  first_name text not null,\n  last_name  text not null,\n\n  age int not null,\n  constraint age_check check(age \u003e= 18)\n);\n\ncomment on constraint \"age_check\" on \"public.user\" is '@error The user has to be at least 18 years of age.';\n```\n\nGraphQL mutation:\n\n```graphql\nmutation {\n  createUser(input: { firstName: \"John\", lastName: \"Doe\", age: 16 }) {\n    clientMutationId\n  }\n}\n```\n\nResponse:\n\nGraphQL error with the message: `The user has to be at least 18 years of age.`\n\n## Example type constraint:\n\nSQL schema:\n\n```sql\ncreate domain strong_password as text\nconstraint \"symbol\" check (value ~ '[!@#$%^\u0026*()]');\n\ncomment on constraint \"symbol\" on domain \"strong_password\" is '@error password must contain at least one symbol of !@#$%^\u0026*()';\n```\n\nGraphQL mutation:\n\n```graphql\nmutation {\n  setPassword(input: {userId: \"100\", newPass: \"weakpassword\"}) {\n    clientMutationId\n  }\n}\n```\n\nResponse:\n\nGraphQL error with the message: `password must contain at least one symbol of !@#$%^\u0026*()`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphile-contrib%2Fconstraint-error-tags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphile-contrib%2Fconstraint-error-tags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphile-contrib%2Fconstraint-error-tags/lists"}