@davstack/openapi-react-query-codegen
Version:
OpenAPI React Query Codegen using --useOptions (fork from @7nohe/openapi-react-query-codegen)
25 lines (24 loc) • 1.72 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createGetQueryClient = void 0;
const typescript_1 = __importDefault(require("typescript"));
const factory = typescript_1.default.factory;
const createGetQueryClient = () => {
return [
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier('QueryClient')),
])), factory.createStringLiteral('@tanstack/react-query'), undefined),
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier('cache')),
])), factory.createStringLiteral('react'), undefined),
factory.createVariableStatement([factory.createToken(typescript_1.default.SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([
factory.createVariableDeclaration(factory.createIdentifier('getQueryClient'), undefined, undefined, factory.createCallExpression(factory.createIdentifier('cache'), undefined, [
factory.createArrowFunction(undefined, undefined, [], undefined, factory.createToken(typescript_1.default.SyntaxKind.EqualsGreaterThanToken), factory.createNewExpression(factory.createIdentifier('QueryClient'), undefined, [])),
])),
], typescript_1.default.NodeFlags.Const)),
];
};
exports.createGetQueryClient = createGetQueryClient;