@kubb/plugin-zod 3.0.0-alpha.17 → 3.0.0-alpha.19
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/README.md +0 -4
- package/dist/{chunk-HH7DZZUF.cjs → chunk-EZIBUHZO.cjs} +51 -39
- package/dist/chunk-EZIBUHZO.cjs.map +1 -0
- package/dist/{chunk-ORFIAMY6.js → chunk-GZX3ETVC.js} +28 -16
- package/dist/chunk-GZX3ETVC.js.map +1 -0
- package/dist/{chunk-Q7F7N57F.cjs → chunk-IFCC7VQX.cjs} +4 -4
- package/dist/{chunk-Q7F7N57F.cjs.map → chunk-IFCC7VQX.cjs.map} +1 -1
- package/dist/{chunk-35K4FTRK.js → chunk-LOZEOT4J.js} +4 -4
- package/dist/{chunk-35K4FTRK.js.map → chunk-LOZEOT4J.js.map} +1 -1
- package/dist/components.cjs +3 -3
- package/dist/components.d.cts +1 -2
- package/dist/components.d.ts +1 -2
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -2
- package/dist/generators.d.ts +1 -2
- package/dist/generators.js +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/{types-29VBUXHk.d.cts → types-D7_wds1i.d.cts} +5 -23
- package/dist/{types-29VBUXHk.d.ts → types-D7_wds1i.d.ts} +5 -23
- package/package.json +10 -15
- package/src/generators/__snapshots__/anyof.ts +2 -2
- package/src/generators/__snapshots__/createPet.ts +7 -7
- package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +7 -7
- package/src/generators/__snapshots__/deletePet.ts +2 -2
- package/src/generators/__snapshots__/enumNamesType.ts +2 -2
- package/src/generators/__snapshots__/enumNullable.ts +2 -2
- package/src/generators/__snapshots__/enumVarNamesType.ts +2 -2
- package/src/generators/__snapshots__/example.ts +2 -2
- package/src/generators/__snapshots__/getPets.ts +8 -8
- package/src/generators/__snapshots__/mixedValueTypeConst.ts +3 -3
- package/src/generators/__snapshots__/nullableString.ts +2 -2
- package/src/generators/__snapshots__/nullableStringUuid.ts +2 -2
- package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +2 -2
- package/src/generators/__snapshots__/numberValueConst.ts +3 -3
- package/src/generators/__snapshots__/oneof.ts +2 -2
- package/src/generators/__snapshots__/operations.ts +44 -58
- package/src/generators/__snapshots__/optionalPetInfer.ts +3 -3
- package/src/generators/__snapshots__/optionalPetTyped.ts +2 -2
- package/src/generators/__snapshots__/order.ts +2 -9
- package/src/generators/__snapshots__/orderDateTypeFalse.ts +2 -9
- package/src/generators/__snapshots__/orderDateTypeString.ts +2 -9
- package/src/generators/__snapshots__/pet.ts +2 -2
- package/src/generators/__snapshots__/petArray.ts +3 -7
- package/src/generators/__snapshots__/petCoercion.ts +2 -7
- package/src/generators/__snapshots__/petTupleObject.ts +3 -3
- package/src/generators/__snapshots__/petWithMapper.ts +2 -2
- package/src/generators/__snapshots__/pets.ts +2 -2
- package/src/generators/__snapshots__/recursive.ts +2 -2
- package/src/generators/__snapshots__/showPetById.ts +8 -11
- package/src/generators/__snapshots__/stringValueConst.ts +3 -3
- package/src/generators/__snapshots__/uuidSchema.ts +2 -2
- package/src/generators/operationsGenerator.tsx +6 -3
- package/src/generators/zodGenerator.tsx +7 -2
- package/src/parser/index.ts +1 -1
- package/src/types.ts +5 -28
- package/dist/chunk-HH7DZZUF.cjs.map +0 -1
- package/dist/chunk-ORFIAMY6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __commonJS, init_esm_shims, __toESM, Zod, Operations } from './chunk-
|
|
1
|
+
import { __commonJS, init_esm_shims, __toESM, Zod, Operations } from './chunk-LOZEOT4J.js';
|
|
2
2
|
import { createReactGenerator, SchemaGenerator, pluginOasName, OperationGenerator, schemaKeywords, isKeyword } from '@kubb/plugin-oas';
|
|
3
3
|
import { Oas } from '@kubb/plugin-oas/components';
|
|
4
4
|
import { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks';
|
|
@@ -6,10 +6,10 @@ import path from 'node:path';
|
|
|
6
6
|
import { createPlugin, FileManager, PluginManager } from '@kubb/core';
|
|
7
7
|
import transformers2, { camelCase, pascalCase } from '@kubb/core/transformers';
|
|
8
8
|
import { renderTemplate } from '@kubb/core/utils';
|
|
9
|
-
import { useApp, File, Type } from '@kubb/react';
|
|
10
|
-
import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
|
|
11
9
|
import { print } from '@kubb/parser-ts';
|
|
12
10
|
import * as factory from '@kubb/parser-ts/factory';
|
|
11
|
+
import { useApp, File, Type } from '@kubb/react';
|
|
12
|
+
import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
|
|
13
13
|
|
|
14
14
|
// ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
|
|
15
15
|
var require_react_production_min = __commonJS({
|
|
@@ -2590,14 +2590,17 @@ var typeGenerator = createReactGenerator({
|
|
|
2590
2590
|
)
|
|
2591
2591
|
] }, i);
|
|
2592
2592
|
};
|
|
2593
|
-
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
2593
|
+
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.output?.banner, footer: plugin.output?.footer, children: [
|
|
2594
2594
|
operationSchemas.map(mapOperationSchema),
|
|
2595
2595
|
/* @__PURE__ */ jsx(File.Source, { name: combinedSchemaName, isExportable: true, isIndexable: true, isTypeOnly: true, children: printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager }) })
|
|
2596
2596
|
] });
|
|
2597
2597
|
},
|
|
2598
2598
|
Schema({ schema, options }) {
|
|
2599
2599
|
const { mapper, enumType, optionalType } = options;
|
|
2600
|
-
const {
|
|
2600
|
+
const {
|
|
2601
|
+
mode,
|
|
2602
|
+
plugin: { output }
|
|
2603
|
+
} = useApp();
|
|
2601
2604
|
const { getName, getImports, getFile } = useSchemaManager();
|
|
2602
2605
|
const imports = getImports(schema.tree);
|
|
2603
2606
|
if (enumType === "asPascalConst") {
|
|
@@ -2608,7 +2611,7 @@ var typeGenerator = createReactGenerator({
|
|
|
2608
2611
|
typedName: getName(schema.name, { type: "type" }),
|
|
2609
2612
|
file: getFile(schema.name)
|
|
2610
2613
|
};
|
|
2611
|
-
return /* @__PURE__ */ jsxs(File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, children: [
|
|
2614
|
+
return /* @__PURE__ */ jsxs(File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
2612
2615
|
mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsx(File.Import, { root: type.file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
|
|
2613
2616
|
/* @__PURE__ */ jsx(
|
|
2614
2617
|
Type2,
|
|
@@ -2631,10 +2634,13 @@ init_esm_shims();
|
|
|
2631
2634
|
var oasGenerator = createReactGenerator({
|
|
2632
2635
|
name: "oas",
|
|
2633
2636
|
Operations() {
|
|
2634
|
-
const {
|
|
2637
|
+
const {
|
|
2638
|
+
pluginManager,
|
|
2639
|
+
plugin: { output, key: pluginKey }
|
|
2640
|
+
} = useApp();
|
|
2635
2641
|
const oas = useOas();
|
|
2636
|
-
const file = pluginManager.getFile({ name: "oas", extName: ".ts", pluginKey
|
|
2637
|
-
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
2642
|
+
const file = pluginManager.getFile({ name: "oas", extName: ".ts", pluginKey });
|
|
2643
|
+
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
2638
2644
|
/* @__PURE__ */ jsx(File.Import, { name: ["Infer"], path: "@kubb/oas", isTypeOnly: true }),
|
|
2639
2645
|
/* @__PURE__ */ jsx(OasType, { name: "oas", typeName: "Oas", api: oas.api })
|
|
2640
2646
|
] });
|
|
@@ -2793,7 +2799,7 @@ var zodGenerator = createReactGenerator({
|
|
|
2793
2799
|
)
|
|
2794
2800
|
] }, i);
|
|
2795
2801
|
};
|
|
2796
|
-
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
2802
|
+
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.output?.banner, footer: plugin.output?.footer, children: [
|
|
2797
2803
|
/* @__PURE__ */ jsx(File.Import, { name: ["z"], path: plugin.options.importPath }),
|
|
2798
2804
|
operationSchemas.map(mapOperationSchema)
|
|
2799
2805
|
] });
|
|
@@ -2801,6 +2807,9 @@ var zodGenerator = createReactGenerator({
|
|
|
2801
2807
|
Schema({ schema, options }) {
|
|
2802
2808
|
const { coercion, inferred, typed, mapper, importPath } = options;
|
|
2803
2809
|
const { getName, getFile, getImports } = useSchemaManager();
|
|
2810
|
+
const {
|
|
2811
|
+
plugin: { output }
|
|
2812
|
+
} = useApp();
|
|
2804
2813
|
const imports = getImports(schema.tree);
|
|
2805
2814
|
const zod = {
|
|
2806
2815
|
name: getName(schema.name, { type: "function" }),
|
|
@@ -2811,7 +2820,7 @@ var zodGenerator = createReactGenerator({
|
|
|
2811
2820
|
name: getName(schema.name, { type: "type", pluginKey: [pluginTsName] }),
|
|
2812
2821
|
file: getFile(schema.name, { pluginKey: [pluginTsName] })
|
|
2813
2822
|
};
|
|
2814
|
-
return /* @__PURE__ */ jsxs(File, { baseName: zod.file.baseName, path: zod.file.path, meta: zod.file.meta, children: [
|
|
2823
|
+
return /* @__PURE__ */ jsxs(File, { baseName: zod.file.baseName, path: zod.file.path, meta: zod.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
2815
2824
|
/* @__PURE__ */ jsx(File.Import, { name: ["z"], path: importPath }),
|
|
2816
2825
|
typed && /* @__PURE__ */ jsx(File.Import, { isTypeOnly: true, root: zod.file.path, path: type.file.path, name: [type.name] }),
|
|
2817
2826
|
imports.map((imp, index) => /* @__PURE__ */ jsx(File.Import, { root: zod.file.path, path: imp.path, name: imp.name }, index)),
|
|
@@ -2948,8 +2957,11 @@ var pluginZod = createPlugin((options) => {
|
|
|
2948
2957
|
});
|
|
2949
2958
|
var operationsGenerator = createReactGenerator({
|
|
2950
2959
|
name: "operations",
|
|
2951
|
-
Operations({ operations
|
|
2952
|
-
const {
|
|
2960
|
+
Operations({ operations }) {
|
|
2961
|
+
const {
|
|
2962
|
+
pluginManager,
|
|
2963
|
+
plugin: { output }
|
|
2964
|
+
} = useApp();
|
|
2953
2965
|
const { getFile, groupSchemasByName } = useOperationManager();
|
|
2954
2966
|
const name = "operations";
|
|
2955
2967
|
const file = pluginManager.getFile({ name, extName: ".ts", pluginKey: [pluginZodName] });
|
|
@@ -2958,7 +2970,7 @@ var operationsGenerator = createReactGenerator({
|
|
|
2958
2970
|
const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean);
|
|
2959
2971
|
return /* @__PURE__ */ jsx(File.Import, { name: names, root: file.path, path: getFile(operation).path }, key);
|
|
2960
2972
|
}).filter(Boolean);
|
|
2961
|
-
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
2973
|
+
return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
2962
2974
|
imports,
|
|
2963
2975
|
/* @__PURE__ */ jsx(Operations, { name, operations: transformedOperations })
|
|
2964
2976
|
] });
|
|
@@ -2990,5 +3002,5 @@ react/cjs/react.development.js:
|
|
|
2990
3002
|
*/
|
|
2991
3003
|
|
|
2992
3004
|
export { operationsGenerator, pluginZod, pluginZodName, zodGenerator };
|
|
2993
|
-
//# sourceMappingURL=chunk-
|
|
2994
|
-
//# sourceMappingURL=chunk-
|
|
3005
|
+
//# sourceMappingURL=chunk-GZX3ETVC.js.map
|
|
3006
|
+
//# sourceMappingURL=chunk-GZX3ETVC.js.map
|