{"id":24418692,"url":"https://github.com/thecodedrift/envelop-plugin-extensions","last_synced_at":"2025-10-07T11:59:20.018Z","repository":{"id":169528750,"uuid":"622012396","full_name":"thecodedrift/envelop-plugin-extensions","owner":"thecodedrift","description":"Set extensions via your GraphQL Context","archived":false,"fork":false,"pushed_at":"2023-05-25T21:27:14.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-27T11:29:13.429Z","etag":null,"topics":[],"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/thecodedrift.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":"2023-03-31T22:17:31.000Z","updated_at":"2023-05-25T21:25:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"c573aa35-10c5-44bd-990b-9bd69a1ec4bf","html_url":"https://github.com/thecodedrift/envelop-plugin-extensions","commit_stats":null,"previous_names":["jakobo/envelop-plugin-extensions","thecodedrift/envelop-plugin-extensions"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/thecodedrift/envelop-plugin-extensions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fenvelop-plugin-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fenvelop-plugin-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fenvelop-plugin-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fenvelop-plugin-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodedrift","download_url":"https://codeload.github.com/thecodedrift/envelop-plugin-extensions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fenvelop-plugin-extensions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278770724,"owners_count":26042828,"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-07T02:00:06.786Z","response_time":59,"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":[],"created_at":"2025-01-20T09:11:28.745Z","updated_at":"2025-10-07T11:59:19.991Z","avatar_url":"https://github.com/thecodedrift.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cspan style=\"font-size:24px\"\u003eenvelop-plugin-extensions\u003c/span\u003e\u003cbr /\u003e\n  \u003csub\u003e\u003ci\u003e🔌 Set extensions via your GraphQL Context\u003c/i\u003e\u003c/sub\u003e\n\u003c/h1\u003e\n\n\u003e A plugin for the [envelop](https://the-guild.dev/graphql/envelop) ecosystem that adds the ability to read, set, and clear [GraphQL extensions](https://spec.graphql.org/June2018/#sec-Response-Format). Works with any plugin in the Envelop ecosystem, including [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server) v3.\n\n# Getting Started\n\n```\n# or yarn, or npm\npnpm add envelop-plugin-extensions\n```\n\n# Usage\n\nConfigure `useExtensions()` like you would any other envelop plugin. For example, in GraphQL Yoga:\n\n```ts\nimport {\n  useExtensions,\n  type ExtensionsContext,\n} from \"envelop-plugin-extensions\";\nimport { createYoga, createSchema } from \"graphql-yoga\";\n\n// Provide your schema\nconst yoga = createYoga({\n  schema: createSchema({\n    typeDefs: /* GraphQL */ `\n      type Query {\n        greetings: String!\n      }\n    `,\n    resolvers: {\n      Query: {\n        greetings: (parent, args, context, info) =\u003e {\n          // set an extension value. context.extensions is Map\u003cstring, unknown\u003e\n          context.extensions.set(\"extension key\", \"extension value\");\n          return \"Hello World!\";\n        },\n      },\n    },\n  }),\n  plugins: [useExtensions(options)],\n});\n\n// Start the server and explore http://localhost:4000/graphql\nconst server = createServer(yoga);\nserver.listen(4000, () =\u003e {\n  console.info(\"Server is running on http://localhost:4000/graphql\");\n});\n```\n\nAnd see the `extensions` property carried into the response:\n\n```json\n{\n  \"data\": {\n    \"greetings\": \"Hello World!\"\n  },\n  \"extensions\": {\n    \"extension key\": \"extension value\"\n  }\n}\n```\n\n# Options\n\n- `filter: (key: string, value: unknown) =\u003e boolean` - Allows filtering extensions by top-level key. Not all extensions should be surfaced, and `filter()` gives you a means to run a test against every key/value before the extensions are written to the graphql response. _TypeScript Users: the type for `value` is `unknown`, and it's expected if you're checking extension values you have suitable typeguards or validators._\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedrift%2Fenvelop-plugin-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodedrift%2Fenvelop-plugin-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedrift%2Fenvelop-plugin-extensions/lists"}