@openapi-codegen/typescript
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -14,5 +14,5 @@ "use strict"; | ||
const fnNames = Array.isArray(fnName) ? fnName : [fnName]; | ||
return typescript_1.factory.createImportDeclaration(undefined, undefined, typescript_1.factory.createImportClause(false, undefined, typescript_1.factory.createNamedImports(fnNames.map((name) => typescript_1.factory.createImportSpecifier(false, undefined, typescript_1.factory.createIdentifier(name))))), typescript_1.factory.createStringLiteral(filename), undefined); | ||
return typescript_1.factory.createImportDeclaration(undefined, typescript_1.factory.createImportClause(false, undefined, typescript_1.factory.createNamedImports(fnNames.map((name) => typescript_1.factory.createImportSpecifier(false, undefined, typescript_1.factory.createIdentifier(name))))), typescript_1.factory.createStringLiteral(filename), undefined); | ||
}; | ||
exports.createNamedImport = createNamedImport; | ||
//# sourceMappingURL=createNamedImport.js.map |
@@ -12,4 +12,4 @@ "use strict"; | ||
*/ | ||
const createNamespaceImport = (namespace, filename) => typescript_1.factory.createImportDeclaration(undefined, undefined, typescript_1.factory.createImportClause(true, undefined, typescript_1.factory.createNamespaceImport(typescript_1.factory.createIdentifier(namespace))), typescript_1.factory.createStringLiteral(filename), undefined); | ||
const createNamespaceImport = (namespace, filename) => typescript_1.factory.createImportDeclaration(undefined, typescript_1.factory.createImportClause(true, undefined, typescript_1.factory.createNamespaceImport(typescript_1.factory.createIdentifier(namespace))), typescript_1.factory.createStringLiteral(filename), undefined); | ||
exports.createNamespaceImport = createNamespaceImport; | ||
//# sourceMappingURL=createNamespaceImport.js.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
? [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType, undefined), | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType, undefined), | ||
] | ||
@@ -23,0 +23,0 @@ : [], undefined, typescript_1.factory.createToken(typescript_1.default.SyntaxKind.EqualsGreaterThanToken), typescript_1.factory.createCallExpression(typescript_1.factory.createIdentifier(fetcherFn), [ |
@@ -75,3 +75,3 @@ "use strict"; | ||
const errorTypeIdentifier = (0, case_1.pascal)(`${operationId}Error`); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(errorTypeIdentifier), undefined, errorType)); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(errorTypeIdentifier), undefined, errorType)); | ||
errorType = typescript_1.factory.createTypeReferenceNode(errorTypeIdentifier); | ||
@@ -81,3 +81,3 @@ // Export data type if needed | ||
const dataTypeIdentifier = (0, case_1.pascal)(`${operationId}Response`); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(dataTypeIdentifier), undefined, dataType)); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(dataTypeIdentifier), undefined, dataType)); | ||
dataType = typescript_1.factory.createTypeReferenceNode(dataTypeIdentifier); | ||
@@ -88,3 +88,3 @@ } | ||
const requestBodyIdentifier = (0, case_1.pascal)(`${operationId}RequestBody`); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(requestBodyIdentifier), undefined, requestBodyType)); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(requestBodyIdentifier), undefined, requestBodyType)); | ||
requestBodyType = typescript_1.factory.createTypeReferenceNode(requestBodyIdentifier); | ||
@@ -123,3 +123,3 @@ } | ||
if (variablesType.kind !== typescript_1.default.SyntaxKind.VoidKeyword) { | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(variablesIdentifier), undefined, variablesType)); | ||
declarationNodes.push(typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createIdentifier(variablesIdentifier), undefined, variablesType)); | ||
variablesType = typescript_1.factory.createTypeReferenceNode(variablesIdentifier); | ||
@@ -126,0 +126,0 @@ } |
@@ -21,3 +21,3 @@ "use strict"; | ||
const jsDocNode = getJSDocComment(schema, context); | ||
const declarationNode = typescript_1.factory.createTypeAliasDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], (0, case_1.pascal)(name), undefined, (0, exports.getType)(schema, context)); | ||
const declarationNode = typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], (0, case_1.pascal)(name), undefined, (0, exports.getType)(schema, context)); | ||
return jsDocNode ? [jsDocNode, declarationNode] : [declarationNode]; | ||
@@ -417,4 +417,4 @@ }; | ||
return undefined; | ||
return typescript_1.factory.createIndexSignature(undefined, undefined, [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, undefined, typescript_1.factory.createIdentifier("key"), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.StringKeyword), undefined), | ||
return typescript_1.factory.createIndexSignature(undefined, [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, typescript_1.factory.createIdentifier("key"), undefined, typescript_1.factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.StringKeyword), undefined), | ||
], schema.additionalProperties === true || | ||
@@ -421,0 +421,0 @@ Object.keys(schema.additionalProperties).length === 0 |
@@ -131,3 +131,3 @@ "use strict"; | ||
} | ||
const queryKeyManager = typescript_1.factory.createTypeAliasDeclaration(undefined, [typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], "QueryOperation", undefined, keyManagerItems.length > 0 | ||
const queryKeyManager = typescript_1.factory.createTypeAliasDeclaration([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], "QueryOperation", undefined, keyManagerItems.length > 0 | ||
? typescript_1.factory.createUnionTypeNode(keyManagerItems) | ||
@@ -165,3 +165,3 @@ : typescript_1.factory.createTypeLiteralNode([ | ||
typescript_1.factory.createVariableDeclaration(typescript_1.factory.createIdentifier(name), undefined, undefined, typescript_1.factory.createArrowFunction(undefined, undefined, [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, undefined, typescript_1.factory.createIdentifier("options"), typescript_1.factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), typescript_1.factory.createTypeReferenceNode(typescript_1.factory.createIdentifier("Omit"), [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, typescript_1.factory.createIdentifier("options"), typescript_1.factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), typescript_1.factory.createTypeReferenceNode(typescript_1.factory.createIdentifier("Omit"), [ | ||
typescript_1.factory.createTypeReferenceNode(typescript_1.factory.createQualifiedName(typescript_1.factory.createIdentifier("reactQuery"), typescript_1.factory.createIdentifier("UseMutationOptions")), [dataType, errorType, variablesType]), | ||
@@ -178,3 +178,3 @@ typescript_1.factory.createLiteralTypeNode(typescript_1.factory.createStringLiteral("mutationFn")), | ||
typescript_1.factory.createArrowFunction(undefined, undefined, [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType, undefined), | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType, undefined), | ||
], undefined, typescript_1.factory.createToken(typescript_1.default.SyntaxKind.EqualsGreaterThanToken), typescript_1.factory.createCallExpression(typescript_1.factory.createIdentifier(operationFetcherFnName), undefined, [ | ||
@@ -198,5 +198,7 @@ typescript_1.factory.createObjectLiteralExpression([ | ||
nodes.push(typescript_1.factory.createVariableStatement([typescript_1.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.factory.createVariableDeclarationList([ | ||
typescript_1.factory.createVariableDeclaration(typescript_1.factory.createIdentifier(name), undefined, undefined, typescript_1.factory.createArrowFunction(undefined, [typescript_1.factory.createTypeParameterDeclaration("TData", undefined, dataType)], [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType), | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, undefined, typescript_1.factory.createIdentifier("options"), typescript_1.factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), createUseQueryOptionsType(dataType, errorType)), | ||
typescript_1.factory.createVariableDeclaration(typescript_1.factory.createIdentifier(name), undefined, undefined, typescript_1.factory.createArrowFunction(undefined, [ | ||
typescript_1.factory.createTypeParameterDeclaration(undefined, "TData", undefined, dataType), | ||
], [ | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, typescript_1.factory.createIdentifier("variables"), undefined, variablesType), | ||
typescript_1.factory.createParameterDeclaration(undefined, undefined, typescript_1.factory.createIdentifier("options"), typescript_1.factory.createToken(typescript_1.default.SyntaxKind.QuestionToken), createUseQueryOptionsType(dataType, errorType)), | ||
], undefined, typescript_1.factory.createToken(typescript_1.default.SyntaxKind.EqualsGreaterThanToken), typescript_1.factory.createBlock([ | ||
@@ -248,3 +250,3 @@ typescript_1.factory.createVariableStatement(undefined, typescript_1.factory.createVariableDeclarationList([ | ||
]); | ||
const createReactQueryImport = () => typescript_1.factory.createImportDeclaration(undefined, undefined, typescript_1.factory.createImportClause(false, undefined, typescript_1.factory.createNamespaceImport(typescript_1.factory.createIdentifier("reactQuery"))), typescript_1.factory.createStringLiteral("@tanstack/react-query"), undefined); | ||
const createReactQueryImport = () => typescript_1.factory.createImportDeclaration(undefined, typescript_1.factory.createImportClause(false, undefined, typescript_1.factory.createNamespaceImport(typescript_1.factory.createIdentifier("reactQuery"))), typescript_1.factory.createStringLiteral("@tanstack/react-query"), undefined); | ||
//# sourceMappingURL=generateReactQueryComponents.js.map |
@@ -86,3 +86,3 @@ "use strict"; | ||
if (response.headers.get('content-type').includes('json')) { | ||
if (response.headers.get('content-type')?.includes('json')) { | ||
return await response.json(); | ||
@@ -89,0 +89,0 @@ } else { |
@@ -5,3 +5,3 @@ import { OpenAPIObject, PathItemObject } from "openapi3-ts"; | ||
*/ | ||
export declare const addPathParam: ({ openAPIDocument, pathParam, required, condition: filter, }: { | ||
export declare const addPathParam: ({ openAPIDocument, pathParam, required, condition, }: { | ||
/** | ||
@@ -8,0 +8,0 @@ * The openAPI document to transform |
{ | ||
"name": "@openapi-codegen/typescript", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "OpenAPI Codegen typescript generators", | ||
@@ -37,3 +37,3 @@ "main": "lib/index.js", | ||
"tsutils": "^3.21.0", | ||
"typescript": "^4.5.2" | ||
"typescript": "4.8.2" | ||
}, | ||
@@ -45,3 +45,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "b799b4116183d2e8151f9084fb53a25a00091d8b" | ||
"gitHead": "086519e89f414a414e27d4947eaec2898107478e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2367
189036
+ Addedtypescript@4.8.2(transitive)
- Removedtypescript@4.9.5(transitive)
Updatedtypescript@4.8.2