@kubb/plugin-solid-query 4.2.0 → 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/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.cjs +3 -3
- 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 +4 -4
- package/dist/index.js.map +1 -1
- package/dist/{types-DTp-JvQu.d.ts → types-CwHqWpPi.d.cts} +13 -57
- package/dist/{types-C2GJpelw.d.cts → types-DGARY9Er.d.ts} +13 -57
- package/package.json +8 -8
- package/src/plugin.ts +4 -5
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-
|
|
1
|
+
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-CwHqWpPi.cjs";
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
//#endregion
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-
|
|
1
|
+
import { a as OperationSchemas, n as PluginSolidQuery, r as Transformer, s as Operation } from "./types-DGARY9Er.js";
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
//#endregion
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Generator, n as PluginSolidQuery } from "./types-
|
|
1
|
+
import { i as Generator, n as PluginSolidQuery } from "./types-CwHqWpPi.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/mutationGenerator.d.ts
|
|
4
4
|
declare const mutationGenerator: Generator<PluginSolidQuery>;
|
package/dist/generators.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
60
60
|
].filter(Boolean),
|
|
61
61
|
resolvePath(baseName, pathMode, options$1) {
|
|
62
62
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
63
|
-
if ((pathMode ?? __kubb_core.
|
|
63
|
+
if ((pathMode ?? (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
|
|
64
64
|
/**
|
|
65
65
|
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
66
66
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
@@ -86,7 +86,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
86
86
|
const [swaggerPlugin] = __kubb_core.PluginManager.getDependedPlugins(this.plugins, [__kubb_plugin_oas.pluginOasName]);
|
|
87
87
|
const oas = await swaggerPlugin.context.getOas();
|
|
88
88
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
89
|
-
const mode = __kubb_core.
|
|
89
|
+
const mode = (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path));
|
|
90
90
|
const baseURL = await swaggerPlugin.context.getBaseURL();
|
|
91
91
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
92
92
|
const files = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
|
|
@@ -100,7 +100,7 @@ const pluginSolidQuery = (0, __kubb_core.createPlugin)((options) => {
|
|
|
100
100
|
mode
|
|
101
101
|
}).build(...generators);
|
|
102
102
|
await this.addFile(...files);
|
|
103
|
-
const barrelFiles = await this.fileManager.
|
|
103
|
+
const barrelFiles = await (0, __kubb_core.getBarrelFiles)(this.fileManager.files, {
|
|
104
104
|
type: output.barrelType ?? "named",
|
|
105
105
|
root,
|
|
106
106
|
output,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["QueryKey","queryGenerator","mutationGenerator","MutationKey","pluginOasName","pluginTsName","pluginZodName","path","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["QueryKey","queryGenerator","mutationGenerator","MutationKey","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/solid-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n group,\n paramsCasing,\n },\n pre: [pluginOasName, pluginTsName, 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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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 if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\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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AErC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-
|
|
1
|
+
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-CwHqWpPi.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-
|
|
1
|
+
import { n as PluginSolidQuery, o as UserPluginWithLifeCycle, t as Options } from "./types-DGARY9Er.js";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginSolidQueryName = "plugin-solid-query";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as MutationKey, r as QueryKey } from "./components-Coq1fmcl.js";
|
|
2
2
|
import { n as mutationGenerator, t as queryGenerator } from "./generators-D-_RURdc.js";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { PluginManager, createPlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase, pascalCase } from "@kubb/core/transformers";
|
|
6
6
|
import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
|
|
7
7
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
@@ -54,7 +54,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
54
54
|
].filter(Boolean),
|
|
55
55
|
resolvePath(baseName, pathMode, options$1) {
|
|
56
56
|
const root = path.resolve(this.config.root, this.config.output.path);
|
|
57
|
-
if ((pathMode ??
|
|
57
|
+
if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
|
|
58
58
|
/**
|
|
59
59
|
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
60
60
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
@@ -80,7 +80,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
80
80
|
const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
|
|
81
81
|
const oas = await swaggerPlugin.context.getOas();
|
|
82
82
|
const root = path.resolve(this.config.root, this.config.output.path);
|
|
83
|
-
const mode =
|
|
83
|
+
const mode = getMode(path.resolve(root, output.path));
|
|
84
84
|
const baseURL = await swaggerPlugin.context.getBaseURL();
|
|
85
85
|
if (baseURL) this.plugin.options.client.baseURL = baseURL;
|
|
86
86
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
@@ -94,7 +94,7 @@ const pluginSolidQuery = createPlugin((options) => {
|
|
|
94
94
|
mode
|
|
95
95
|
}).build(...generators);
|
|
96
96
|
await this.addFile(...files);
|
|
97
|
-
const barrelFiles = await this.fileManager.
|
|
97
|
+
const barrelFiles = await getBarrelFiles(this.fileManager.files, {
|
|
98
98
|
type: output.barrelType ?? "named",
|
|
99
99
|
root,
|
|
100
100
|
output,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, mutationGenerator].filter(Boolean),\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n paramsCasing,\n contentType,\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n pathParamsType,\n ...options.client,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n mutationKey,\n mutation: {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/solid-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n group,\n paramsCasing,\n },\n pre: [pluginOasName, pluginTsName, 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 let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(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 if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\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,uBAAuB;AAEpC,MAAa,mBAAmB,cAAgC,YAAY;CAC1E,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,SAAS,gBACpB,aAAa,CAAC,gBAAgB,kBAAkB,CAAC,OAAO,QAAQ,EAChE,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cAAc,YAAY,gBAC1B,cACA,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB;IACA,GAAG,QAAQ;IACZ;GACD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,cAAc,CAAC;GAEvH,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,MAAM,UAAU,MAAM,cAAc,QAAQ,YAAY;AAExD,OAAI,QACF,MAAK,OAAO,QAAQ,OAAO,UAAU;GAcvC,MAAM,QAAQ,MAXa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,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,6 +5,7 @@ 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 { FileManager } from "@kubb/fabric-core";
|
|
8
9
|
|
|
9
10
|
//#region ../oas/src/types.d.ts
|
|
10
11
|
type contentType = 'application/json' | (string & {});
|
|
@@ -220,8 +221,6 @@ type Logger = {
|
|
|
220
221
|
//#endregion
|
|
221
222
|
//#region ../core/src/utils/types.d.ts
|
|
222
223
|
type PossiblePromise<T$1> = Promise<T$1> | T$1;
|
|
223
|
-
type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
|
|
224
|
-
type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
|
|
225
224
|
//#endregion
|
|
226
225
|
//#region ../core/src/types.d.ts
|
|
227
226
|
type InputPath = {
|
|
@@ -464,6 +463,9 @@ type ResolveNameParams = {
|
|
|
464
463
|
};
|
|
465
464
|
type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
466
465
|
config: Config;
|
|
466
|
+
/**
|
|
467
|
+
* @deprecated
|
|
468
|
+
*/
|
|
467
469
|
fileManager: FileManager;
|
|
468
470
|
pluginManager: PluginManager;
|
|
469
471
|
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
@@ -515,60 +517,6 @@ type Group = {
|
|
|
515
517
|
name?: (context: GroupContext) => string;
|
|
516
518
|
};
|
|
517
519
|
//#endregion
|
|
518
|
-
//#region ../core/src/FileManager.d.ts
|
|
519
|
-
type FileMetaBase = {
|
|
520
|
-
pluginKey?: Plugin['key'];
|
|
521
|
-
};
|
|
522
|
-
type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
523
|
-
type AddIndexesProps = {
|
|
524
|
-
type: BarrelType | false | undefined;
|
|
525
|
-
/**
|
|
526
|
-
* Root based on root and output.path specified in the config
|
|
527
|
-
*/
|
|
528
|
-
root: string;
|
|
529
|
-
/**
|
|
530
|
-
* Output for plugin
|
|
531
|
-
*/
|
|
532
|
-
output: {
|
|
533
|
-
path: string;
|
|
534
|
-
};
|
|
535
|
-
group?: {
|
|
536
|
-
output: string;
|
|
537
|
-
exportAs: string;
|
|
538
|
-
};
|
|
539
|
-
logger?: Logger;
|
|
540
|
-
meta?: FileMetaBase;
|
|
541
|
-
};
|
|
542
|
-
type WriteFilesProps = {
|
|
543
|
-
root: Config['root'];
|
|
544
|
-
extension?: Record<Extname, Extname | ''>;
|
|
545
|
-
logger?: Logger;
|
|
546
|
-
dryRun?: boolean;
|
|
547
|
-
};
|
|
548
|
-
declare class FileManager {
|
|
549
|
-
#private;
|
|
550
|
-
constructor();
|
|
551
|
-
add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
|
|
552
|
-
getByPath(path: Path): Promise<ResolvedFile | null>;
|
|
553
|
-
deleteByPath(path: Path): Promise<void>;
|
|
554
|
-
clear(): Promise<void>;
|
|
555
|
-
getFiles(): Promise<Array<ResolvedFile>>;
|
|
556
|
-
processFiles({
|
|
557
|
-
dryRun,
|
|
558
|
-
root,
|
|
559
|
-
extension,
|
|
560
|
-
logger
|
|
561
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
562
|
-
getBarrelFiles({
|
|
563
|
-
type,
|
|
564
|
-
meta,
|
|
565
|
-
root,
|
|
566
|
-
output,
|
|
567
|
-
logger
|
|
568
|
-
}: AddIndexesProps): Promise<File[]>;
|
|
569
|
-
static getMode(path: string | undefined | null): Mode;
|
|
570
|
-
}
|
|
571
|
-
//#endregion
|
|
572
520
|
//#region ../core/src/PluginManager.d.ts
|
|
573
521
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
574
522
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
@@ -607,6 +555,9 @@ type GetFileProps<TOptions$1 = object> = {
|
|
|
607
555
|
declare class PluginManager {
|
|
608
556
|
#private;
|
|
609
557
|
readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
|
|
558
|
+
/**
|
|
559
|
+
* @deprecated do not use from pluginManager
|
|
560
|
+
*/
|
|
610
561
|
readonly fileManager: FileManager;
|
|
611
562
|
readonly events: EventEmitter<Events>;
|
|
612
563
|
readonly config: Config;
|
|
@@ -715,6 +666,11 @@ declare class PluginManager {
|
|
|
715
666
|
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
716
667
|
}
|
|
717
668
|
//#endregion
|
|
669
|
+
//#region ../core/src/FileManager.d.ts
|
|
670
|
+
type FileMetaBase = {
|
|
671
|
+
pluginKey?: Plugin['key'];
|
|
672
|
+
};
|
|
673
|
+
//#endregion
|
|
718
674
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
719
675
|
type SchemaKeywordMapper = {
|
|
720
676
|
object: {
|
|
@@ -1379,4 +1335,4 @@ type ResolvedOptions = {
|
|
|
1379
1335
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1380
1336
|
//#endregion
|
|
1381
1337
|
export { OperationSchemas as a, Generator as i, PluginSolidQuery as n, UserPluginWithLifeCycle as o, Transformer as r, Operation$1 as s, Options$1 as t };
|
|
1382
|
-
//# sourceMappingURL=types-
|
|
1338
|
+
//# sourceMappingURL=types-CwHqWpPi.d.cts.map
|
|
@@ -5,6 +5,7 @@ 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 { FileManager } from "@kubb/fabric-core";
|
|
8
9
|
|
|
9
10
|
//#region ../oas/src/types.d.ts
|
|
10
11
|
type contentType = 'application/json' | (string & {});
|
|
@@ -220,8 +221,6 @@ type Logger = {
|
|
|
220
221
|
//#endregion
|
|
221
222
|
//#region ../core/src/utils/types.d.ts
|
|
222
223
|
type PossiblePromise<T$1> = Promise<T$1> | T$1;
|
|
223
|
-
type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
|
|
224
|
-
type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
|
|
225
224
|
//#endregion
|
|
226
225
|
//#region ../core/src/types.d.ts
|
|
227
226
|
type InputPath = {
|
|
@@ -464,6 +463,9 @@ type ResolveNameParams = {
|
|
|
464
463
|
};
|
|
465
464
|
type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
466
465
|
config: Config;
|
|
466
|
+
/**
|
|
467
|
+
* @deprecated
|
|
468
|
+
*/
|
|
467
469
|
fileManager: FileManager;
|
|
468
470
|
pluginManager: PluginManager;
|
|
469
471
|
addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
|
|
@@ -515,60 +517,6 @@ type Group = {
|
|
|
515
517
|
name?: (context: GroupContext) => string;
|
|
516
518
|
};
|
|
517
519
|
//#endregion
|
|
518
|
-
//#region ../core/src/FileManager.d.ts
|
|
519
|
-
type FileMetaBase = {
|
|
520
|
-
pluginKey?: Plugin['key'];
|
|
521
|
-
};
|
|
522
|
-
type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
|
|
523
|
-
type AddIndexesProps = {
|
|
524
|
-
type: BarrelType | false | undefined;
|
|
525
|
-
/**
|
|
526
|
-
* Root based on root and output.path specified in the config
|
|
527
|
-
*/
|
|
528
|
-
root: string;
|
|
529
|
-
/**
|
|
530
|
-
* Output for plugin
|
|
531
|
-
*/
|
|
532
|
-
output: {
|
|
533
|
-
path: string;
|
|
534
|
-
};
|
|
535
|
-
group?: {
|
|
536
|
-
output: string;
|
|
537
|
-
exportAs: string;
|
|
538
|
-
};
|
|
539
|
-
logger?: Logger;
|
|
540
|
-
meta?: FileMetaBase;
|
|
541
|
-
};
|
|
542
|
-
type WriteFilesProps = {
|
|
543
|
-
root: Config['root'];
|
|
544
|
-
extension?: Record<Extname, Extname | ''>;
|
|
545
|
-
logger?: Logger;
|
|
546
|
-
dryRun?: boolean;
|
|
547
|
-
};
|
|
548
|
-
declare class FileManager {
|
|
549
|
-
#private;
|
|
550
|
-
constructor();
|
|
551
|
-
add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
|
|
552
|
-
getByPath(path: Path): Promise<ResolvedFile | null>;
|
|
553
|
-
deleteByPath(path: Path): Promise<void>;
|
|
554
|
-
clear(): Promise<void>;
|
|
555
|
-
getFiles(): Promise<Array<ResolvedFile>>;
|
|
556
|
-
processFiles({
|
|
557
|
-
dryRun,
|
|
558
|
-
root,
|
|
559
|
-
extension,
|
|
560
|
-
logger
|
|
561
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
562
|
-
getBarrelFiles({
|
|
563
|
-
type,
|
|
564
|
-
meta,
|
|
565
|
-
root,
|
|
566
|
-
output,
|
|
567
|
-
logger
|
|
568
|
-
}: AddIndexesProps): Promise<File[]>;
|
|
569
|
-
static getMode(path: string | undefined | null): Mode;
|
|
570
|
-
}
|
|
571
|
-
//#endregion
|
|
572
520
|
//#region ../core/src/PluginManager.d.ts
|
|
573
521
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
574
522
|
type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
|
|
@@ -607,6 +555,9 @@ type GetFileProps<TOptions$1 = object> = {
|
|
|
607
555
|
declare class PluginManager {
|
|
608
556
|
#private;
|
|
609
557
|
readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
|
|
558
|
+
/**
|
|
559
|
+
* @deprecated do not use from pluginManager
|
|
560
|
+
*/
|
|
610
561
|
readonly fileManager: FileManager;
|
|
611
562
|
readonly events: EventEmitter<Events>;
|
|
612
563
|
readonly config: Config;
|
|
@@ -715,6 +666,11 @@ declare class PluginManager {
|
|
|
715
666
|
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
|
|
716
667
|
}
|
|
717
668
|
//#endregion
|
|
669
|
+
//#region ../core/src/FileManager.d.ts
|
|
670
|
+
type FileMetaBase = {
|
|
671
|
+
pluginKey?: Plugin['key'];
|
|
672
|
+
};
|
|
673
|
+
//#endregion
|
|
718
674
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
719
675
|
type SchemaKeywordMapper = {
|
|
720
676
|
object: {
|
|
@@ -1379,4 +1335,4 @@ type ResolvedOptions = {
|
|
|
1379
1335
|
type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options$1, ResolvedOptions, never, ResolvePathOptions>;
|
|
1380
1336
|
//#endregion
|
|
1381
1337
|
export { OperationSchemas as a, Generator as i, PluginSolidQuery as n, UserPluginWithLifeCycle as o, Transformer as r, Operation$1 as s, Options$1 as t };
|
|
1382
|
-
//# sourceMappingURL=types-
|
|
1338
|
+
//# sourceMappingURL=types-DGARY9Er.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-solid-query",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Solid Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Solid.js applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"solid-query",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"remeda": "^2.32.0",
|
|
65
|
-
"@kubb/core": "4.2.
|
|
66
|
-
"@kubb/oas": "4.2.
|
|
67
|
-
"@kubb/plugin-client": "4.2.
|
|
68
|
-
"@kubb/plugin-oas": "4.2.
|
|
69
|
-
"@kubb/plugin-ts": "4.2.
|
|
70
|
-
"@kubb/plugin-zod": "4.2.
|
|
71
|
-
"@kubb/react": "4.2.
|
|
65
|
+
"@kubb/core": "4.2.1",
|
|
66
|
+
"@kubb/oas": "4.2.1",
|
|
67
|
+
"@kubb/plugin-client": "4.2.1",
|
|
68
|
+
"@kubb/plugin-oas": "4.2.1",
|
|
69
|
+
"@kubb/plugin-ts": "4.2.1",
|
|
70
|
+
"@kubb/plugin-zod": "4.2.1",
|
|
71
|
+
"@kubb/react": "4.2.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"tsdown": "^0.15.9",
|
package/src/plugin.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from 'node:path'
|
|
2
|
-
import type
|
|
3
|
-
import { createPlugin, FileManager, type Group, PluginManager } from '@kubb/core'
|
|
2
|
+
import { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'
|
|
4
3
|
import { camelCase, pascalCase } from '@kubb/core/transformers'
|
|
5
4
|
import type { PluginOas } from '@kubb/plugin-oas'
|
|
6
5
|
import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
|
|
@@ -66,7 +65,7 @@ export const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {
|
|
|
66
65
|
pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
|
|
67
66
|
resolvePath(baseName, pathMode, options) {
|
|
68
67
|
const root = path.resolve(this.config.root, this.config.output.path)
|
|
69
|
-
const mode = pathMode ??
|
|
68
|
+
const mode = pathMode ?? getMode(path.resolve(root, output.path))
|
|
70
69
|
|
|
71
70
|
if (mode === 'single') {
|
|
72
71
|
/**
|
|
@@ -121,7 +120,7 @@ export const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {
|
|
|
121
120
|
|
|
122
121
|
const oas = await swaggerPlugin.context.getOas()
|
|
123
122
|
const root = path.resolve(this.config.root, this.config.output.path)
|
|
124
|
-
const mode =
|
|
123
|
+
const mode = getMode(path.resolve(root, output.path))
|
|
125
124
|
const baseURL = await swaggerPlugin.context.getBaseURL()
|
|
126
125
|
|
|
127
126
|
if (baseURL) {
|
|
@@ -142,7 +141,7 @@ export const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {
|
|
|
142
141
|
const files = await operationGenerator.build(...generators)
|
|
143
142
|
await this.addFile(...files)
|
|
144
143
|
|
|
145
|
-
const barrelFiles = await this.fileManager.
|
|
144
|
+
const barrelFiles = await getBarrelFiles(this.fileManager.files, {
|
|
146
145
|
type: output.barrelType ?? 'named',
|
|
147
146
|
root,
|
|
148
147
|
output,
|