Registry / devops / graphql-codegen-on-operations

graphql-codegen-on-operations

JSON →
library0.0.1jsnpmunverified

A plugin for graphql-codegen (v0.0.1) that generates a signature from your GraphQL documents (queries, mutations, fragments) for validation on the server. Works with graphql-codegen v1-v4 and graphql ^0.8..^16. Key differentiator: enables server-side verification that documents match client expectations, preventing unsigned or tampered operations. Ships TypeScript types. Low release cadence, experimental.

npm install graphql-codegen-on-operations
INSTALL
IMPORT
SIG · GRAPHQL-CODEGEN-ON
G
graphql-codegen-on-operations
devopsjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GenerateFn
import { GenerateFn } from 'graphql-codegen-on-operations'
import GenerateFn from 'graphql-codegen-on-operations'
Named export, not default.
createSignFn
import createSignFn from 'graphql-codegen-on-operations/lib/use/signing'
import { createSignFn } from 'graphql-codegen-on-operations'
createSignFn is a default export from a deep path.
createListFn
import createListFn from 'graphql-codegen-on-operations/lib/use/listing'
import { createListFn } from 'graphql-codegen-on-operations/lib/use/listing'
Default export from a deep path.

Shows how to use the plugin with custom signing and listing functions in graphql-codegen config.

import { GenerateFn } from 'graphql-codegen-on-operations'; import createSignFn from 'graphql-codegen-on-operations/lib/use/signing'; import createListFn from 'graphql-codegen-on-operations/lib/use/listing'; import { print } from 'graphql'; const customGen: GenerateFn = (_schema, { documents }) => { return JSON.stringify(documents.map((d) => print(d.node)).join('\n'), null, 2); }; const config = { schema: 'http://localhost:4000/graphql', documents: ['src/**/*.graphql'], generates: { './signed.json': { plugins: ['graphql-codegen-on-operations'], config: { gen: createSignFn({ secret: process.env.SIGNING_SECRET ?? '' }), }, }, './listed.json': { plugins: ['graphql-codegen-on-operations'], config: { gen: createListFn(), }, }, }, }; export default config;
Debug
Known issues
breakingImports from deep paths like 'lib/use/signing' are internal and may change without major version bump.
fix
Pin version or use only documented public API (GenerateFn).
affects: >=0.0.0
gotchacreateSignFn requires a secret; exposing it clientside breaks security.
fix
Keep secret in server environment variables; do not bundle in client code.
affects: >=0.0.0
deprecatedPackage has no explicit semver strategy; patch updates may introduce breaking changes.
fix
Use a lockfile and test upgrades carefully.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'graphql-codegen-on-operations' or its corresponding type declarations.
Missed installing the package or missing @types/graphql-codegen-on-operations.
fix
yarn add -D graphql-codegen-on-operations (or verify it's installed).
TypeError: createSignFn is not a function
Imported createSignFn as named instead of default export.
fix
Use `import createSignFn from 'graphql-codegen-on-operations/lib/use/signing'`
Module not found: Error: Can't resolve 'graphql-codegen-on-operations/lib/use/listing'
Deep path changed in a newer version or requires additional file resolution.
fix
Check package contents and update import path accordingly.
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
graphql-codegen-on-operations — npm install graphql-codegen-on-operations · libregistry