
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
@acrool/graphql-codegen-rtk-query
Advanced tools
This is a graphql code generator plugins use react hooks
rtk-query methods, such as: useQuery, useMutation, useInfiniteQueryyarn add -D @acrool/graphql-codegen-rtk-query
add package.json script
{
"scripts":{
"generate": "graphql-codegen --config ./codegen.ts"
}
}
./codegen.ts
import {CodegenConfig} from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: [
'./schema.graphql',
'scalar Upload',
],
documents: [
'./src/store/__generated__/**/*.graphql',
],
config: {
maybeValue: 'T | undefined',
inputMaybeValue: 'T | null',
},
generates: {
'./src/store/__generated__/types.ts': {
plugins: [
'typescript',
'typescript-resolvers',
{
add: {
content: `
import {EDataLevel} from '@acrool/react-gantt';
import {ReadStream} from 'fs-capacitor';
import {IUseFetcherArgs} from '@/library/graphql/fetcher';
interface GraphQLFileUpload {
filename: string
mimetype: string
encoding: string
createReadStream(options?:{encoding?: string, highWaterMark?: number}): ReadStream
}`
}
},
],
config: {
typesPrefix: 'I',
enumPrefix: false,
declarationKind: 'interface',
strictScalars: false,
skipTypename: true,
inputValue: true,
dedupeFragments: true,
scalars: {
Upload: 'Promise<GraphQLFileUpload>',
ID: 'string',
IP: 'string',
UUID: 'string',
Role: 'Role',
Time: 'string',
FileData: 'string',
PeriodUnit: 'string',
Duration: 'number',
Locale: 'string',
TransactionID: 'string',
OrderBy: 'string',
Timestamp: 'string',
DataLevelProject: 'EDataLevel.Project',
DataLevelTeam: 'EDataLevel.Team',
DataLevelTask: 'EDataLevel.Task',
},
}
},
'./src/store/__generated__/': {
preset: 'near-operation-file',
presetConfig: {
extension: '.generated.ts',
baseTypesPath: './types.ts'
},
plugins: [
{
add: {
content: 'import {IUseFetcherArgs} from \'@/library/graphql/fetcher\';'
}
},
'typescript-operations',
{
'@acrool/graphql-codegen-rtk-query': {
importBaseApiFrom: '@/library/redux/baseApi',
importBaseApiAlternateName: 'baseApi',
exportHooks: true,
exportApi: true,
exportDocument: false,
exportApiName: 'api',
exportDefaultApiName: true,
},
},
],
config: {
typesPrefix: 'I',
enumPrefix: false,
declarationKind: 'interface',
withMutationFn: true,
strictScalars: false,
skipTypename: true,
inputValue: true,
omitOperationSuffix: true,
}
},
},
};
export default config;
copy ./src/example in your project lib path
add your gql file
run script
yarn generate
yarn build:rtk-query && npm publish ./src/rtk-query --access=public
yarn build:qtk-query && npm publish ./src/rtk-query --access=public
MIT © acrool
FAQs
trk-query for graphql-code-generator
The npm package @acrool/graphql-codegen-rtk-query receives a total of 4 weekly downloads. As such, @acrool/graphql-codegen-rtk-query popularity was classified as not popular.
We found that @acrool/graphql-codegen-rtk-query demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.