@kubb/plugin-solid-query 3.4.5 → 3.5.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.
@@ -0,0 +1,150 @@
1
+ import { QueryKey, Client, QueryOptions, Query } from './chunk-YSBWW5N6.js';
2
+ import { createReactGenerator } from '@kubb/plugin-oas';
3
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks';
4
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils';
5
+ import { pluginTsName } from '@kubb/plugin-ts';
6
+ import { pluginZodName } from '@kubb/plugin-zod';
7
+ import { useApp, File } from '@kubb/react';
8
+ import { difference } from 'remeda';
9
+ import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
10
+
11
+ var queryGenerator = createReactGenerator({
12
+ name: "svelte-query",
13
+ Operation({ options, operation }) {
14
+ const {
15
+ plugin: {
16
+ options: { output }
17
+ }
18
+ } = useApp();
19
+ const oas = useOas();
20
+ const { getSchemas, getName, getFile } = useOperationManager();
21
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
22
+ const isMutation = difference(["post", "put", "delete", "patch"], options.query ? options.query.methods : []).some((method) => operation.method === method);
23
+ const importPath = options.query ? options.query.importPath : "@tanstack/solid-query";
24
+ const query = {
25
+ name: getName(operation, { type: "function", prefix: "create" }),
26
+ typeName: getName(operation, { type: "type" }),
27
+ file: getFile(operation, { prefix: "create" })
28
+ };
29
+ const client = {
30
+ name: getName(operation, { type: "function" })
31
+ };
32
+ const queryOptions = {
33
+ name: getName(operation, { type: "function", suffix: "QueryOptions" })
34
+ };
35
+ const queryKey = {
36
+ name: getName(operation, { type: "const", suffix: "QueryKey" }),
37
+ typeName: getName(operation, { type: "type", suffix: "QueryKey" })
38
+ };
39
+ const type = {
40
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
41
+ //todo remove type?
42
+ schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
43
+ };
44
+ const zod = {
45
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
46
+ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
47
+ };
48
+ if (!isQuery || isMutation) {
49
+ return null;
50
+ }
51
+ return /* @__PURE__ */ jsxs(
52
+ File,
53
+ {
54
+ baseName: query.file.baseName,
55
+ path: query.file.path,
56
+ meta: query.file.meta,
57
+ banner: getBanner({ oas, output }),
58
+ footer: getFooter({ oas, output }),
59
+ children: [
60
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
61
+ /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
62
+ /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
63
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
64
+ /* @__PURE__ */ jsx(
65
+ File.Import,
66
+ {
67
+ name: [
68
+ type.schemas.request?.name,
69
+ type.schemas.response.name,
70
+ type.schemas.pathParams?.name,
71
+ type.schemas.queryParams?.name,
72
+ type.schemas.headerParams?.name,
73
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
74
+ ].filter(Boolean),
75
+ root: query.file.path,
76
+ path: type.file.path,
77
+ isTypeOnly: true
78
+ }
79
+ ),
80
+ /* @__PURE__ */ jsx(
81
+ QueryKey,
82
+ {
83
+ name: queryKey.name,
84
+ typeName: queryKey.typeName,
85
+ operation,
86
+ paramsCasing: options.paramsCasing,
87
+ pathParamsType: options.pathParamsType,
88
+ typeSchemas: type.schemas,
89
+ transformer: options.queryKey
90
+ }
91
+ ),
92
+ /* @__PURE__ */ jsx(
93
+ Client,
94
+ {
95
+ name: client.name,
96
+ isExportable: false,
97
+ isIndexable: false,
98
+ baseURL: options.client.baseURL,
99
+ operation,
100
+ typeSchemas: type.schemas,
101
+ zodSchemas: zod.schemas,
102
+ dataReturnType: options.client.dataReturnType,
103
+ paramsCasing: options.paramsCasing,
104
+ paramsType: options.paramsType,
105
+ pathParamsType: options.pathParamsType,
106
+ parser: options.parser
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsx(File.Import, { name: ["queryOptions"], path: importPath }),
110
+ /* @__PURE__ */ jsx(
111
+ QueryOptions,
112
+ {
113
+ name: queryOptions.name,
114
+ clientName: client.name,
115
+ queryKeyName: queryKey.name,
116
+ typeSchemas: type.schemas,
117
+ paramsCasing: options.paramsCasing,
118
+ paramsType: options.paramsType,
119
+ pathParamsType: options.pathParamsType,
120
+ dataReturnType: options.client.dataReturnType
121
+ }
122
+ ),
123
+ options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
124
+ /* @__PURE__ */ jsx(File.Import, { name: ["createQuery"], path: importPath }),
125
+ /* @__PURE__ */ jsx(File.Import, { name: ["QueryKey", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
126
+ /* @__PURE__ */ jsx(
127
+ Query,
128
+ {
129
+ name: query.name,
130
+ queryOptionsName: queryOptions.name,
131
+ typeSchemas: type.schemas,
132
+ paramsType: options.paramsType,
133
+ pathParamsType: options.pathParamsType,
134
+ operation,
135
+ paramsCasing: options.paramsCasing,
136
+ dataReturnType: options.client.dataReturnType,
137
+ queryKeyName: queryKey.name,
138
+ queryKeyTypeName: queryKey.typeName
139
+ }
140
+ )
141
+ ] })
142
+ ]
143
+ }
144
+ );
145
+ }
146
+ });
147
+
148
+ export { queryGenerator };
149
+ //# sourceMappingURL=chunk-EFGMRFAB.js.map
150
+ //# sourceMappingURL=chunk-EFGMRFAB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generators/queryGenerator.tsx"],"names":[],"mappings":";;;;;;;;;;AAWO,IAAM,iBAAiB,oBAAuC,CAAA;AAAA,EACnE,IAAM,EAAA,cAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA,EAAa,E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gB,OAAQ,CAAA,cAAA;AAAA,cACxB,cAAA,EAAgB,QAAQ,MAAO,CAAA;AAAA;AAAA,WACjC;AAAA,UACC,OAAA,CAAQ,yBAEL,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,CAAK,QAAL,EAAY,IAAA,EAAM,CAAC,aAAa,CAAA,EAAG,MAAM,UAAY,EAAA,CAAA;AAAA,4BACrD,GAAA,CAAA,IAAA,CAAK,MAAL,EAAA,EAAY,IAAM,EAAA,CAAC,UAAY,EAAA,wBAAA,EAA0B,mBAAmB,CAAA,EAAG,IAAM,EAAA,UAAA,EAAY,YAAU,IAAC,EAAA,CAAA;AAAA,4BAC7G,GAAA;AAAA,cAAC,KAAA;AAAA,cAAA;AAAA,gBACC,MAAM,KAAM,CAAA,IAAA;AAAA,gBACZ,kBAAkB,YAAa,CAAA,IAAA;AAAA,gBAC/B,aAAa,IAAK,CAAA,OAAA;AAAA,gBAClB,YAAY,OAAQ,CAAA,UAAA;AAAA,gBACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,gBACxB,SAAA;AAAA,gBACA,cAAc,OAAQ,CAAA,YAAA;AAAA,gBACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,gBAC/B,cAAc,QAAS,CAAA,IAAA;AAAA,gBACvB,kBAAkB,QAAS,CAAA;AAAA;AAAA;AAC7B,WACF,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN,CAAC","file":"chunk-EFGMRFAB.js","sourcesContent":["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSolidQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ var chunkTANPGO3X_cjs = require('./chunk-TANPGO3X.cjs');
4
+ var pluginOas = require('@kubb/plugin-oas');
5
+ var hooks = require('@kubb/plugin-oas/hooks');
6
+ var utils = require('@kubb/plugin-oas/utils');
7
+ var pluginTs = require('@kubb/plugin-ts');
8
+ var pluginZod = require('@kubb/plugin-zod');
9
+ var react = require('@kubb/react');
10
+ var remeda = require('remeda');
11
+ var jsxRuntime = require('@kubb/react/jsx-runtime');
12
+
13
+ var queryGenerator = pluginOas.createReactGenerator({
14
+ name: "svelte-query",
15
+ Operation({ options, operation }) {
16
+ const {
17
+ plugin: {
18
+ options: { output }
19
+ }
20
+ } = react.useApp();
21
+ const oas = hooks.useOas();
22
+ const { getSchemas, getName, getFile } = hooks.useOperationManager();
23
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
24
+ const isMutation = remeda.difference(["post", "put", "delete", "patch"], options.query ? options.query.methods : []).some((method) => operation.method === method);
25
+ const importPath = options.query ? options.query.importPath : "@tanstack/solid-query";
26
+ const query = {
27
+ name: getName(operation, { type: "function", prefix: "create" }),
28
+ typeName: getName(operation, { type: "type" }),
29
+ file: getFile(operation, { prefix: "create" })
30
+ };
31
+ const client = {
32
+ name: getName(operation, { type: "function" })
33
+ };
34
+ const queryOptions = {
35
+ name: getName(operation, { type: "function", suffix: "QueryOptions" })
36
+ };
37
+ const queryKey = {
38
+ name: getName(operation, { type: "const", suffix: "QueryKey" }),
39
+ typeName: getName(operation, { type: "type", suffix: "QueryKey" })
40
+ };
41
+ const type = {
42
+ file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
43
+ //todo remove type?
44
+ schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
45
+ };
46
+ const zod = {
47
+ file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
48
+ schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
49
+ };
50
+ if (!isQuery || isMutation) {
51
+ return null;
52
+ }
53
+ return /* @__PURE__ */ jsxRuntime.jsxs(
54
+ react.File,
55
+ {
56
+ baseName: query.file.baseName,
57
+ path: query.file.path,
58
+ meta: query.file.meta,
59
+ banner: utils.getBanner({ oas, output }),
60
+ footer: utils.getFooter({ oas, output }),
61
+ children: [
62
+ options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
63
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
64
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
65
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
66
+ /* @__PURE__ */ jsxRuntime.jsx(
67
+ react.File.Import,
68
+ {
69
+ name: [
70
+ type.schemas.request?.name,
71
+ type.schemas.response.name,
72
+ type.schemas.pathParams?.name,
73
+ type.schemas.queryParams?.name,
74
+ type.schemas.headerParams?.name,
75
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
76
+ ].filter(Boolean),
77
+ root: query.file.path,
78
+ path: type.file.path,
79
+ isTypeOnly: true
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsxRuntime.jsx(
83
+ chunkTANPGO3X_cjs.QueryKey,
84
+ {
85
+ name: queryKey.name,
86
+ typeName: queryKey.typeName,
87
+ operation,
88
+ paramsCasing: options.paramsCasing,
89
+ pathParamsType: options.pathParamsType,
90
+ typeSchemas: type.schemas,
91
+ transformer: options.queryKey
92
+ }
93
+ ),
94
+ /* @__PURE__ */ jsxRuntime.jsx(
95
+ chunkTANPGO3X_cjs.Client,
96
+ {
97
+ name: client.name,
98
+ isExportable: false,
99
+ isIndexable: false,
100
+ baseURL: options.client.baseURL,
101
+ operation,
102
+ typeSchemas: type.schemas,
103
+ zodSchemas: zod.schemas,
104
+ dataReturnType: options.client.dataReturnType,
105
+ paramsCasing: options.paramsCasing,
106
+ paramsType: options.paramsType,
107
+ pathParamsType: options.pathParamsType,
108
+ parser: options.parser
109
+ }
110
+ ),
111
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
112
+ /* @__PURE__ */ jsxRuntime.jsx(
113
+ chunkTANPGO3X_cjs.QueryOptions,
114
+ {
115
+ name: queryOptions.name,
116
+ clientName: client.name,
117
+ queryKeyName: queryKey.name,
118
+ typeSchemas: type.schemas,
119
+ paramsCasing: options.paramsCasing,
120
+ paramsType: options.paramsType,
121
+ pathParamsType: options.pathParamsType,
122
+ dataReturnType: options.client.dataReturnType
123
+ }
124
+ ),
125
+ options.query && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
126
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["createQuery"], path: importPath }),
127
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
128
+ /* @__PURE__ */ jsxRuntime.jsx(
129
+ chunkTANPGO3X_cjs.Query,
130
+ {
131
+ name: query.name,
132
+ queryOptionsName: queryOptions.name,
133
+ typeSchemas: type.schemas,
134
+ paramsType: options.paramsType,
135
+ pathParamsType: options.pathParamsType,
136
+ operation,
137
+ paramsCasing: options.paramsCasing,
138
+ dataReturnType: options.client.dataReturnType,
139
+ queryKeyName: queryKey.name,
140
+ queryKeyTypeName: queryKey.typeName
141
+ }
142
+ )
143
+ ] })
144
+ ]
145
+ }
146
+ );
147
+ }
148
+ });
149
+
150
+ exports.queryGenerator = queryGenerator;
151
+ //# sourceMappingURL=chunk-RPKXS43P.cjs.map
152
+ //# sourceMappingURL=chunk-RPKXS43P.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generators/queryGenerator.tsx"],"names":["createReactGenerator","useApp","useOas","useOperationManager","difference","pluginTsName","pluginZodName","jsxs","File","getBanner","getFooter","jsx","QueryKey","Client","QueryOptions","Fragment","Query"],"mappings":";;;;;;;;;;;;AAWO,IAAM,iBAAiBA,8BAAuC,CAAA;AAAA,EACnE,IAAM,EAAA,cAAA;AAA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B,cAAc,OAAQ,CAAA,YAAA;AAAA,cACtB,YAAY,OAAQ,CAAA,UAAA;AAAA,cACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,cACxB,cAAA,EAAgB,QAAQ,MAAO,CAAA;AAAA;AAAA,WACjC;AAAA,UACC,OAAA,CAAQ,yBAELP,eAAA,CAAAQ,mBAAA,EAAA,EAAA,QAAA,EAAA;AAAA,4BAACJ,cAAA,CAAAH,UAAA,CAAK,QAAL,EAAY,IAAA,EAAM,CAAC,aAAa,CAAA,EAAG,MAAM,UAAY,EAAA,CAAA;AAAA,4BACrDG,cAAA,CAAAH,UAAA,CAAK,MAAL,EAAA,EAAY,IAAM,EAAA,CAAC,UAAY,EAAA,wBAAA,EAA0B,mBAAmB,CAAA,EAAG,IAAM,EAAA,UAAA,EAAY,YAAU,IAAC,EAAA,CAAA;AAAA,4BAC7GG,cAAA;AAAA,cAACK,uBAAA;AAAA,cAAA;AAAA,gBACC,MAAM,KAAM,CAAA,IAAA;AAAA,gBACZ,kBAAkB,YAAa,CAAA,IAAA;AAAA,gBAC/B,aAAa,IAAK,CAAA,OAAA;AAAA,gBAClB,YAAY,OAAQ,CAAA,UAAA;AAAA,gBACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,gBACxB,SAAA;AAAA,gBACA,cAAc,OAAQ,CAAA,YAAA;AAAA,gBACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,gBAC/B,cAAc,QAAS,CAAA,IAAA;AAAA,gBACvB,kBAAkB,QAAS,CAAA;AAAA;AAAA;AAC7B,WACF,EAAA;AAAA;AAAA;AAAA,KAEJ;AAAA;AAGN,CAAC","file":"chunk-RPKXS43P.cjs","sourcesContent":["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSolidQuery>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}
@@ -2,7 +2,7 @@ import { FunctionParams } from '@kubb/react';
2
2
  import { Operation } from '@kubb/oas';
3
3
  import { OperationSchemas } from '@kubb/plugin-oas';
4
4
  import { ReactNode } from 'react';
5
- import { P as PluginSolidQuery, T as Transformer } from './types-CkeKuWIN.cjs';
5
+ import { P as PluginSolidQuery, T as Transformer } from './types-BXsh-RxZ.cjs';
6
6
  import '@kubb/core';
7
7
 
8
8
  type Props$2 = {
@@ -2,7 +2,7 @@ import { FunctionParams } from '@kubb/react';
2
2
  import { Operation } from '@kubb/oas';
3
3
  import { OperationSchemas } from '@kubb/plugin-oas';
4
4
  import { ReactNode } from 'react';
5
- import { P as PluginSolidQuery, T as Transformer } from './types-CkeKuWIN.js';
5
+ import { P as PluginSolidQuery, T as Transformer } from './types-BXsh-RxZ.js';
6
6
  import '@kubb/core';
7
7
 
8
8
  type Props$2 = {
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkNVJDF3YS_cjs = require('./chunk-NVJDF3YS.cjs');
3
+ var chunkRPKXS43P_cjs = require('./chunk-RPKXS43P.cjs');
4
4
  require('./chunk-TANPGO3X.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "queryGenerator", {
9
9
  enumerable: true,
10
- get: function () { return chunkNVJDF3YS_cjs.queryGenerator; }
10
+ get: function () { return chunkRPKXS43P_cjs.queryGenerator; }
11
11
  });
12
12
  //# sourceMappingURL=generators.cjs.map
13
13
  //# sourceMappingURL=generators.cjs.map
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginSolidQuery } from './types-CkeKuWIN.cjs';
2
+ import { P as PluginSolidQuery } from './types-BXsh-RxZ.cjs';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginSolidQuery } from './types-CkeKuWIN.js';
2
+ import { P as PluginSolidQuery } from './types-BXsh-RxZ.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,4 +1,4 @@
1
- export { queryGenerator } from './chunk-TNFZGXIE.js';
1
+ export { queryGenerator } from './chunk-EFGMRFAB.js';
2
2
  import './chunk-YSBWW5N6.js';
3
3
  //# sourceMappingURL=generators.js.map
4
4
  //# sourceMappingURL=generators.js.map
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNVJDF3YS_cjs = require('./chunk-NVJDF3YS.cjs');
3
+ var chunkRPKXS43P_cjs = require('./chunk-RPKXS43P.cjs');
4
4
  var chunkTANPGO3X_cjs = require('./chunk-TANPGO3X.cjs');
5
5
  var path = require('path');
6
6
  var core = require('@kubb/core');
@@ -26,7 +26,7 @@ var pluginSolidQuery = core.createPlugin((options) => {
26
26
  paramsType = "inline",
27
27
  pathParamsType = "inline",
28
28
  queryKey = chunkTANPGO3X_cjs.QueryKey.getTransformer,
29
- generators = [chunkNVJDF3YS_cjs.queryGenerator].filter(Boolean),
29
+ generators = [chunkRPKXS43P_cjs.queryGenerator].filter(Boolean),
30
30
  query = {},
31
31
  paramsCasing
32
32
  } = options;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginSolidQuery } from './types-CkeKuWIN.cjs';
2
+ import { O as Options, P as PluginSolidQuery } from './types-BXsh-RxZ.cjs';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginSolidQuery } from './types-CkeKuWIN.js';
2
+ import { O as Options, P as PluginSolidQuery } from './types-BXsh-RxZ.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { queryGenerator } from './chunk-TNFZGXIE.js';
1
+ import { queryGenerator } from './chunk-EFGMRFAB.js';
2
2
  import { QueryKey } from './chunk-YSBWW5N6.js';
3
3
  import path from 'node:path';
4
4
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
@@ -1,5 +1,5 @@
1
1
  import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { HttpMethod, Operation } from '@kubb/oas';
2
+ import { Oas, HttpMethod, Operation } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
4
 
5
5
  type Options$2 = {
@@ -7,7 +7,7 @@ type Options$2 = {
7
7
  * Specify the export location for the files and define the behavior of the output
8
8
  * @default { path: 'clients', barrelType: 'named' }
9
9
  */
10
- output?: Output;
10
+ output?: Output<Oas>;
11
11
  /**
12
12
  * Group the clients based on the provided name.
13
13
  */
@@ -91,7 +91,7 @@ type Options$2 = {
91
91
  generators?: Array<Generator<PluginClient>>;
92
92
  };
93
93
  type ResolvedOptions$2 = {
94
- output: Output;
94
+ output: Output<Oas>;
95
95
  group?: Options$2['group'];
96
96
  baseURL: string | undefined;
97
97
  parser: NonNullable<Options$2['parser']>;
@@ -169,7 +169,7 @@ type Options$1 = {
169
169
  * Specify the export location for the files and define the behavior of the output
170
170
  * @default { path: 'hooks', barrelType: 'named' }
171
171
  */
172
- output?: Output;
172
+ output?: Output<Oas>;
173
173
  /**
174
174
  * Group the @tanstack/query hooks based on the provided name.
175
175
  */
@@ -241,7 +241,7 @@ type Options$1 = {
241
241
  generators?: Array<Generator<PluginReactQuery>>;
242
242
  };
243
243
  type ResolvedOptions$1 = {
244
- output: Output;
244
+ output: Output<Oas>;
245
245
  group: Options$1['group'];
246
246
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
247
247
  baseURL?: string;
@@ -292,7 +292,7 @@ type Options = {
292
292
  * Specify the export location for the files and define the behavior of the output
293
293
  * @default { path: 'hooks', barrelType: 'named' }
294
294
  */
295
- output?: Output;
295
+ output?: Output<Oas>;
296
296
  /**
297
297
  * Group the @tanstack/query hooks based on the provided name.
298
298
  */
@@ -351,7 +351,7 @@ type Options = {
351
351
  generators?: Array<Generator<PluginSolidQuery>>;
352
352
  };
353
353
  type ResolvedOptions = {
354
- output: Output;
354
+ output: Output<Oas>;
355
355
  group: Options['group'];
356
356
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
357
357
  baseURL?: string;
@@ -1,5 +1,5 @@
1
1
  import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { HttpMethod, Operation } from '@kubb/oas';
2
+ import { Oas, HttpMethod, Operation } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
4
 
5
5
  type Options$2 = {
@@ -7,7 +7,7 @@ type Options$2 = {
7
7
  * Specify the export location for the files and define the behavior of the output
8
8
  * @default { path: 'clients', barrelType: 'named' }
9
9
  */
10
- output?: Output;
10
+ output?: Output<Oas>;
11
11
  /**
12
12
  * Group the clients based on the provided name.
13
13
  */
@@ -91,7 +91,7 @@ type Options$2 = {
91
91
  generators?: Array<Generator<PluginClient>>;
92
92
  };
93
93
  type ResolvedOptions$2 = {
94
- output: Output;
94
+ output: Output<Oas>;
95
95
  group?: Options$2['group'];
96
96
  baseURL: string | undefined;
97
97
  parser: NonNullable<Options$2['parser']>;
@@ -169,7 +169,7 @@ type Options$1 = {
169
169
  * Specify the export location for the files and define the behavior of the output
170
170
  * @default { path: 'hooks', barrelType: 'named' }
171
171
  */
172
- output?: Output;
172
+ output?: Output<Oas>;
173
173
  /**
174
174
  * Group the @tanstack/query hooks based on the provided name.
175
175
  */
@@ -241,7 +241,7 @@ type Options$1 = {
241
241
  generators?: Array<Generator<PluginReactQuery>>;
242
242
  };
243
243
  type ResolvedOptions$1 = {
244
- output: Output;
244
+ output: Output<Oas>;
245
245
  group: Options$1['group'];
246
246
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
247
247
  baseURL?: string;
@@ -292,7 +292,7 @@ type Options = {
292
292
  * Specify the export location for the files and define the behavior of the output
293
293
  * @default { path: 'hooks', barrelType: 'named' }
294
294
  */
295
- output?: Output;
295
+ output?: Output<Oas>;
296
296
  /**
297
297
  * Group the @tanstack/query hooks based on the provided name.
298
298
  */
@@ -351,7 +351,7 @@ type Options = {
351
351
  generators?: Array<Generator<PluginSolidQuery>>;
352
352
  };
353
353
  type ResolvedOptions = {
354
- output: Output;
354
+ output: Output<Oas>;
355
355
  group: Options['group'];
356
356
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
357
357
  baseURL?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-solid-query",
3
- "version": "3.4.5",
3
+ "version": "3.5.1",
4
4
  "description": "Generator solid-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -62,22 +62,22 @@
62
62
  "!/**/__tests__/**"
63
63
  ],
64
64
  "dependencies": {
65
- "remeda": "^2.19.0",
66
- "@kubb/core": "3.4.5",
67
- "@kubb/fs": "3.4.5",
68
- "@kubb/oas": "3.4.5",
69
- "@kubb/plugin-oas": "3.4.5",
70
- "@kubb/plugin-ts": "3.4.5",
71
- "@kubb/plugin-zod": "3.4.5",
72
- "@kubb/react": "3.4.5"
65
+ "remeda": "^2.19.1",
66
+ "@kubb/core": "3.5.1",
67
+ "@kubb/fs": "3.5.1",
68
+ "@kubb/oas": "3.5.1",
69
+ "@kubb/plugin-oas": "3.5.1",
70
+ "@kubb/plugin-ts": "3.5.1",
71
+ "@kubb/plugin-zod": "3.5.1",
72
+ "@kubb/react": "3.5.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/react": "^18.3.18",
76
76
  "react": "^18.3.1",
77
77
  "tsup": "^8.3.5",
78
78
  "typescript": "^5.7.3",
79
- "@kubb/config-ts": "3.4.5",
80
- "@kubb/config-tsup": "3.4.5"
79
+ "@kubb/config-ts": "3.5.1",
80
+ "@kubb/config-tsup": "3.5.1"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@kubb/react": "^3.0.0"
@@ -1,6 +1,7 @@
1
1
  import { Client } from '@kubb/plugin-client/components'
2
2
  import { createReactGenerator } from '@kubb/plugin-oas'
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
+ import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
4
+ import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
4
5
  import { pluginTsName } from '@kubb/plugin-ts'
5
6
  import { pluginZodName } from '@kubb/plugin-zod'
6
7
  import { File, useApp } from '@kubb/react'
@@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator<PluginSolidQuery>({
16
17
  options: { output },
17
18
  },
18
19
  } = useApp<PluginSolidQuery>()
20
+ const oas = useOas()
19
21
  const { getSchemas, getName, getFile } = useOperationManager()
20
22
 
21
23
  const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
@@ -57,7 +59,13 @@ export const queryGenerator = createReactGenerator<PluginSolidQuery>({
57
59
  }
58
60
 
59
61
  return (
60
- <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
62
+ <File
63
+ baseName={query.file.baseName}
64
+ path={query.file.path}
65
+ meta={query.file.meta}
66
+ banner={getBanner({ oas, output })}
67
+ footer={getFooter({ oas, output })}
68
+ >
61
69
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
62
70
  <File.Import name={'client'} path={options.client.importPath} />
63
71
  <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
2
 
3
- import type { HttpMethod, Operation } from '@kubb/oas'
3
+ import type { HttpMethod, Oas, Operation } from '@kubb/oas'
4
4
  import type { PluginClient } from '@kubb/plugin-client'
5
5
  import type { Exclude, Generator, Include, OperationSchemas, Override, ResolvePathOptions } from '@kubb/plugin-oas'
6
6
  import type { PluginReactQuery } from '@kubb/plugin-react-query'
@@ -39,7 +39,7 @@ export type Options = {
39
39
  * Specify the export location for the files and define the behavior of the output
40
40
  * @default { path: 'hooks', barrelType: 'named' }
41
41
  */
42
- output?: Output
42
+ output?: Output<Oas>
43
43
  /**
44
44
  * Group the @tanstack/query hooks based on the provided name.
45
45
  */
@@ -100,7 +100,7 @@ export type Options = {
100
100
  }
101
101
 
102
102
  type ResolvedOptions = {
103
- output: Output
103
+ output: Output<Oas>
104
104
  group: Options['group']
105
105
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
106
106
  parser: Required<NonNullable<Options['parser']>>
@@ -1,140 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkTANPGO3X_cjs = require('./chunk-TANPGO3X.cjs');
4
- var pluginOas = require('@kubb/plugin-oas');
5
- var hooks = require('@kubb/plugin-oas/hooks');
6
- var pluginTs = require('@kubb/plugin-ts');
7
- var pluginZod = require('@kubb/plugin-zod');
8
- var react = require('@kubb/react');
9
- var remeda = require('remeda');
10
- var jsxRuntime = require('@kubb/react/jsx-runtime');
11
-
12
- var queryGenerator = pluginOas.createReactGenerator({
13
- name: "svelte-query",
14
- Operation({ options, operation }) {
15
- const {
16
- plugin: {
17
- options: { output }
18
- }
19
- } = react.useApp();
20
- const { getSchemas, getName, getFile } = hooks.useOperationManager();
21
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
22
- const isMutation = remeda.difference(["post", "put", "delete", "patch"], options.query ? options.query.methods : []).some((method) => operation.method === method);
23
- const importPath = options.query ? options.query.importPath : "@tanstack/solid-query";
24
- const query = {
25
- name: getName(operation, { type: "function", prefix: "create" }),
26
- typeName: getName(operation, { type: "type" }),
27
- file: getFile(operation, { prefix: "create" })
28
- };
29
- const client = {
30
- name: getName(operation, { type: "function" })
31
- };
32
- const queryOptions = {
33
- name: getName(operation, { type: "function", suffix: "QueryOptions" })
34
- };
35
- const queryKey = {
36
- name: getName(operation, { type: "const", suffix: "QueryKey" }),
37
- typeName: getName(operation, { type: "type", suffix: "QueryKey" })
38
- };
39
- const type = {
40
- file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
41
- //todo remove type?
42
- schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
43
- };
44
- const zod = {
45
- file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
46
- schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
47
- };
48
- if (!isQuery || isMutation) {
49
- return null;
50
- }
51
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
52
- options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
53
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
54
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
55
- options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
56
- /* @__PURE__ */ jsxRuntime.jsx(
57
- react.File.Import,
58
- {
59
- name: [
60
- type.schemas.request?.name,
61
- type.schemas.response.name,
62
- type.schemas.pathParams?.name,
63
- type.schemas.queryParams?.name,
64
- type.schemas.headerParams?.name,
65
- ...type.schemas.statusCodes?.map((item) => item.name) || []
66
- ].filter(Boolean),
67
- root: query.file.path,
68
- path: type.file.path,
69
- isTypeOnly: true
70
- }
71
- ),
72
- /* @__PURE__ */ jsxRuntime.jsx(
73
- chunkTANPGO3X_cjs.QueryKey,
74
- {
75
- name: queryKey.name,
76
- typeName: queryKey.typeName,
77
- operation,
78
- paramsCasing: options.paramsCasing,
79
- pathParamsType: options.pathParamsType,
80
- typeSchemas: type.schemas,
81
- transformer: options.queryKey
82
- }
83
- ),
84
- /* @__PURE__ */ jsxRuntime.jsx(
85
- chunkTANPGO3X_cjs.Client,
86
- {
87
- name: client.name,
88
- isExportable: false,
89
- isIndexable: false,
90
- baseURL: options.client.baseURL,
91
- operation,
92
- typeSchemas: type.schemas,
93
- zodSchemas: zod.schemas,
94
- dataReturnType: options.client.dataReturnType,
95
- paramsCasing: options.paramsCasing,
96
- paramsType: options.paramsType,
97
- pathParamsType: options.pathParamsType,
98
- parser: options.parser
99
- }
100
- ),
101
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
102
- /* @__PURE__ */ jsxRuntime.jsx(
103
- chunkTANPGO3X_cjs.QueryOptions,
104
- {
105
- name: queryOptions.name,
106
- clientName: client.name,
107
- queryKeyName: queryKey.name,
108
- typeSchemas: type.schemas,
109
- paramsCasing: options.paramsCasing,
110
- paramsType: options.paramsType,
111
- pathParamsType: options.pathParamsType,
112
- dataReturnType: options.client.dataReturnType
113
- }
114
- ),
115
- options.query && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
116
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["createQuery"], path: importPath }),
117
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
118
- /* @__PURE__ */ jsxRuntime.jsx(
119
- chunkTANPGO3X_cjs.Query,
120
- {
121
- name: query.name,
122
- queryOptionsName: queryOptions.name,
123
- typeSchemas: type.schemas,
124
- paramsType: options.paramsType,
125
- pathParamsType: options.pathParamsType,
126
- operation,
127
- paramsCasing: options.paramsCasing,
128
- dataReturnType: options.client.dataReturnType,
129
- queryKeyName: queryKey.name,
130
- queryKeyTypeName: queryKey.typeName
131
- }
132
- )
133
- ] })
134
- ] });
135
- }
136
- });
137
-
138
- exports.queryGenerator = queryGenerator;
139
- //# sourceMappingURL=chunk-NVJDF3YS.cjs.map
140
- //# sourceMappingURL=chunk-NVJDF3YS.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/generators/queryGenerator.tsx"],"names":["createReactGenerator","useApp","useOperationManager","difference","pluginTsName","pluginZodName","File","jsx","QueryKey","Client","QueryOptions","jsxs","Fragment","Query"],"mappings":";;;;;;;;;;;AAUO,IAAM,iBAAiBA,8BAAuC,CAAA;AAAA,EACnE,IAAM,EAAA,cAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA,EAAa,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,OAAA,EAAS,EAAE,MAAO;AAAA;AACpB,QACEC,YAAyB,EAAA;AAC7B,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAYC,yBAAoB,EAAA;AAE7D,IAAA,MAAM,OAAU,GAAA,OAAO,OAAQ,CAAA,KAAA,KAAU,YAAY,IAAO,GAAA,OAAA,CAAQ,KAAO,EAAA,OAAA,CAAQ,IAAK,CAAA,CAAC,MAAW,KAAA,SAAA,CAAU,WAAW,MAAM,CAAA;AAC/H,IAAM,MAAA,UAAA,GAAaC,kBAAW,CAAC,MAAA,EAAQ,OAAO,QAAU,EAAA,OAAO,GAAG,OAAQ,CAAA,KAAA,GAAQ,QAAQ,KAAM,CAAA,OAAA,GAAU,EAAE,CAAA,CAAE,KAAK,CAAC,MAAA,KAAW,SAAU,CAAA,MAAA,KAAW,MAAM,CAAA;AAC1J,IAAA,MAAM,UAAa,GAAA,OAAA,CAAQ,KAAQ,GAAA,OAAA,CAAQ,MAAM,UAAa,GAAA,uBAAA;AAE9D,IAAA,MAAM,KAAQ,GAAA;AAAA,MACZ,IAAA,EAAM,QAAQ,SAAW,EAAA,EAAE,MAAM,UAAY,EAAA,MAAA,EAAQ,UAAU,CAAA;AAAA,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["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSolidQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}
@@ -1,138 +0,0 @@
1
- import { QueryKey, Client, QueryOptions, Query } from './chunk-YSBWW5N6.js';
2
- import { createReactGenerator } from '@kubb/plugin-oas';
3
- import { useOperationManager } from '@kubb/plugin-oas/hooks';
4
- import { pluginTsName } from '@kubb/plugin-ts';
5
- import { pluginZodName } from '@kubb/plugin-zod';
6
- import { useApp, File } from '@kubb/react';
7
- import { difference } from 'remeda';
8
- import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
9
-
10
- var queryGenerator = createReactGenerator({
11
- name: "svelte-query",
12
- Operation({ options, operation }) {
13
- const {
14
- plugin: {
15
- options: { output }
16
- }
17
- } = useApp();
18
- const { getSchemas, getName, getFile } = useOperationManager();
19
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
20
- const isMutation = difference(["post", "put", "delete", "patch"], options.query ? options.query.methods : []).some((method) => operation.method === method);
21
- const importPath = options.query ? options.query.importPath : "@tanstack/solid-query";
22
- const query = {
23
- name: getName(operation, { type: "function", prefix: "create" }),
24
- typeName: getName(operation, { type: "type" }),
25
- file: getFile(operation, { prefix: "create" })
26
- };
27
- const client = {
28
- name: getName(operation, { type: "function" })
29
- };
30
- const queryOptions = {
31
- name: getName(operation, { type: "function", suffix: "QueryOptions" })
32
- };
33
- const queryKey = {
34
- name: getName(operation, { type: "const", suffix: "QueryKey" }),
35
- typeName: getName(operation, { type: "type", suffix: "QueryKey" })
36
- };
37
- const type = {
38
- file: getFile(operation, { pluginKey: [pluginTsName] }),
39
- //todo remove type?
40
- schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
41
- };
42
- const zod = {
43
- file: getFile(operation, { pluginKey: [pluginZodName] }),
44
- schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
45
- };
46
- if (!isQuery || isMutation) {
47
- return null;
48
- }
49
- return /* @__PURE__ */ jsxs(File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
50
- options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
51
- /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
52
- /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
53
- options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
54
- /* @__PURE__ */ jsx(
55
- File.Import,
56
- {
57
- name: [
58
- type.schemas.request?.name,
59
- type.schemas.response.name,
60
- type.schemas.pathParams?.name,
61
- type.schemas.queryParams?.name,
62
- type.schemas.headerParams?.name,
63
- ...type.schemas.statusCodes?.map((item) => item.name) || []
64
- ].filter(Boolean),
65
- root: query.file.path,
66
- path: type.file.path,
67
- isTypeOnly: true
68
- }
69
- ),
70
- /* @__PURE__ */ jsx(
71
- QueryKey,
72
- {
73
- name: queryKey.name,
74
- typeName: queryKey.typeName,
75
- operation,
76
- paramsCasing: options.paramsCasing,
77
- pathParamsType: options.pathParamsType,
78
- typeSchemas: type.schemas,
79
- transformer: options.queryKey
80
- }
81
- ),
82
- /* @__PURE__ */ jsx(
83
- Client,
84
- {
85
- name: client.name,
86
- isExportable: false,
87
- isIndexable: false,
88
- baseURL: options.client.baseURL,
89
- operation,
90
- typeSchemas: type.schemas,
91
- zodSchemas: zod.schemas,
92
- dataReturnType: options.client.dataReturnType,
93
- paramsCasing: options.paramsCasing,
94
- paramsType: options.paramsType,
95
- pathParamsType: options.pathParamsType,
96
- parser: options.parser
97
- }
98
- ),
99
- /* @__PURE__ */ jsx(File.Import, { name: ["queryOptions"], path: importPath }),
100
- /* @__PURE__ */ jsx(
101
- QueryOptions,
102
- {
103
- name: queryOptions.name,
104
- clientName: client.name,
105
- queryKeyName: queryKey.name,
106
- typeSchemas: type.schemas,
107
- paramsCasing: options.paramsCasing,
108
- paramsType: options.paramsType,
109
- pathParamsType: options.pathParamsType,
110
- dataReturnType: options.client.dataReturnType
111
- }
112
- ),
113
- options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
114
- /* @__PURE__ */ jsx(File.Import, { name: ["createQuery"], path: importPath }),
115
- /* @__PURE__ */ jsx(File.Import, { name: ["QueryKey", "CreateBaseQueryOptions", "CreateQueryResult"], path: importPath, isTypeOnly: true }),
116
- /* @__PURE__ */ jsx(
117
- Query,
118
- {
119
- name: query.name,
120
- queryOptionsName: queryOptions.name,
121
- typeSchemas: type.schemas,
122
- paramsType: options.paramsType,
123
- pathParamsType: options.pathParamsType,
124
- operation,
125
- paramsCasing: options.paramsCasing,
126
- dataReturnType: options.client.dataReturnType,
127
- queryKeyName: queryKey.name,
128
- queryKeyTypeName: queryKey.typeName
129
- }
130
- )
131
- ] })
132
- ] });
133
- }
134
- });
135
-
136
- export { queryGenerator };
137
- //# sourceMappingURL=chunk-TNFZGXIE.js.map
138
- //# sourceMappingURL=chunk-TNFZGXIE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/generators/queryGenerator.tsx"],"names":[],"mappings":";;;;;;;;;AAUO,IAAM,iBAAiB,oBAAuC,CAAA;AAAA,EACnE,IAAM,EAAA,cAAA;AAAA,EACN,SAAU,CAAA,EAAE,OAAS,EAAA,SAAA,EAAa,EAAA;AAChC,IAAM,MAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,OAAA,EAAS,EAAE,MAAO;AAAA;AACpB,QACE,MAAyB,EAAA;AAC7B,IAAA,MAAM,EAAE,UAAA,EAAY,OAAS,EAAA,OAAA,KAAY,mBAAoB,EAAA;AAE7D,IAAA,MAAM,OAAU,GAAA,OAAO,OAAQ,CAAA,KAAA,KAAU,YAAY,IAAO,GAAA,OAAA,CAAQ,KAAO,EAAA,OAAA,CAAQ,IAAK,CAAA,CAAC,MAAW,KAAA,SAAA,CAAU,WAAW,MAAM,CAAA;AAC/H,IAAM,MAAA,UAAA,GAAa,WAAW,CAAC,MAAA,EAAQ,OAAO,QAAU,EAAA,OAAO,GAAG,OA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AA,UAAA;AAAA,YACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,YACxB,SAAA;AAAA,YACA,cAAc,OAAQ,CAAA,YAAA;AAAA,YACtB,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,YAC/B,cAAc,QAAS,CAAA,IAAA;AAAA,YACvB,kBAAkB,QAAS,CAAA;AAAA;AAAA;AAC7B,OACF,EAAA;AAAA,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-TNFZGXIE.js","sourcesContent":["import { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSolidQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSolidQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSolidQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(['post', 'put', 'delete', 'patch'], options.query ? options.query.methods : []).some((method) => operation.method === method)\n const importPath = options.query ? options.query.importPath : '@tanstack/solid-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n />\n {options.query && (\n <>\n <File.Import name={['createQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n paramsCasing={options.paramsCasing}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}