{"_id":"@_zth/rescript-graphql-codegen","name":"@_zth/rescript-graphql-codegen","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@_zth/rescript-graphql-codegen","version":"0.1.0","description":"ReScript GraphQL operation code generation for rescript-embed-lang","license":"MIT","publishConfig":{"access":"public"},"engines":{"node":">=20.11"},"workspaces":["packages/*"],"dependencies":{"@graphql-codegen/cli":"^5.0.0","@graphql-codegen/plugin-helpers":"^5.0.3","@rescript/tools":"0.6.6","chokidar":"^3.6.0","graphql":"^16.0.0","micromatch":"^4.0.5"},"devDependencies":{"camelcase":"^8.0.0","esbuild":"^0.20.2","rescript":"12.3.0","rescript-nodejs":"17.0.0"},"packageManager":"yarn@4.0.2","scripts":{"project:build":"yarn workspaces foreach -At run build","project:clean":"yarn workspaces foreach -At run clean","prepack":"yarn project:build && yarn workspace @rescript-graphql-codegen/base-types esbuild && yarn workspace @rescript-graphql-codegen/operations esbuild && yarn workspace @rescript-graphql-codegen/graphql-codegen-embed-lang build-standalone"},"bin":{"rescript-graphql-codegen":"packages/graphql-codegen-embed-lang/dist/Index.js"},"gitHead":"0981dd4a8eacc9104e0ff368647d0675098b547f","_id":"@_zth/rescript-graphql-codegen@0.1.0","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-xMN/ZAFzv5Z3i4KxQH2BIMqQoqmDwJ+JP7goY0reZugthcRB2U5Mv13qffqObs3o3elaRZSIG0JRV1K8mprTZw==","shasum":"bf51b9d487387f5cbfa61abe5d6a5d1fb0644a18","tarball":"https://registry.npmjs.org/@_zth/rescript-graphql-codegen/-/rescript-graphql-codegen-0.1.0.tgz","fileCount":5,"unpackedSize":143870,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIH3zqXimi4+D71Uvn4NpupwxGoIrqcbK1kD1apow+IsMAiBiQ1WMZBdCk42qxNQCtfr7OD3ez7+l1QE4eY1p4exCzg=="}]},"_npmUser":{"name":"_zth","email":"gabbe.nord@gmail.com"},"directories":{},"maintainers":[{"name":"_zth","email":"gabbe.nord@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rescript-graphql-codegen_0.1.0_1785788670611_0.6107786021146386"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T20:24:30.338Z","0.1.0":"2026-08-03T20:24:30.761Z","modified":"2026-08-03T20:24:31.043Z"},"maintainers":[{"name":"_zth","email":"gabbe.nord@gmail.com"}],"description":"ReScript GraphQL operation code generation for rescript-embed-lang","license":"MIT","readme":"# ReScript GraphQL Codegen\n\nTyped ReScript GraphQL operation code generation with first-class support for\n`rescript-embed-lang`.\n\nInstall the published generator with:\n\n```sh\nyarn add --dev @_zth/rescript-graphql-codegen\n```\n\n## Usage\n\n### Compiled operation artifacts\n\nSet `operationModule` to a ReScript module whose `make` function accepts\n`~name`, `~hash`, and `~getDocument`. Each generated operation then exposes\nan `operation` value typed as `operationModule.t<variables, t>`, plus the same\nvalue as `default`. Variables and results are trusted from the generated\noperation types; runtime validation is the responsibility of the configured\nclient, not the generated descriptor.\n\nWith `rescript-embed-lang` 0.6.1 or newer, the embed CLI uses its\nfirst-class `GraphqlDefinition` strategy to derive a stable module name from the\nGraphQL operation name and emits one file per operation. A value embed therefore produces the typed operation directly:\n\n```rescript\nlet example = %generated.gqlExternalSchema(`\n  query Example($id: ID!) {\n    example(id: $id) {\n      id\n    }\n  }\n`)\n\nawait client->run(example, {id})\n```\n\nThe generated module remains available as\n`SourceFile__gqlExternalSchema__Example` when callers need its `variables`,\nresult `t`, schemas, or operation metadata. The embed CLI writes the\n`rescript-embed-lang.json` consumed by the PPX, keeping its extraction\nconfiguration identical to codegen.\n\nSury schemas can be generated independently from operation execution:\n\n```js\n{\n  operationModule: \"GraphqlOperation\",\n  surySchemaGeneration: \"fromDirective\"\n}\n```\n\nOpt an operation in with the codegen-only directive:\n\n```graphql\nquery Example($id: ID!) @gqlGenerator__generateSurySchema {\n  example(id: $id) {\n    id\n  }\n}\n```\n\nThe directive emits the operation's `variablesSchema` and output `schema`\nartifacts. It is removed before the executable document and operation hash are\ngenerated. `surySchemaGeneration` also accepts `\"always\"` and `\"never\"`.\nThe older `generateSurySchemas` boolean remains supported when the new option\nis omitted.\n\n## Status\n### Mostly done\n- `lib`: contains\n    - `core-plus`: Extensions around [rescript-core](https://github.com/rescript-association/rescript-core).\n    - `graphql`: Rescript bindings (and light wrappers) around the [graphql javascript library](https://github.com/graphql/graphql-js).\n    - `graphql-codegen`: Rescript bindings for writing [graphql-codegen](https://github.com/dotansimha/graphql-code-generator) plugins in rescript\n- `base-types`: Baseline Rescript codegen plugin. Generates enum and input types.\n- `operations`: Baseline Rescript codegen plugin. Generates variable and output types.\n- `test`: Runs generated codegen plugins\n### TODO\n- `near-re-operation-file`: Planned output preset; the `near-operation-file` preset automatic generates Typescript imports, which need to be prevented with certain specific values in the `presetConfig`. Ideally, this would be a very similar equivalent that requires no special config.\n","readmeFilename":"README.md","_rev":"1-acfa3ecf8f7e7eee8b9c3aac63fcfe1a"}