@kubb/react
Advanced tools
Comparing version 3.0.0-alpha.28 to 3.0.0-alpha.29
@@ -43,2 +43,3 @@ import * as KubbFile from '@kubb/fs/types'; | ||
get params(): Params; | ||
get flatParams(): Params; | ||
toCall({ transformName, transformType }?: Pick<Options, 'transformName' | 'transformType'>): string; | ||
@@ -45,0 +46,0 @@ toConstructor({ valueAsType }?: { |
@@ -12,3 +12,3 @@ import process from 'node:process'; | ||
import autoBind from 'auto-bind'; | ||
import transformers, { createJSDocBlockText, camelCase } from '@kubb/core/transformers'; | ||
import transformers, { createJSDocBlockText } from '@kubb/core/transformers'; | ||
import { orderBy } from 'natural-orderby'; | ||
@@ -876,3 +876,3 @@ | ||
} | ||
const parsedItem = parseItem(camelCase(key), item, options); | ||
const parsedItem = parseItem(key, item, options); | ||
return [...acc, ...parsedItem]; | ||
@@ -895,2 +895,14 @@ }, []).join(", "); | ||
} | ||
get flatParams() { | ||
const flatter = (acc, [key, item]) => { | ||
if (item?.children) { | ||
return Object.entries(item.children).reduce(flatter, acc); | ||
} | ||
if (item) { | ||
acc[key] = item; | ||
} | ||
return acc; | ||
}; | ||
return Object.entries(this.#params).reduce(flatter, {}); | ||
} | ||
toCall({ transformName, transformType } = {}) { | ||
@@ -897,0 +909,0 @@ return getFunctionParams(this.#params, { type: "call", transformName, transformType }); |
{ | ||
"name": "@kubb/react", | ||
"version": "3.0.0-alpha.28", | ||
"version": "3.0.0-alpha.29", | ||
"description": "Generator react", | ||
@@ -80,5 +80,5 @@ "keywords": [ | ||
"ws": "8.15.0", | ||
"@kubb/core": "3.0.0-alpha.28", | ||
"@kubb/fs": "3.0.0-alpha.28", | ||
"@kubb/parser-ts": "3.0.0-alpha.28" | ||
"@kubb/core": "3.0.0-alpha.29", | ||
"@kubb/fs": "3.0.0-alpha.29", | ||
"@kubb/parser-ts": "3.0.0-alpha.29" | ||
}, | ||
@@ -92,4 +92,4 @@ "devDependencies": { | ||
"typescript": "^5.6.2", | ||
"@kubb/config-ts": "3.0.0-alpha.28", | ||
"@kubb/config-tsup": "3.0.0-alpha.28" | ||
"@kubb/config-ts": "3.0.0-alpha.29", | ||
"@kubb/config-tsup": "3.0.0-alpha.29" | ||
}, | ||
@@ -96,0 +96,0 @@ "engines": { |
@@ -1,2 +0,1 @@ | ||
import { camelCase } from '@kubb/core/transformers' | ||
import { orderBy } from 'natural-orderby' | ||
@@ -149,3 +148,3 @@ | ||
const parsedItem = parseItem(camelCase(key), item, options) | ||
const parsedItem = parseItem(key, item, options) | ||
@@ -160,3 +159,3 @@ return [...acc, ...parsedItem] | ||
} | ||
//TODO use of string as `$name: $type` to create templates for functions instead of call/constructor | ||
export class FunctionParams { | ||
@@ -172,6 +171,20 @@ #params: Params | ||
get params() { | ||
get params(): Params { | ||
return this.#params | ||
} | ||
get flatParams(): Params { | ||
const flatter = (acc: Params, [key, item]: [key: string, item?: Param]): Params => { | ||
if (item?.children) { | ||
return Object.entries(item.children).reduce(flatter, acc) | ||
} | ||
if (item) { | ||
acc[key] = item | ||
} | ||
return acc | ||
} | ||
return Object.entries(this.#params).reduce(flatter, {} as Params) | ||
} | ||
toCall({ transformName, transformType }: Pick<Options, 'transformName' | 'transformType'> = {}): string { | ||
@@ -178,0 +191,0 @@ return getFunctionParams(this.#params, { type: 'call', transformName, transformType }) |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302143
4024
+ Added@kubb/core@3.0.0-alpha.29(transitive)
+ Added@kubb/fs@3.0.0-alpha.29(transitive)
+ Added@kubb/parser-ts@3.0.0-alpha.29(transitive)
+ Added@kubb/types@3.0.0-alpha.29(transitive)
- Removed@kubb/core@3.0.0-alpha.28(transitive)
- Removed@kubb/fs@3.0.0-alpha.28(transitive)
- Removed@kubb/parser-ts@3.0.0-alpha.28(transitive)
- Removed@kubb/types@3.0.0-alpha.28(transitive)
Updated@kubb/core@3.0.0-alpha.29
Updated@kubb/fs@3.0.0-alpha.29