Registry /
devops / graphql-codegen-on-operations
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;
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.
fixyarn 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.
fixUse `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.
fixCheck package contents and update import path accordingly.
Audit
Dependencies
No dependency data recorded yet.