{"id":40740644,"url":"https://github.com/mlipscombe/postgraphile-plugin-nested-mutations","last_synced_at":"2026-01-21T15:06:22.733Z","repository":{"id":32713502,"uuid":"140127576","full_name":"mlipscombe/postgraphile-plugin-nested-mutations","owner":"mlipscombe","description":"Nested mutations for Postgraphile","archived":false,"fork":false,"pushed_at":"2023-02-03T21:47:27.000Z","size":1221,"stargazers_count":83,"open_issues_count":23,"forks_count":40,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-10T20:53:49.631Z","etag":null,"topics":["graphile","graphile-build","plugin","postgraphile","postgraphql"],"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/mlipscombe.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":"2018-07-08T01:00:19.000Z","updated_at":"2024-09-26T21:18:22.000Z","dependencies_parsed_at":"2023-02-18T11:17:35.963Z","dependency_job_id":null,"html_url":"https://github.com/mlipscombe/postgraphile-plugin-nested-mutations","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/mlipscombe/postgraphile-plugin-nested-mutations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlipscombe%2Fpostgraphile-plugin-nested-mutations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlipscombe%2Fpostgraphile-plugin-nested-mutations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlipscombe%2Fpostgraphile-plugin-nested-mutations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlipscombe%2Fpostgraphile-plugin-nested-mutations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlipscombe","download_url":"https://codeload.github.com/mlipscombe/postgraphile-plugin-nested-mutations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlipscombe%2Fpostgraphile-plugin-nested-mutations/sbom","scorecard":{"id":653392,"data":{"date":"2025-08-11","repo":{"name":"github.com/mlipscombe/postgraphile-plugin-nested-mutations","commit":"a599d383b95b5ffc35177520b35fbb60680fe686"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 1/16 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":"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":"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":"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 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":"31 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-93q8-gq69-wqmw","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-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-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","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-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-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-21T14:06:07.868Z","repository_id":32713502,"created_at":"2025-08-21T14:06:07.868Z","updated_at":"2025-08-21T14:06:07.868Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T14:50:40.221Z","status":"ssl_error","status_checked_at":"2026-01-21T14:48:59.225Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["graphile","graphile-build","plugin","postgraphile","postgraphql"],"created_at":"2026-01-21T15:06:21.896Z","updated_at":"2026-01-21T15:06:22.728Z","avatar_url":"https://github.com/mlipscombe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Package on npm](https://img.shields.io/npm/v/postgraphile-plugin-nested-mutations.svg)](https://www.npmjs.com/package/postgraphile-plugin-nested-mutations)\n[![CircleCI](https://circleci.com/gh/mlipscombe/postgraphile-plugin-nested-mutations/tree/master.svg?style=svg)](https://circleci.com/gh/mlipscombe/postgraphile-plugin-nested-mutations/tree/master)\n\n# postgraphile-plugin-nested-mutations\nThis plugin implements nested mutations based on both forward and reverse foreign\nkey relationships in PostGraphile v4.  Nested mutations can be of infinite depth.\n\n## Getting Started\n\n### CLI\n\n``` bash\npostgraphile --append-plugins postgraphile-plugin-nested-mutations\n```\n\nSee [here](https://www.graphile.org/postgraphile/extending/#loading-additional-plugins) for\nmore information about loading plugins with PostGraphile.\n\n### Library\n\n``` js\nconst express = require('express');\nconst { postgraphile } = require('postgraphile');\nconst PostGraphileNestedMutations = require('postgraphile-plugin-nested-mutations');\n\nconst app = express();\n\napp.use(\n  postgraphile(pgConfig, schema, {\n    appendPlugins: [\n      PostGraphileNestedMutations,\n    ],\n  })\n);\n\napp.listen(5000);\n```\n\n### Plugin Options\n\nWhen using PostGraphile as a library, the following plugin options can be passed \nvia `graphileBuildOptions`:\n\n\u003cdetails\u003e\n\n\u003csummary\u003enestedMutationsSimpleFieldNames\u003c/summary\u003e\n\nUse simple field names for nested mutations.  Instead of names suffixed with\n`tableBy\u003cKey\u003e` and `tableUsing\u003cKey\u003e`, tables with a single foreign key relationship \nbetween them will have their nested relation fields named `table`.  Defaults to\n`false`.\n\n```js\npostgraphile(pgConfig, schema, {\n  graphileBuildOptions: {\n    nestedMutationsSimpleFieldNames: true,\n  }\n});\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003enestedMutationsDeleteOthers\u003c/summary\u003e\n\nControls whether the `deleteOthers` field is available on nested mutations.  Defaults\nto `true`.\n\n```js\npostgraphile(pgConfig, schema, {\n  graphileBuildOptions: {\n    nestedMutationsDeleteOthers: false,\n  }\n});\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003enestedMutationsOldUniqueFields\u003c/summary\u003e\n\nIf enabled, plural names for one-to-one relations will be used.  For backwards\ncompatibility.  Defaults to `false`.\n\n```js\npostgraphile(pgConfig, schema, {\n  graphileBuildOptions: {\n    nestedMutationsOldUniqueFields: false,\n  }\n});\n```\n\n\u003c/details\u003e\n\n## Usage\n\nThis plugin creates an additional field on each GraphQL `Input` type for every forward\nand reverse foreign key relationship on a table, with the same name as the foreign table.\n\nEach nested mutation field will have the following fields. They will accept an array if\nthe relationship is a one-to-many relationship, or a single input if they are one-to-one.\n\n### Connect to Existing Record\n#### `connectByNodeId`\nConnect using a `nodeId` from the nested table.\n\n#### `connectBy\u003cK\u003e`\nConnect using any readable primary key or unique constraint on the nested table.\n\n### Creating New Records\n#### `create`\nCreate a new record in the nested table.\n\n### Delete existing Record\n#### `deleteByNodeId`\nDelete using a `nodeId` from the nested table.\n\n#### `deleteBy\u003cK\u003e`\nDelete using any readable primary key or unique constraint on the nested table.\n\n### Updating Records\n#### `updateByNodeId`\nUpdate a record using a `nodeId` from the nested table.\n\n#### `updatedBy\u003cK\u003e`\nUpdate a record using any readable primary key or unique constraint on the nested table.\n\n## Example\n\n```sql\ncreate table parent (\n  id serial primary key,\n  name text not null\n);\n\ncreate table child (\n  id serial primary key,\n  parent_id integer,\n  name text not null,\n  constraint child_parent_fkey foreign key (parent_id)\n    references p.parent (id)\n);\n```\n\nA nested mutation against this schema, using `Parent` as the base mutation\nwould look like this:\n\n``` graphql\nmutation {\n  createParent(input: {\n    parent: {\n      name: \"Parent 1\"\n      childrenUsingId: {\n        connectById: [{\n          id: 1\n        }]\n        create: [{\n          name: \"Child 1\"\n        }, {\n          name: \"Child 2\"\n        }]\n      }\n    }\n  }) {\n    parent {\n      id\n      name\n      childrenByParentId {\n        nodes {\n          id\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nOr using `Child` as the base mutation:\n\n``` graphql\nmutation {\n  createChild(input: {\n    child: {\n      name: \"Child 1\"\n      parentToParentId: {\n        create: {\n          name: \"Parent of Child 1\"\n        }\n      }\n    },\n  }) {\n    child {\n      id\n      name\n      parentByParentId {\n        id\n        name\n      }\n    }\n  }\n}\n```\n\n## Smart Comments\n\n[Smart comments](https://www.graphile.org/postgraphile/smart-comments/) are supported for \nrenaming the nested mutation fields.\n\n```sql\ncomment on constraint child_parent_fkey on child is\n  E'@fieldName parent\\n@foreignFieldName children';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlipscombe%2Fpostgraphile-plugin-nested-mutations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlipscombe%2Fpostgraphile-plugin-nested-mutations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlipscombe%2Fpostgraphile-plugin-nested-mutations/lists"}