@kubb/core
Advanced tools
Comparing version 0.32.0 to 0.33.0
@@ -160,4 +160,19 @@ import EventEmitter from 'events'; | ||
}; | ||
type KubbPluginKind = 'schema' | 'controller'; | ||
type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = { | ||
/** | ||
* Unique name used for the plugin | ||
* @example @kubb/typescript | ||
*/ | ||
name: string; | ||
/** | ||
* Kind/type for the plugin | ||
* Type 'schema' can be used for JSON schema's, Typescript types, ... | ||
* Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ... | ||
* @default undefined | ||
*/ | ||
kind?: KubbPluginKind; | ||
/** | ||
* Defined an api that can be used by other plugins | ||
*/ | ||
api?: TOptions['api']; | ||
@@ -342,2 +357,20 @@ } & Partial<PluginLifecycle>; | ||
export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, EmittedFile, File, FileManager, FileName, KubbConfig, KubbPlugin, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, createPlugin, createPluginCache, build as default, defineConfig, format, getPathMode, getRelativePath, hooks, isPromise, validatePlugins, write }; | ||
/** | ||
* Abstract class that contains the building blocks for plugins to create their own Generator | ||
* @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137 | ||
*/ | ||
declare abstract class Generator<TOptions extends object = object> { | ||
private _options; | ||
constructor(options?: TOptions); | ||
get options(): TOptions; | ||
abstract build(...params: any): any; | ||
} | ||
/** | ||
* Abstract class that contains the building blocks for plugins to create their own SchemaGenerator | ||
*/ | ||
declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput> extends Generator<TOptions> { | ||
abstract build(schema: TInput, name: string, description?: string): TOutput; | ||
} | ||
export { Argument0, CLIOptions, Cache, CacheStore, CorePluginOptions, EmittedFile, File, FileManager, FileName, Generator, KubbConfig, KubbPlugin, KubbPluginKind, KubbUserConfig, LogLevel, LogType, Logger, MaybePromise, OptionalPath, Path, PathMode, PluginContext, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginManager, ResolveIdParams, SchemaGenerator, Status, Strategy, TransformResult, TreeNode, UUID, ValidationPluginError, build, createPlugin, createPluginCache, build as default, defineConfig, format, getPathMode, getRelativePath, hooks, isPromise, validatePlugins, write }; |
@@ -581,2 +581,23 @@ 'use strict'; | ||
// src/generators/Generator.ts | ||
var Generator = class { | ||
_options = {}; | ||
constructor(options = {}) { | ||
if (options) { | ||
this._options = { | ||
...this._options, | ||
...options | ||
}; | ||
} | ||
return this; | ||
} | ||
get options() { | ||
return this._options; | ||
} | ||
}; | ||
// src/generators/SchemaGenerator.ts | ||
var SchemaGenerator = class extends Generator { | ||
}; | ||
// src/index.ts | ||
@@ -586,3 +607,5 @@ var src_default = build; | ||
exports.FileManager = FileManager; | ||
exports.Generator = Generator; | ||
exports.PluginManager = PluginManager; | ||
exports.SchemaGenerator = SchemaGenerator; | ||
exports.TreeNode = TreeNode; | ||
@@ -589,0 +612,0 @@ exports.ValidationPluginError = ValidationPluginError; |
{ | ||
"name": "@kubb/core", | ||
"version": "0.32.0", | ||
"version": "0.33.0", | ||
"description": "Generator core", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
132338
1621
24