@kubb/plugin-client 4.1.4 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Operations-B5ymSfTm.js → Operations-ktPlsW1u.js} +2 -2
- package/dist/{Operations-B5ymSfTm.js.map → Operations-ktPlsW1u.js.map} +1 -1
- package/dist/clients/axios.d.cts +4 -4
- package/dist/clients/axios.d.ts +4 -4
- package/dist/clients/fetch.d.cts +4 -4
- package/dist/clients/fetch.d.ts +4 -4
- package/dist/components.d.cts +8 -5
- package/dist/components.d.ts +8 -5
- package/dist/components.js +1 -1
- package/dist/{generators-Dlx9ubRQ.cjs → generators-BSxTToF6.cjs} +9 -4
- package/dist/generators-BSxTToF6.cjs.map +1 -0
- package/dist/{generators-CQSnGpkm.js → generators-BqXV2IXC.js} +11 -7
- package/dist/generators-BqXV2IXC.js.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/{types-Dff_FBev.d.ts → types-BfP2gAzn.d.cts} +85 -174
- package/dist/{types-CX3qvh_y.d.cts → types-DIxcknRD.d.ts} +85 -174
- package/package.json +8 -8
- package/src/generators/clientGenerator.tsx +5 -6
- package/src/generators/groupedClientGenerator.tsx +6 -7
- package/src/generators/operationsGenerator.tsx +7 -7
- package/src/plugin.ts +5 -8
- package/dist/generators-CQSnGpkm.js.map +0 -1
- package/dist/generators-Dlx9ubRQ.cjs.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']","baseURL"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']","baseURL"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = createPlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n generators = [clientGenerator, group ? groupedClientGenerator : undefined, operations ? operationsGenerator : undefined].filter(Boolean),\n parser = 'client',\n client = 'axios',\n importPath = client === 'fetch' ? '@kubb/plugin-client/clients/fetch' : '@kubb/plugin-client/clients/axios',\n contentType,\n } = options\n\n return {\n name: pluginClientName,\n options: {\n output,\n group,\n parser,\n dataReturnType,\n importPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n\n await this.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;AAWA,MAAa,mBAAmB;AAEhC,MAAa,eAAe,cAA4B,YAAY;CAClE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,UAAU,OACV,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,iBAAiB,QACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa,OACb,SACA,cACA,aAAa;EAAC;EAAiB,QAAQ,yBAAyB;EAAW,aAAa,sBAAsB;EAAU,CAAC,OAAO,QAAQ,EACxI,SAAS,UACT,SAAS,SACT,aAAa,WAAW,UAAU,sCAAsC,qCACxE,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,KAAK,CAAC,eAAe,WAAW,QAAQ,gBAAgB,OAAU,CAAC,OAAO,QAAQ;EAClF,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;AAEjE,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAiD,cAAc,mBAAyC,KAAK,SAAS,CAAC,cAAc,CAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAME,YAAU,MAAM,cAAc,QAAQ,YAAY;GAqBxD,MAAM,QAAQ,MAnBa,IAAI,mBAC7BA,YACI;IACE,GAAG,KAAK,OAAO;IACf;IACD,GACD,KAAK,OAAO,SAChB;IACE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CACF,CAEsC,MAAM,GAAG,WAAW;AAE3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,eAAe,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
|
|
@@ -5,8 +5,10 @@ import { OpenAPIV3 } from "openapi-types";
|
|
|
5
5
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
6
6
|
import BaseOas from "oas";
|
|
7
7
|
import { ConsolaInstance, LogLevel } from "consola";
|
|
8
|
-
import {
|
|
8
|
+
import { FileManager } from "@kubb/fabric-core";
|
|
9
9
|
|
|
10
|
+
//#region rolldown:runtime
|
|
11
|
+
//#endregion
|
|
10
12
|
//#region ../oas/src/types.d.ts
|
|
11
13
|
type contentType = 'application/json' | (string & {});
|
|
12
14
|
type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
@@ -15,7 +17,7 @@ type SchemaObject$1 = OasTypes.SchemaObject & {
|
|
|
15
17
|
};
|
|
16
18
|
//#endregion
|
|
17
19
|
//#region ../oas/src/Oas.d.ts
|
|
18
|
-
type Options$
|
|
20
|
+
type Options$3 = {
|
|
19
21
|
contentType?: contentType;
|
|
20
22
|
discriminator?: 'strict' | 'inherit';
|
|
21
23
|
};
|
|
@@ -29,8 +31,8 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
29
31
|
oas: TOAS | OASDocument | string;
|
|
30
32
|
user?: User;
|
|
31
33
|
});
|
|
32
|
-
setOptions(options: Options$
|
|
33
|
-
get options(): Options$
|
|
34
|
+
setOptions(options: Options$3): void;
|
|
35
|
+
get options(): Options$3;
|
|
34
36
|
get($ref: string): any;
|
|
35
37
|
getKey($ref: string): string | undefined;
|
|
36
38
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -47,17 +49,17 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
47
49
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
48
50
|
* @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
|
|
49
51
|
*/
|
|
50
|
-
declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
|
|
52
|
+
declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
|
|
51
53
|
#private;
|
|
52
|
-
constructor(options?: TOptions, context?: TContext);
|
|
53
|
-
get options(): TOptions;
|
|
54
|
+
constructor(options?: TOptions$1, context?: TContext);
|
|
55
|
+
get options(): TOptions$1;
|
|
54
56
|
get context(): TContext;
|
|
55
|
-
set options(options: TOptions);
|
|
57
|
+
set options(options: TOptions$1);
|
|
56
58
|
abstract build(...params: unknown[]): unknown;
|
|
57
59
|
}
|
|
58
60
|
//#endregion
|
|
59
61
|
//#region ../core/src/fs/types.d.ts
|
|
60
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
62
|
+
type BasePath<T$1 extends string = string> = `${T$1}/`;
|
|
61
63
|
type Import = {
|
|
62
64
|
/**
|
|
63
65
|
* Import name to be used
|
|
@@ -131,7 +133,7 @@ type BaseName = `${string}.${string}`;
|
|
|
131
133
|
* Path will be full qualified path to a specified file
|
|
132
134
|
*/
|
|
133
135
|
type Path = string;
|
|
134
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
136
|
+
type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
|
|
135
137
|
type OptionalPath = Path | undefined | null;
|
|
136
138
|
type File<TMeta extends object = object> = {
|
|
137
139
|
/**
|
|
@@ -220,9 +222,7 @@ type Logger = {
|
|
|
220
222
|
};
|
|
221
223
|
//#endregion
|
|
222
224
|
//#region ../core/src/utils/types.d.ts
|
|
223
|
-
type PossiblePromise<T> = Promise<T> | T;
|
|
224
|
-
type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
|
|
225
|
-
type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
|
|
225
|
+
type PossiblePromise<T$1> = Promise<T$1> | T$1;
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region ../core/src/types.d.ts
|
|
228
228
|
type InputPath = {
|
|
@@ -335,11 +335,11 @@ TName extends string = string,
|
|
|
335
335
|
/**
|
|
336
336
|
* Options of the plugin.
|
|
337
337
|
*/
|
|
338
|
-
TOptions extends object = object,
|
|
338
|
+
TOptions$1 extends object = object,
|
|
339
339
|
/**
|
|
340
340
|
* Options of the plugin that can be used later on, see `options` inside your plugin config.
|
|
341
341
|
*/
|
|
342
|
-
TResolvedOptions extends object = TOptions,
|
|
342
|
+
TResolvedOptions extends object = TOptions$1,
|
|
343
343
|
/**
|
|
344
344
|
* Context that you want to expose to other plugins.
|
|
345
345
|
*/
|
|
@@ -353,23 +353,23 @@ TResolvePathOptions extends object = object> = {
|
|
|
353
353
|
* Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
354
354
|
*/
|
|
355
355
|
key: PluginKey<TName | string>;
|
|
356
|
-
options: TOptions;
|
|
356
|
+
options: TOptions$1;
|
|
357
357
|
resolvedOptions: TResolvedOptions;
|
|
358
358
|
context: TContext;
|
|
359
359
|
resolvePathOptions: TResolvePathOptions;
|
|
360
360
|
};
|
|
361
361
|
type PluginKey<TName> = [name: TName, identifier?: string | number];
|
|
362
|
-
type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
362
|
+
type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
363
363
|
/**
|
|
364
364
|
* Unique name used for the plugin
|
|
365
365
|
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
366
366
|
* @example @kubb/typescript
|
|
367
367
|
*/
|
|
368
|
-
name: TOptions['name'];
|
|
368
|
+
name: TOptions$1['name'];
|
|
369
369
|
/**
|
|
370
370
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
371
371
|
*/
|
|
372
|
-
options: TOptions['resolvedOptions'];
|
|
372
|
+
options: TOptions$1['resolvedOptions'];
|
|
373
373
|
/**
|
|
374
374
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
375
375
|
* Can be used to validate dependent plugins.
|
|
@@ -379,23 +379,23 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
379
379
|
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
|
|
380
380
|
*/
|
|
381
381
|
post?: Array<string>;
|
|
382
|
-
} & (TOptions['context'] extends never ? {
|
|
382
|
+
} & (TOptions$1['context'] extends never ? {
|
|
383
383
|
context?: never;
|
|
384
384
|
} : {
|
|
385
|
-
context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
|
|
385
|
+
context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
|
|
386
386
|
});
|
|
387
|
-
type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
388
|
-
type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
387
|
+
type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
388
|
+
type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
389
389
|
/**
|
|
390
390
|
* Unique name used for the plugin
|
|
391
391
|
* @example @kubb/typescript
|
|
392
392
|
*/
|
|
393
|
-
name: TOptions['name'];
|
|
393
|
+
name: TOptions$1['name'];
|
|
394
394
|
/**
|
|
395
395
|
* Internal key used when a developer uses more than one of the same plugin
|
|
396
396
|
* @private
|
|
397
397
|
*/
|
|
398
|
-
key: TOptions['key'];
|
|
398
|
+
key: TOptions$1['key'];
|
|
399
399
|
/**
|
|
400
400
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
401
401
|
* Can be used to validate dependent plugins.
|
|
@@ -408,49 +408,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
408
408
|
/**
|
|
409
409
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
410
410
|
*/
|
|
411
|
-
options: TOptions['resolvedOptions'];
|
|
412
|
-
} & (TOptions['context'] extends never ? {
|
|
411
|
+
options: TOptions$1['resolvedOptions'];
|
|
412
|
+
} & (TOptions$1['context'] extends never ? {
|
|
413
413
|
context?: never;
|
|
414
414
|
} : {
|
|
415
|
-
context: TOptions['context'];
|
|
415
|
+
context: TOptions$1['context'];
|
|
416
416
|
});
|
|
417
|
-
type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
|
|
418
|
-
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
417
|
+
type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
|
|
418
|
+
type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
419
419
|
/**
|
|
420
420
|
* Start of the lifecycle of a plugin.
|
|
421
421
|
* @type hookParallel
|
|
422
422
|
*/
|
|
423
|
-
buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
|
|
423
|
+
buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
|
|
424
424
|
/**
|
|
425
425
|
* Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
|
|
426
426
|
* Options can als be included.
|
|
427
427
|
* @type hookFirst
|
|
428
428
|
* @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
|
|
429
429
|
*/
|
|
430
|
-
resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
|
|
430
|
+
resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
|
|
431
431
|
/**
|
|
432
432
|
* Resolve to a name based on a string.
|
|
433
433
|
* Useful when converting to PascalCase or camelCase.
|
|
434
434
|
* @type hookFirst
|
|
435
435
|
* @example ('pet') => 'Pet'
|
|
436
436
|
*/
|
|
437
|
-
resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
437
|
+
resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
438
438
|
/**
|
|
439
439
|
* End of the plugin lifecycle.
|
|
440
440
|
* @type hookParallel
|
|
441
441
|
*/
|
|
442
|
-
buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
|
|
442
|
+
buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
|
|
443
443
|
};
|
|
444
444
|
type PluginLifecycleHooks = keyof PluginLifecycle;
|
|
445
|
-
type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
|
|
446
|
-
type ResolvePathParams<TOptions = object> = {
|
|
445
|
+
type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
|
|
446
|
+
type ResolvePathParams<TOptions$1 = object> = {
|
|
447
447
|
pluginKey?: Plugin['key'];
|
|
448
448
|
baseName: BaseName;
|
|
449
449
|
mode?: Mode;
|
|
450
450
|
/**
|
|
451
451
|
* Options to be passed to 'resolvePath' 3th parameter
|
|
452
452
|
*/
|
|
453
|
-
options?: TOptions;
|
|
453
|
+
options?: TOptions$1;
|
|
454
454
|
};
|
|
455
455
|
type ResolveNameParams = {
|
|
456
456
|
name: string;
|
|
@@ -463,12 +463,15 @@ type ResolveNameParams = {
|
|
|
463
463
|
*/
|
|
464
464
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
465
465
|
};
|
|
466
|
-
type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
466
|
+
type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
467
467
|
config: Config;
|
|
468
|
+
/**
|
|
469
|
+
* @deprecated
|
|
470
|
+
*/
|
|
468
471
|
fileManager: FileManager;
|
|
469
472
|
pluginManager: PluginManager;
|
|
470
473
|
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
471
|
-
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
|
|
474
|
+
resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
|
|
472
475
|
resolveName: (params: ResolveNameParams) => string;
|
|
473
476
|
logger: Logger;
|
|
474
477
|
/**
|
|
@@ -478,12 +481,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
478
481
|
/**
|
|
479
482
|
* Current plugin
|
|
480
483
|
*/
|
|
481
|
-
plugin: Plugin<TOptions>;
|
|
484
|
+
plugin: Plugin<TOptions$1>;
|
|
482
485
|
};
|
|
483
486
|
/**
|
|
484
487
|
* Specify the export location for the files and define the behavior of the output
|
|
485
488
|
*/
|
|
486
|
-
type Output<TOptions> = {
|
|
489
|
+
type Output<TOptions$1> = {
|
|
487
490
|
/**
|
|
488
491
|
* Path to the output folder or file that will contain the generated code
|
|
489
492
|
*/
|
|
@@ -496,11 +499,11 @@ type Output<TOptions> = {
|
|
|
496
499
|
/**
|
|
497
500
|
* Add a banner text in the beginning of every file
|
|
498
501
|
*/
|
|
499
|
-
banner?: string | ((options: TOptions) => string);
|
|
502
|
+
banner?: string | ((options: TOptions$1) => string);
|
|
500
503
|
/**
|
|
501
504
|
* Add a footer text in the beginning of every file
|
|
502
505
|
*/
|
|
503
|
-
footer?: string | ((options: TOptions) => string);
|
|
506
|
+
footer?: string | ((options: TOptions$1) => string);
|
|
504
507
|
};
|
|
505
508
|
type GroupContext = {
|
|
506
509
|
group: string;
|
|
@@ -516,77 +519,23 @@ type Group = {
|
|
|
516
519
|
name?: (context: GroupContext) => string;
|
|
517
520
|
};
|
|
518
521
|
//#endregion
|
|
519
|
-
//#region ../core/src/FileManager.d.ts
|
|
520
|
-
type FileMetaBase = {
|
|
521
|
-
pluginKey?: Plugin['key'];
|
|
522
|
-
};
|
|
523
|
-
type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
524
|
-
type AddIndexesProps = {
|
|
525
|
-
type: BarrelType | false | undefined;
|
|
526
|
-
/**
|
|
527
|
-
* Root based on root and output.path specified in the config
|
|
528
|
-
*/
|
|
529
|
-
root: string;
|
|
530
|
-
/**
|
|
531
|
-
* Output for plugin
|
|
532
|
-
*/
|
|
533
|
-
output: {
|
|
534
|
-
path: string;
|
|
535
|
-
};
|
|
536
|
-
group?: {
|
|
537
|
-
output: string;
|
|
538
|
-
exportAs: string;
|
|
539
|
-
};
|
|
540
|
-
logger?: Logger;
|
|
541
|
-
meta?: FileMetaBase;
|
|
542
|
-
};
|
|
543
|
-
type WriteFilesProps = {
|
|
544
|
-
root: Config['root'];
|
|
545
|
-
extension?: Record<Extname, Extname | ''>;
|
|
546
|
-
logger?: Logger;
|
|
547
|
-
dryRun?: boolean;
|
|
548
|
-
};
|
|
549
|
-
declare class FileManager {
|
|
550
|
-
#private;
|
|
551
|
-
constructor();
|
|
552
|
-
add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
|
|
553
|
-
getByPath(path: Path): Promise<ResolvedFile | null>;
|
|
554
|
-
deleteByPath(path: Path): Promise<void>;
|
|
555
|
-
clear(): Promise<void>;
|
|
556
|
-
getFiles(): Promise<Array<ResolvedFile>>;
|
|
557
|
-
processFiles({
|
|
558
|
-
dryRun,
|
|
559
|
-
root,
|
|
560
|
-
extension,
|
|
561
|
-
logger
|
|
562
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
563
|
-
getBarrelFiles({
|
|
564
|
-
type,
|
|
565
|
-
meta,
|
|
566
|
-
root,
|
|
567
|
-
output,
|
|
568
|
-
logger
|
|
569
|
-
}: AddIndexesProps): Promise<File[]>;
|
|
570
|
-
static getMode(path: string | undefined | null): Mode;
|
|
571
|
-
}
|
|
572
|
-
//#endregion
|
|
573
522
|
//#region ../core/src/PluginManager.d.ts
|
|
574
523
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
575
524
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
576
|
-
type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
525
|
+
type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
|
|
577
526
|
message: string;
|
|
578
527
|
strategy: Strategy;
|
|
579
|
-
hookName: H;
|
|
528
|
+
hookName: H$1;
|
|
580
529
|
plugin: Plugin;
|
|
581
530
|
parameters?: unknown[] | undefined;
|
|
582
531
|
output?: unknown;
|
|
583
532
|
};
|
|
584
|
-
type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
|
|
585
|
-
type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
|
|
533
|
+
type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
|
|
534
|
+
type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
|
|
586
535
|
result: Result;
|
|
587
536
|
plugin: Plugin;
|
|
588
537
|
};
|
|
589
|
-
type Options$
|
|
538
|
+
type Options$2 = {
|
|
590
539
|
logger: Logger;
|
|
591
540
|
/**
|
|
592
541
|
* @default Number.POSITIVE_INFINITY
|
|
@@ -598,23 +547,26 @@ type Events = {
|
|
|
598
547
|
executed: [executer: Executer];
|
|
599
548
|
error: [error: Error];
|
|
600
549
|
};
|
|
601
|
-
type GetFileProps<TOptions = object> = {
|
|
550
|
+
type GetFileProps<TOptions$1 = object> = {
|
|
602
551
|
name: string;
|
|
603
552
|
mode?: Mode;
|
|
604
553
|
extname: Extname;
|
|
605
554
|
pluginKey: Plugin['key'];
|
|
606
|
-
options?: TOptions;
|
|
555
|
+
options?: TOptions$1;
|
|
607
556
|
};
|
|
608
557
|
declare class PluginManager {
|
|
609
558
|
#private;
|
|
610
559
|
readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
|
|
560
|
+
/**
|
|
561
|
+
* @deprecated do not use from pluginManager
|
|
562
|
+
*/
|
|
611
563
|
readonly fileManager: FileManager;
|
|
612
564
|
readonly events: EventEmitter<Events>;
|
|
613
565
|
readonly config: Config;
|
|
614
566
|
readonly executed: Array<Executer>;
|
|
615
567
|
readonly logger: Logger;
|
|
616
|
-
readonly options: Options$
|
|
617
|
-
constructor(config: Config, options: Options$
|
|
568
|
+
readonly options: Options$2;
|
|
569
|
+
constructor(config: Config, options: Options$2);
|
|
618
570
|
getFile<TOptions = object>({
|
|
619
571
|
name,
|
|
620
572
|
mode,
|
|
@@ -716,52 +668,11 @@ declare class PluginManager {
|
|
|
716
668
|
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
717
669
|
}
|
|
718
670
|
//#endregion
|
|
719
|
-
//#region ../
|
|
720
|
-
type
|
|
721
|
-
|
|
722
|
-
* `object` will return the pathParams as an object.
|
|
723
|
-
*
|
|
724
|
-
* `inline` will return the pathParams as comma separated params.
|
|
725
|
-
* @default `'inline'`
|
|
726
|
-
* @private
|
|
727
|
-
*/
|
|
728
|
-
mode?: 'object' | 'inline' | 'inlineSpread';
|
|
729
|
-
type?: 'string' | 'number' | (string & {});
|
|
730
|
-
optional?: boolean;
|
|
731
|
-
/**
|
|
732
|
-
* @example test = "default"
|
|
733
|
-
*/
|
|
734
|
-
default?: string;
|
|
735
|
-
/**
|
|
736
|
-
* Used for no TypeScript(with mode object)
|
|
737
|
-
* @example test: "default"
|
|
738
|
-
*/
|
|
739
|
-
value?: string;
|
|
740
|
-
children?: Params;
|
|
741
|
-
};
|
|
742
|
-
type Params = Record<string, Param | undefined>;
|
|
743
|
-
type Options$2 = {
|
|
744
|
-
type: 'constructor' | 'call' | 'object' | 'objectValue';
|
|
745
|
-
transformName?: (name: string) => string;
|
|
746
|
-
transformType?: (type: string) => string;
|
|
671
|
+
//#region ../core/src/FileManager.d.ts
|
|
672
|
+
type FileMetaBase = {
|
|
673
|
+
pluginKey?: Plugin['key'];
|
|
747
674
|
};
|
|
748
|
-
|
|
749
|
-
#private;
|
|
750
|
-
static factory(params: Params): FunctionParams;
|
|
751
|
-
constructor(params: Params);
|
|
752
|
-
get params(): Params;
|
|
753
|
-
get flatParams(): Params;
|
|
754
|
-
toCall({
|
|
755
|
-
transformName,
|
|
756
|
-
transformType
|
|
757
|
-
}?: Pick<Options$2, 'transformName' | 'transformType'>): string;
|
|
758
|
-
toObject(): string;
|
|
759
|
-
toObjectValue(): string;
|
|
760
|
-
toConstructor(): string;
|
|
761
|
-
}
|
|
762
|
-
//#endregion
|
|
763
|
-
//#region ../react/src/types.d.ts
|
|
764
|
-
type KubbNode = ReactNode;
|
|
675
|
+
import * as import___kubb_react_fabric_types from "@kubb/react-fabric/types";
|
|
765
676
|
//#endregion
|
|
766
677
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
767
678
|
type SchemaKeywordMapper = {
|
|
@@ -1056,12 +967,12 @@ type ByContentType = {
|
|
|
1056
967
|
};
|
|
1057
968
|
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
1058
969
|
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
1059
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
1060
|
-
options: Partial<TOptions>;
|
|
970
|
+
type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
971
|
+
options: Partial<TOptions$1>;
|
|
1061
972
|
};
|
|
1062
973
|
//#endregion
|
|
1063
974
|
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
1064
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
975
|
+
type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
1065
976
|
oas: Oas;
|
|
1066
977
|
pluginManager: PluginManager;
|
|
1067
978
|
/**
|
|
@@ -1070,7 +981,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
|
1070
981
|
plugin: Plugin<TPluginOptions>;
|
|
1071
982
|
mode: Mode;
|
|
1072
983
|
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
1073
|
-
override: Array<Override<TOptions>> | undefined;
|
|
984
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
1074
985
|
contentType?: contentType;
|
|
1075
986
|
output?: string;
|
|
1076
987
|
};
|
|
@@ -1101,7 +1012,7 @@ type SchemaProps$1 = {
|
|
|
1101
1012
|
name?: string;
|
|
1102
1013
|
parentName?: string;
|
|
1103
1014
|
};
|
|
1104
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context$1<TOptions, TPluginOptions>> {
|
|
1015
|
+
declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions$1, Context$1<TOptions$1, TPluginOptions>> {
|
|
1105
1016
|
#private;
|
|
1106
1017
|
refs: Refs;
|
|
1107
1018
|
/**
|
|
@@ -1120,39 +1031,39 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
1120
1031
|
}
|
|
1121
1032
|
//#endregion
|
|
1122
1033
|
//#region ../plugin-oas/src/generator.d.ts
|
|
1123
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
1124
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
1125
|
-
options: TOptions['resolvedOptions'];
|
|
1034
|
+
type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
1035
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
1036
|
+
options: TOptions$1['resolvedOptions'];
|
|
1126
1037
|
operations: Array<Operation$1>;
|
|
1127
1038
|
};
|
|
1128
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
1129
|
-
instance: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
1130
|
-
options: TOptions['resolvedOptions'];
|
|
1039
|
+
type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
1040
|
+
instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
|
|
1041
|
+
options: TOptions$1['resolvedOptions'];
|
|
1131
1042
|
operation: Operation$1;
|
|
1132
1043
|
};
|
|
1133
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
1134
|
-
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
1135
|
-
options: TOptions['resolvedOptions'];
|
|
1044
|
+
type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
|
|
1045
|
+
instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
|
|
1046
|
+
options: TOptions$1['resolvedOptions'];
|
|
1136
1047
|
schema: {
|
|
1137
1048
|
name: string;
|
|
1138
1049
|
tree: Array<Schema>;
|
|
1139
1050
|
value: SchemaObject$1;
|
|
1140
1051
|
};
|
|
1141
1052
|
};
|
|
1142
|
-
type GeneratorOptions<TOptions extends PluginFactoryOptions> = {
|
|
1053
|
+
type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
|
|
1143
1054
|
name: string;
|
|
1144
|
-
operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<File[]>;
|
|
1145
|
-
operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<File[]>;
|
|
1146
|
-
schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<File[]>;
|
|
1055
|
+
operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
|
|
1056
|
+
operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
|
|
1057
|
+
schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
|
|
1147
1058
|
};
|
|
1148
|
-
type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>;
|
|
1059
|
+
type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
|
|
1149
1060
|
//#endregion
|
|
1150
1061
|
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
1151
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
1062
|
+
type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
|
|
1152
1063
|
oas: Oas;
|
|
1153
1064
|
exclude: Array<Exclude$1> | undefined;
|
|
1154
1065
|
include: Array<Include> | undefined;
|
|
1155
|
-
override: Array<Override<TOptions>> | undefined;
|
|
1066
|
+
override: Array<Override<TOptions$1>> | undefined;
|
|
1156
1067
|
contentType: contentType | undefined;
|
|
1157
1068
|
pluginManager: PluginManager;
|
|
1158
1069
|
/**
|
|
@@ -1291,5 +1202,5 @@ type ResolvedOptions = {
|
|
|
1291
1202
|
};
|
|
1292
1203
|
type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1293
1204
|
//#endregion
|
|
1294
|
-
export {
|
|
1295
|
-
//# sourceMappingURL=types-
|
|
1205
|
+
export { types_d_exports$1 as a, __reExport as c, OperationSchemas as i, PluginClient as n, UserPluginWithLifeCycle as o, Generator as r, Operation$1 as s, Options$1 as t };
|
|
1206
|
+
//# sourceMappingURL=types-BfP2gAzn.d.cts.map
|