{"id":31818946,"url":"https://github.com/emperorrxf/postgraphile-plugin-atomic-mutations","last_synced_at":"2025-10-11T11:23:13.915Z","repository":{"id":39372906,"uuid":"262336368","full_name":"EmperorRXF/postgraphile-plugin-atomic-mutations","owner":"EmperorRXF","description":"Postgraphile plugin to enable mutation atomicity with GraphQL requests containing multiple mutations","archived":false,"fork":false,"pushed_at":"2023-01-06T05:20:26.000Z","size":1084,"stargazers_count":20,"open_issues_count":13,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-01T08:35:01.612Z","etag":null,"topics":["graphile","graphile-build","graphql","plugin","postgraphile"],"latest_commit_sha":null,"homepage":"","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/EmperorRXF.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-08T13:52:57.000Z","updated_at":"2023-06-23T22:28:23.000Z","dependencies_parsed_at":"2023-02-05T10:00:33.245Z","dependency_job_id":null,"html_url":"https://github.com/EmperorRXF/postgraphile-plugin-atomic-mutations","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EmperorRXF/postgraphile-plugin-atomic-mutations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmperorRXF%2Fpostgraphile-plugin-atomic-mutations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmperorRXF%2Fpostgraphile-plugin-atomic-mutations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmperorRXF%2Fpostgraphile-plugin-atomic-mutations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmperorRXF%2Fpostgraphile-plugin-atomic-mutations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmperorRXF","download_url":"https://codeload.github.com/EmperorRXF/postgraphile-plugin-atomic-mutations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmperorRXF%2Fpostgraphile-plugin-atomic-mutations/sbom","scorecard":{"id":45674,"data":{"date":"2025-08-11","repo":{"name":"github.com/EmperorRXF/postgraphile-plugin-atomic-mutations","commit":"c504d57d3190d7d5e899ca09bd9e6105df6d4688"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 1/23 approved changesets -- score normalized to 0","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":"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":"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":"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":"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 1 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":0,"reason":"36 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","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-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"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-14T22:41:59.413Z","repository_id":39372906,"created_at":"2025-08-14T22:41:59.413Z","updated_at":"2025-08-14T22:41:59.413Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007043,"owners_count":26084227,"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-10-11T02:00:06.511Z","response_time":55,"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":["graphile","graphile-build","graphql","plugin","postgraphile"],"created_at":"2025-10-11T11:23:09.125Z","updated_at":"2025-10-11T11:23:13.896Z","avatar_url":"https://github.com/EmperorRXF.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgraphile-plugin-atomic-mutations\n\n![npm package](https://img.shields.io/npm/v/postgraphile-plugin-atomic-mutations?style=flat-square)\n![license](https://img.shields.io/npm/l/postgraphile-plugin-atomic-mutations?style=flat-square)\n\nThis Postgraphile plugin allows you to enable mutation atomicity with GraphQL\nrequests containing multiple mutations.\n\nIt's ideal if you would like to have client request repeatability when at least\none mutation in the GraphQL request fails. This would guarantee that either all\nthe mutations in the request are `committed` when successful, or all are\n`rolled back` if at least one is erroneous.\n\n## Installing\n\n```\nyarn add postgraphile-plugin-atomic-mutations\n```\n\n```\nnpm install postgraphile-plugin-atomic-mutations\n```\n\n## Usage as Library\n\n```js\nimport {\n  AtomicMutationsPlugin,\n  getMutationAtomicityContext,\n} from 'postgraphile-plugin-atomic-mutations';\n\nconst app = express();\n\napp.use(\n  postgraphile(pgConfig, schema, {\n    // Append the plugin to the array.\n    appendPlugins: [AtomicMutationsPlugin],\n\n    async additionalGraphQLContextFromRequest(req, res) {\n      return {\n        // Additional context needed by the plugin\n        mutationAtomicityContext: getMutationAtomicityContext(req),\n      };\n    },\n  }),\n);\n\napp.listen(5000);\n```\n\n```js\nconst getMutationAtomicityContext = (\n  req,\n  enablePluginByDefault = false,\n): MutationAtomicityContext;\n```\n\nThis function will extract the HTTP headers from the `req` object passed as the\n1st argument to determine if the mutation atomicity behavior will be enabled or\nnot. See _Usage from Client_ for more details.\n\nThe 2nd argument `enablePluginByDefault` will determine plugin behavior when the\nHTTP header is not set (defaults to `false`).\n\n## Usage from Client\n\nThe plugin allows the client to decide when the mutation atomicity should be\napplied per GraphQL request, using a custom HTTP header\n`'X-Mutation-Atomicity'`, which can be set to either `'on'` or `'off'`.\n\n```py\nmutation MultipleMutationOperation {\n  # Mutation 1 - Successful\n  createTenant(input: {tenant: {name: \"New Tenant\"}}) {\n    tenant {\n      id\n    }\n  }\n\n  # Mutation 2 - Erroneous\n  updateTenant(input: {patch: {name: \"Updated Tenant Name\"}, id: \"dd0f6631-3905-4cc0-bc75-6c7b1dcafa89\"}) {\n    tenant {\n      name\n    }\n  }\n\n  # Mutation 3 - Successful\n  deleteTenant(input: {id: \"761aa030-6965-4cfe-90cf-00d2dec41c61\"}) {\n    tenant {\n      name\n    }\n  }\n}\n```\n\nIn the above example of a multiple mutation request, if we didn't use the plugin\nat all, the outcome would be that Mutations `#1` \u0026 `#3` will be committed to the\ndatabase, while `#2` will be rolled back due to its hypothetical error. But if\nthe same request is sent again from the client, there will be new exceptions\ncaused by mutations `#1` \u0026 `#3` (possibly for duplicate key violation, and no\nmatching criteria).\n\nNow instead if we use the plugin, and the same request is made with the\n`'X-Mutation-Atomicity: on'` HTTP header set by the client, the Mutations `#1` \u0026\n`#3` will never be committed to the database since Mutation `#2` caused an\nerror, thus, guaranteeing atomicity for the set of Mutations. If the client\ndecides to re-run the same request again, the outcome will be the same.\n\n## Limitations\n\n- If there already exists plugins which are used in postgraphile options,\n  `AtomicMutationsPlugin` must be appended after them - i.e.\n  `appendPlugins: [SomePlugin, AnotherPlugin, AtomicMutationsPlugin]`.\n\n- As with any transaction management mechanism, the individual mutations must\n  not contain any explicit `commit` or `rollback` commands.\n\n- Postgraphile v4 has an experimental feature\n  [enableQueryBatching](https://www.graphile.org/postgraphile/v4-new-features/#graphql-query-batching)\n  which is currently not supported by the plugin.\n\n## Todo\n\n- Improve tests to have more code coverage.\n\n## Contributing\n\nThis project uses `yarn` as the package manager, so make sure that pre-requisite\nis installed.\n\n```\nnpm install -g yarn\n```\n\nThen `clone` \u0026 run `yarn`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femperorrxf%2Fpostgraphile-plugin-atomic-mutations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femperorrxf%2Fpostgraphile-plugin-atomic-mutations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femperorrxf%2Fpostgraphile-plugin-atomic-mutations/lists"}