1- import DtsGenerator , { ExportedType } from "@anttiviljami/dtsgenerator/dist/core/dtsGenerator" ;
1+ import DtsGenerator , { ExportedType } from "@anttiviljami/dtsgenerator/dist/core/dtsGenerator.js " ;
22import RefParser from "@apidevtools/json-schema-ref-parser" ;
3- import { parseSchema } from "@anttiviljami/dtsgenerator/dist/core/type" ;
4- import { find , chain , isEmpty } from "lodash" ;
3+ import { parseSchema } from "@anttiviljami/dtsgenerator/dist/core/type.js " ;
4+ import * as lodash from "lodash" ;
55import * as prettier from "prettier" ;
66import * as fs from "fs-extra" ;
7- import * as path from "path" ;
7+ import * as path from "node: path" ;
88import { createClient } from "@hyper-fetch/core" ;
99
1010import { Document , Operation , GeneratedTypes } from "./openapi.types" ;
@@ -239,18 +239,22 @@ export const createSdk = <Client extends ClientInstance>(client: Client) => {
239239 ) {
240240 const { operationId, method, path : relPath } = operation ;
241241 const normalizedOperationId = normalizeOperationId ( operationId ) ;
242- const pathParametersType = find ( exportTypes , {
242+ const pathParametersType = lodash . find ( exportTypes , {
243243 schemaRef : `#/paths/${ normalizedOperationId } /pathParameters` ,
244244 } ) ?. path ;
245- const queryParametersType = find ( exportTypes , {
245+ const queryParametersType = lodash . find ( exportTypes , {
246246 schemaRef : `#/paths/${ normalizedOperationId } /queryParameters` ,
247247 } ) ?. path ;
248- const requestBodyType = find ( exportTypes , { schemaRef : `#/paths/${ normalizedOperationId } /requestBody` } ) ?. path ;
249- const responseTypePaths = chain ( exportTypes )
248+ const requestBodyType = lodash . find ( exportTypes , {
249+ schemaRef : `#/paths/${ normalizedOperationId } /requestBody` ,
250+ } ) ?. path ;
251+ const responseTypePaths = lodash
252+ . chain ( exportTypes )
250253 . filter ( ( { schemaRef } ) => schemaRef . startsWith ( `#/paths/${ normalizedOperationId } /responses/2` ) )
251254 . map ( ( { path : responsePath } ) => responsePath )
252255 . value ( ) ;
253- const errorTypePaths = chain ( exportTypes )
256+ const errorTypePaths = lodash
257+ . chain ( exportTypes )
254258 . filter (
255259 ( { schemaRef } ) =>
256260 schemaRef . startsWith ( `#/paths/${ normalizedOperationId } /responses/4` ) ||
@@ -259,8 +263,8 @@ export const createSdk = <Client extends ClientInstance>(client: Client) => {
259263 . map ( ( { path : errorPath } ) => errorPath )
260264 . value ( ) ;
261265
262- const responseType = ! isEmpty ( responseTypePaths ) ? responseTypePaths . join ( " | " ) : "any" ;
263- const errorType = ! isEmpty ( errorTypePaths ) ? errorTypePaths . join ( " | " ) : "undefined" ;
266+ const responseType = ! lodash . isEmpty ( responseTypePaths ) ? responseTypePaths . join ( " | " ) : "any" ;
267+ const errorType = ! lodash . isEmpty ( errorTypePaths ) ? errorTypePaths . join ( " | " ) : "undefined" ;
264268
265269 return {
266270 id : normalizedOperationId ,
0 commit comments