@kubb/plugin-oas 0.0.0-canary-20251020101906 → 0.0.0-canary-20251021133545
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/{Oas-CuqAnIw-.js → Oas-DoN76W2_.js} +2 -2
- package/dist/{Oas-CuqAnIw-.js.map → Oas-DoN76W2_.js.map} +1 -1
- package/dist/{OperationGenerator-B3oFps4I.d.ts → OperationGenerator-D9MJSd3H.d.ts} +78 -104
- package/dist/{OperationGenerator-aKcfGbOt.d.cts → OperationGenerator-DiPab7wp.d.cts} +78 -104
- package/dist/{Schema-DxWT5L8_.d.ts → Schema-DzjTOgNU.d.ts} +7 -8
- package/dist/{Schema-CEmdFRTN.d.cts → Schema-lFrS1u1u.d.cts} +7 -8
- package/dist/{SchemaGenerator-Dnllsi8M.cjs → SchemaGenerator-BQUPa5AD.cjs} +2 -3
- package/dist/{SchemaGenerator-Dnllsi8M.cjs.map → SchemaGenerator-BQUPa5AD.cjs.map} +1 -1
- package/dist/{SchemaGenerator-TL2a9FN6.js → SchemaGenerator-DYOXlswO.js} +5 -6
- package/dist/{SchemaGenerator-TL2a9FN6.js.map → SchemaGenerator-DYOXlswO.js.map} +1 -1
- package/dist/{SchemaMapper-BiagBQN4.d.cts → SchemaMapper-BWDIvdP9.d.ts} +2 -2
- package/dist/{SchemaMapper-C2J2d3o4.d.ts → SchemaMapper-BvE5JflR.d.cts} +2 -2
- package/dist/{SchemaMapper-BaZQKrQB.js → SchemaMapper-CqOUibvI.js} +2 -2
- package/dist/{SchemaMapper-BaZQKrQB.js.map → SchemaMapper-CqOUibvI.js.map} +1 -1
- package/dist/components.d.cts +7 -19
- package/dist/components.d.ts +7 -19
- package/dist/components.js +1 -1
- package/dist/{generators-CW7v1RgJ.js → generators-CC4tK-sV.js} +79 -64
- package/dist/generators-CC4tK-sV.js.map +1 -0
- package/dist/{generators-L3av7_7B.cjs → generators-DeiYqSf3.cjs} +75 -60
- package/dist/generators-DeiYqSf3.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +3 -3
- package/dist/{getFooter-DM8B8cnC.js → getFooter-DrSj240h.js} +2 -2
- package/dist/{getFooter-DM8B8cnC.js.map → getFooter-DrSj240h.js.map} +1 -1
- package/dist/{getSchemas-WoSBIxG8.js → getSchemas-CvUX0jWa.js} +2 -2
- package/dist/{getSchemas-WoSBIxG8.js.map → getSchemas-CvUX0jWa.js.map} +1 -1
- package/dist/hooks.cjs +7 -3
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +3 -3
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +10 -7
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/dist/{parseFromConfig-yAiFK03V.js → parseFromConfig-DSI6Meg0.js} +5 -10
- package/dist/parseFromConfig-DSI6Meg0.js.map +1 -0
- package/dist/{parseFromConfig-CFzprC8B.cjs → parseFromConfig-o3tU1XJt.cjs} +4 -9
- package/dist/parseFromConfig-o3tU1XJt.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +3 -6
- package/dist/utils.d.ts +3 -6
- package/dist/utils.js +3 -3
- package/package.json +6 -8
- package/src/generator.tsx +50 -43
- package/src/hooks/useOperationManager.ts +5 -6
- package/src/hooks/useSchemaManager.ts +3 -3
- package/dist/generators-CW7v1RgJ.js.map +0 -1
- package/dist/generators-L3av7_7B.cjs.map +0 -1
- package/dist/parseFromConfig-CFzprC8B.cjs.map +0 -1
- package/dist/parseFromConfig-yAiFK03V.js.map +0 -1
package/dist/hooks.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { SchemaGenerator } from "./SchemaGenerator-
|
|
2
|
-
import {
|
|
3
|
-
import { schemaKeywords } from "./SchemaMapper-
|
|
4
|
-
import "./getSchemas-
|
|
5
|
-
import {
|
|
1
|
+
import { t as SchemaGenerator } from "./SchemaGenerator-DYOXlswO.js";
|
|
2
|
+
import { n as Schema, r as Operation, t as Oas } from "./Oas-DoN76W2_.js";
|
|
3
|
+
import { n as schemaKeywords } from "./SchemaMapper-CqOUibvI.js";
|
|
4
|
+
import "./getSchemas-CvUX0jWa.js";
|
|
5
|
+
import { useContext } from "@kubb/react";
|
|
6
|
+
import { usePlugin, usePluginManager } from "@kubb/core/hooks";
|
|
6
7
|
|
|
7
8
|
//#region src/hooks/useOas.ts
|
|
8
9
|
function useOas() {
|
|
@@ -28,7 +29,8 @@ function useOperation() {
|
|
|
28
29
|
* `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
|
|
29
30
|
*/
|
|
30
31
|
function useOperationManager() {
|
|
31
|
-
const
|
|
32
|
+
const plugin = usePlugin();
|
|
33
|
+
const pluginManager = usePluginManager();
|
|
32
34
|
const { generator } = useContext(Oas.Context);
|
|
33
35
|
const getName = (operation, { prefix = "", suffix = "", pluginKey = plugin.key, type }) => {
|
|
34
36
|
return pluginManager.resolveName({
|
|
@@ -173,7 +175,8 @@ function useSchema() {
|
|
|
173
175
|
* `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.
|
|
174
176
|
*/
|
|
175
177
|
function useSchemaManager() {
|
|
176
|
-
const
|
|
178
|
+
const plugin = usePlugin();
|
|
179
|
+
const pluginManager = usePluginManager();
|
|
177
180
|
const getName = (name, { pluginKey = plugin.key, type }) => {
|
|
178
181
|
return pluginManager.resolveName({
|
|
179
182
|
name,
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":["getName: UseOperationManagerResult['getName']","getGroup: UseOperationManagerResult['getGroup']","getSchemas: UseOperationManagerResult['getSchemas']","getFile: UseOperationManagerResult['getFile']","groupSchemasByName: UseOperationManagerResult['groupSchemasByName']","getName: UseSchemaManagerResult['getName']","getFile: UseSchemaManagerResult['getFile']","getImports: UseSchemaManagerResult['getImports']"],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts","../src/hooks/useSchema.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import { useApp, useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\n\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\nexport type SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (\n operation: OperationType,\n params: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => string\n getFile: (\n operation: OperationType,\n params?: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n groupSchemasByName: (\n operation: OperationType,\n params: {\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => SchemaNames\n getSchemas: (operation: Operation, params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] }) => OperationSchemas\n getGroup: (operation: Operation) => FileMeta['group'] | undefined\n}\n\n/**\n * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const { plugin, pluginManager } = useApp()\n const { generator } = useContext(Oas.Context)\n\n const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: `${prefix} ${operation.getOperationId()} ${suffix}`,\n pluginKey,\n type,\n })\n }\n\n const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {\n return {\n tag: operation.getTags().at(0)?.name,\n path: operation.path,\n }\n }\n\n const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n return generator.getSchemas(operation, {\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginKey: params?.pluginKey,\n type: params?.type,\n }),\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginKey = plugin.key, extname = '.ts' } = {}) => {\n const name = getName(operation, { type: 'file', pluginKey, prefix, suffix })\n const group = getGroup(operation)\n\n const file = pluginManager.getFile({\n name,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n group,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginKey = plugin.key, type }) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n const responses = (schemas.responses || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n ...responses,\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas,\n groupSchemasByName,\n getGroup,\n }\n}\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n","import { useContext } from '@kubb/react'\n\nimport { Schema } from '../components/Schema.tsx'\n\nimport type { SchemaContextProps } from '../components/Schema.tsx'\n\ntype UseSchemaResult = SchemaContextProps\n\n/**\n * `useSchema` will return the current `schema properties`\n */\nexport function useSchema(): UseSchemaResult {\n const props = useContext(Schema.Context)\n\n return props as UseSchemaResult\n}\n","import { useApp } from '@kubb/react'\n\nimport type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport { type Schema, schemaKeywords } from '../SchemaMapper'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\ntype UseSchemaManagerResult = {\n getName: (name: string, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (\n name: string,\n params?: {\n pluginKey?: Plugin['key']\n mode?: KubbFile.Mode\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n getImports: (tree: Array<Schema>) => Array<KubbFile.Import>\n}\n\n/**\n * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const { plugin, pluginManager } = useApp()\n\n const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name,\n pluginKey,\n type,\n })\n }\n\n const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', group } = {}) => {\n const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name: resolvedName,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name: resolvedName,\n pluginKey,\n },\n }\n }\n\n const getImports: UseSchemaManagerResult['getImports'] = (tree) => {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n return refs\n ?.map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return {\n name: [item.args.name],\n path: item.args.path,\n }\n })\n .filter(Boolean)\n }\n\n return {\n getName,\n getFile,\n getImports,\n }\n}\n"],"mappings":";;;;;;;AAMA,SAAgB,SAAkB;CAChC,MAAM,EAAE,QAAQ,WAAW,IAAI,QAAQ;AAEvC,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,qBAAqB;AAGvC,QAAO;;;;;;;;ACJT,SAAgB,eAA8B;CAC5C,MAAM,EAAE,cAAc,WAAW,UAAU,QAAQ;AAEnD,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,2BAA2B;AAG7C,QAAO;;;;;;;;ACmDT,SAAgB,sBAAiD;CAC/D,MAAM,EAAE,QAAQ,kBAAkB,QAAQ;CAC1C,MAAM,EAAE,cAAc,WAAW,IAAI,QAAQ;CAE7C,MAAMA,WAAiD,WAAW,EAAE,SAAS,IAAI,SAAS,IAAI,YAAY,OAAO,KAAK,WAAW;AAC/H,SAAO,cAAc,YAAY;GAC/B,MAAM,GAAG,OAAO,GAAG,UAAU,gBAAgB,CAAC,GAAG;GACjD;GACA;GACD,CAAC;;CAGJ,MAAMC,YAAmD,cAAc;AACrE,SAAO;GACL,KAAK,UAAU,SAAS,CAAC,GAAG,EAAE,EAAE;GAChC,MAAM,UAAU;GACjB;;CAGH,MAAMC,cAAuD,WAAW,WAAW;AACjF,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,6BAA6B;AAG/C,SAAO,UAAU,WAAW,WAAW,EACrC,cAAc,SACZ,cAAc,YAAY;GACxB;GACA,WAAW,QAAQ;GACnB,MAAM,QAAQ;GACf,CAAC,EACL,CAAC;;CAGJ,MAAMC,WAAiD,WAAW,EAAE,QAAQ,QAAQ,YAAY,OAAO,KAAK,UAAU,UAAU,EAAE,KAAK;EACrI,MAAM,OAAO,QAAQ,WAAW;GAAE,MAAM;GAAQ;GAAW;GAAQ;GAAQ,CAAC;EAC5E,MAAM,QAAQ,SAAS,UAAU;EAEjC,MAA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pB,QAAO;EACL;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"hooks.js","names":["getName: UseOperationManagerResult['getName']","getGroup: UseOperationManagerResult['getGroup']","getSchemas: UseOperationManagerResult['getSchemas']","getFile: UseOperationManagerResult['getFile']","groupSchemasByName: UseOperationManagerResult['groupSchemasByName']","getName: UseSchemaManagerResult['getName']","getFile: UseSchemaManagerResult['getFile']","getImports: UseSchemaManagerResult['getImports']"],"sources":["../src/hooks/useOas.ts","../src/hooks/useOperation.ts","../src/hooks/useOperationManager.ts","../src/hooks/useOperations.ts","../src/hooks/useSchema.ts","../src/hooks/useSchemaManager.ts"],"sourcesContent":["import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { Oas as OasType } from '@kubb/oas'\n\nexport function useOas(): OasType {\n const { oas } = useContext(Oas.Context)\n\n if (!oas) {\n throw new Error('Oas is not defined')\n }\n\n return oas\n}\n","import { useContext } from '@kubb/react'\n\nimport { Operation } from '../components/Operation.tsx'\n\nimport type { Operation as OperationType } from '@kubb/oas'\n\n/**\n * `useOperation` will return the current `Operation`\n */\nexport function useOperation(): OperationType {\n const { operation } = useContext(Operation.Context)\n\n if (!operation) {\n throw new Error('Operation is not defined')\n }\n\n return operation\n}\n","import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport type { Operation, Operation as OperationType } from '@kubb/oas'\nimport { useContext } from '@kubb/react'\nimport { Oas } from '../components/Oas.tsx'\nimport type { OperationSchemas } from '../types.ts'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\nexport type SchemaNames = {\n request: string | undefined\n parameters: {\n path: string | undefined\n query: string | undefined\n header: string | undefined\n }\n responses: { default?: string } & Record<number | string, string>\n errors: Record<number | string, string>\n}\n\ntype UseOperationManagerResult = {\n getName: (\n operation: OperationType,\n params: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => string\n getFile: (\n operation: OperationType,\n params?: {\n prefix?: string\n suffix?: string\n pluginKey?: Plugin['key']\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n groupSchemasByName: (\n operation: OperationType,\n params: {\n pluginKey?: Plugin['key']\n type: ResolveNameParams['type']\n },\n ) => SchemaNames\n getSchemas: (operation: Operation, params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] }) => OperationSchemas\n getGroup: (operation: Operation) => FileMeta['group'] | undefined\n}\n\n/**\n * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.\n */\nexport function useOperationManager(): UseOperationManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n const { generator } = useContext(Oas.Context)\n\n const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name: `${prefix} ${operation.getOperationId()} ${suffix}`,\n pluginKey,\n type,\n })\n }\n\n const getGroup: UseOperationManagerResult['getGroup'] = (operation) => {\n return {\n tag: operation.getTags().at(0)?.name,\n path: operation.path,\n }\n }\n\n const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n return generator.getSchemas(operation, {\n resolveName: (name) =>\n pluginManager.resolveName({\n name,\n pluginKey: params?.pluginKey,\n type: params?.type,\n }),\n })\n }\n\n const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginKey = plugin.key, extname = '.ts' } = {}) => {\n const name = getName(operation, { type: 'file', pluginKey, prefix, suffix })\n const group = getGroup(operation)\n\n const file = pluginManager.getFile({\n name,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name,\n pluginKey,\n group,\n },\n }\n }\n\n const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginKey = plugin.key, type }) => {\n if (!generator) {\n throw new Error(`'generator' is not defined`)\n }\n\n const schemas = generator.getSchemas(operation)\n\n const errors = (schemas.errors || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n const responses = (schemas.responses || []).reduce(\n (prev, acc) => {\n if (!acc.statusCode) {\n return prev\n }\n\n prev[acc.statusCode] = pluginManager.resolveName({\n name: acc.name,\n pluginKey,\n type,\n })\n\n return prev\n },\n {} as Record<number, string>,\n )\n\n return {\n request: schemas.request?.name\n ? pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey,\n type,\n })\n : undefined,\n parameters: {\n path: schemas.pathParams?.name\n ? pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey,\n type,\n })\n : undefined,\n query: schemas.queryParams?.name\n ? pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey,\n type,\n })\n : undefined,\n header: schemas.headerParams?.name\n ? pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey,\n type,\n })\n : undefined,\n },\n responses: {\n ...responses,\n ['default']: pluginManager.resolveName({\n name: schemas.response.name,\n pluginKey,\n type,\n }),\n ...errors,\n },\n errors,\n }\n }\n\n return {\n getName,\n getFile,\n getSchemas,\n groupSchemasByName,\n getGroup,\n }\n}\n","import { useContext } from '@kubb/react'\n\nimport { Oas } from '../components/Oas.tsx'\n\nimport type { HttpMethod, Operation } from '@kubb/oas'\n\ntype UseOperationsProps = {\n /**\n * Filter based on path\n * Weight: 2\n */\n path?: string\n /**\n * Filter based on method\n * Weight: 1\n */\n method?: HttpMethod\n}\n\n/**\n * `useOperations` will return all the Operations\n */\nexport function useOperations({ method, path }: UseOperationsProps = {}): Operation[] {\n const { operations } = useContext(Oas.Context)\n\n if (!operations) {\n throw new Error('Operations is not defined')\n }\n let items = operations\n\n if (path) {\n items = items.filter((item) => item.path === path)\n }\n\n if (method) {\n items = items.filter((item) => item.method === method)\n }\n\n return items\n}\n","import { useContext } from '@kubb/react'\n\nimport { Schema } from '../components/Schema.tsx'\n\nimport type { SchemaContextProps } from '../components/Schema.tsx'\n\ntype UseSchemaResult = SchemaContextProps\n\n/**\n * `useSchema` will return the current `schema properties`\n */\nexport function useSchema(): UseSchemaResult {\n const props = useContext(Schema.Context)\n\n return props as UseSchemaResult\n}\n","import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport { type Schema, schemaKeywords } from '../SchemaMapper'\n\ntype FileMeta = FileMetaBase & {\n pluginKey: Plugin['key']\n name: string\n group?: {\n tag?: string\n path?: string\n }\n}\n\ntype UseSchemaManagerResult = {\n getName: (name: string, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string\n getFile: (\n name: string,\n params?: {\n pluginKey?: Plugin['key']\n mode?: KubbFile.Mode\n extname?: KubbFile.Extname\n group?: {\n tag?: string\n path?: string\n }\n },\n ) => KubbFile.File<FileMeta>\n getImports: (tree: Array<Schema>) => Array<KubbFile.Import>\n}\n\n/**\n * `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.\n */\nexport function useSchemaManager(): UseSchemaManagerResult {\n const plugin = usePlugin()\n const pluginManager = usePluginManager()\n\n const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {\n return pluginManager.resolveName({\n name,\n pluginKey,\n type,\n })\n }\n\n const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', group } = {}) => {\n const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginKey })\n\n const file = pluginManager.getFile({\n name: resolvedName,\n extname,\n pluginKey,\n options: { type: 'file', pluginKey, group },\n })\n\n return {\n ...file,\n meta: {\n ...file.meta,\n name: resolvedName,\n pluginKey,\n },\n }\n }\n\n const getImports: UseSchemaManagerResult['getImports'] = (tree) => {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n return refs\n ?.map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return {\n name: [item.args.name],\n path: item.args.path,\n }\n })\n .filter(Boolean)\n }\n\n return {\n getName,\n getFile,\n getImports,\n }\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,SAAkB;CAChC,MAAM,EAAE,QAAQ,WAAW,IAAI,QAAQ;AAEvC,KAAI,CAAC,IACH,OAAM,IAAI,MAAM,qBAAqB;AAGvC,QAAO;;;;;;;;ACJT,SAAgB,eAA8B;CAC5C,MAAM,EAAE,cAAc,WAAW,UAAU,QAAQ;AAEnD,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,2BAA2B;AAG7C,QAAO;;;;;;;;ACiDT,SAAgB,sBAAiD;CAC/D,MAAM,SAAS,WAAW;CAC1B,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,cAAc,WAAW,IAAI,QAAQ;CAE7C,MAAMA,WAAiD,WAAW,EAAE,SAAS,IAAI,SAAS,IAAI,YAAY,OAAO,KAAK,WAAW;AAC/H,SAAO,cAAc,YAAY;GAC/B,MAAM,GAAG,OAAO,GAAG,UAAU,gBAAgB,CAAC,GAAG;GACjD;GACA;GACD,CAAC;;CAGJ,MAAMC,YAAmD,cAAc;AACrE,SAAO;GACL,KAAK,UAAU,SAAS,CAAC,GAAG,EAAE,EAAE;GAChC,MAAM,UAAU;GACjB;;CAGH,MAAMC,cAAuD,WAAW,WAAW;AACjF,MAAI,CAAC,UACH,OAAM,IAAI,MAAM,6BAA6B;AAG/C,SAAO,UAAU,WAAW,WAAW,EACrC,cAAc,SACZ,cAAc,YAAY;GACxB;GACA,WAAW,QAAQ;GACnB,MAAM,QAAQ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AMC,cAAoD,SAAS;AAGjE,SAFa,gBAAgB,WAAW,MAAM,eAAe,IAAI,EAG7D,KAAK,SAAS;AACd,OAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,KAAK,aAChC;AAGF,UAAO;IACL,MAAM,CAAC,KAAK,KAAK,KAAK;IACtB,MAAM,KAAK,KAAK;IACjB;IACD,CACD,OAAO,QAAQ;;AAGpB,QAAO;EACL;EACA;EACA;EACD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_SchemaGenerator = require('./SchemaGenerator-
|
|
2
|
+
const require_SchemaGenerator = require('./SchemaGenerator-BQUPa5AD.cjs');
|
|
3
3
|
require('./Oas--cvTRMTA.cjs');
|
|
4
|
-
const require_generators = require('./generators-
|
|
4
|
+
const require_generators = require('./generators-DeiYqSf3.cjs');
|
|
5
5
|
require('./getFooter-B_nmsoeK.cjs');
|
|
6
6
|
const require_SchemaMapper = require('./SchemaMapper-D8J0V9Pj.cjs');
|
|
7
7
|
require('./getSchemas-08CU8KWq.cjs');
|
|
8
|
-
const require_parseFromConfig = require('./parseFromConfig-
|
|
8
|
+
const require_parseFromConfig = require('./parseFromConfig-o3tU1XJt.cjs');
|
|
9
9
|
let __kubb_core = require("@kubb/core");
|
|
10
10
|
__kubb_core = require_chunk.__toESM(__kubb_core);
|
|
11
11
|
let __kubb_core_transformers = require("@kubb/core/transformers");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as UserPluginWithLifeCycle, C as ResolvePathOptions, S as Refs, _ as OperationSchemas, a as ReactGeneratorOptions, b as PluginOas, c as GetSchemaGeneratorOptions, d as SchemaGeneratorOptions, f as SchemaMethodResult, g as OperationSchema, h as Include, i as GeneratorOptions, l as SchemaGenerator, m as Exclude, n as OperationMethodResult, o as createGenerator, p as API, r as Generator, s as createReactGenerator, t as OperationGenerator, u as SchemaGeneratorBuildOptions, v as Options, w as Resolver, x as Ref, y as Override } from "./OperationGenerator-DiPab7wp.cjs";
|
|
2
|
+
import { a as SchemaMapper, c as schemaKeywords, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema } from "./SchemaMapper-BvE5JflR.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginOasName = "plugin-oas";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A as UserPluginWithLifeCycle, C as ResolvePathOptions, S as Refs, _ as OperationSchemas, a as ReactGeneratorOptions, b as PluginOas, c as GetSchemaGeneratorOptions, d as SchemaGeneratorOptions, f as SchemaMethodResult, g as OperationSchema, h as Include, i as GeneratorOptions, l as SchemaGenerator, m as Exclude, n as OperationMethodResult, o as createGenerator, p as API, r as Generator, s as createReactGenerator, t as OperationGenerator, u as SchemaGeneratorBuildOptions, v as Options, w as Resolver, x as Ref, y as Override } from "./OperationGenerator-D9MJSd3H.js";
|
|
2
|
+
import { a as SchemaMapper, c as schemaKeywords, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema } from "./SchemaMapper-BWDIvdP9.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginOasName = "plugin-oas";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./Oas-
|
|
3
|
-
import { createGenerator, createReactGenerator, jsonGenerator } from "./generators-
|
|
4
|
-
import "./getFooter-
|
|
5
|
-
import {
|
|
6
|
-
import "./getSchemas-
|
|
7
|
-
import { parseFromConfig } from "./parseFromConfig-
|
|
1
|
+
import { n as pLimit, t as SchemaGenerator } from "./SchemaGenerator-DYOXlswO.js";
|
|
2
|
+
import "./Oas-DoN76W2_.js";
|
|
3
|
+
import { n as createGenerator, r as createReactGenerator, t as jsonGenerator } from "./generators-CC4tK-sV.js";
|
|
4
|
+
import "./getFooter-DrSj240h.js";
|
|
5
|
+
import { n as schemaKeywords, t as isKeyword } from "./SchemaMapper-CqOUibvI.js";
|
|
6
|
+
import "./getSchemas-CvUX0jWa.js";
|
|
7
|
+
import { t as parseFromConfig } from "./parseFromConfig-DSI6Meg0.js";
|
|
8
8
|
import { BaseGenerator, FileManager, createPlugin } from "@kubb/core";
|
|
9
9
|
import transformers, { camelCase } from "@kubb/core/transformers";
|
|
10
10
|
import path from "node:path";
|
package/dist/mocks.d.cts
CHANGED
package/dist/mocks.d.ts
CHANGED
package/dist/mocks.js
CHANGED
|
@@ -6,16 +6,11 @@ import yaml from "@stoplight/yaml";
|
|
|
6
6
|
//#region src/utils/parseFromConfig.ts
|
|
7
7
|
function parseFromConfig(config, oasClass = Oas) {
|
|
8
8
|
if ("data" in config.input) {
|
|
9
|
-
if (typeof config.input.data === "object") {
|
|
10
|
-
const api$1 = JSON.parse(JSON.stringify(config.input.data));
|
|
11
|
-
return parse(api$1, { oasClass });
|
|
12
|
-
}
|
|
9
|
+
if (typeof config.input.data === "object") return parse(JSON.parse(JSON.stringify(config.input.data)), { oasClass });
|
|
13
10
|
try {
|
|
14
|
-
|
|
15
|
-
return parse(api$1, { oasClass });
|
|
11
|
+
return parse(yaml.parse(config.input.data), { oasClass });
|
|
16
12
|
} catch (_e) {}
|
|
17
|
-
|
|
18
|
-
return parse(api, { oasClass });
|
|
13
|
+
return parse(JSON.parse(JSON.stringify(config.input.data)), { oasClass });
|
|
19
14
|
}
|
|
20
15
|
if (Array.isArray(config.input)) return merge(config.input.map((input) => input.path), { oasClass });
|
|
21
16
|
if (new URLPath(config.input.path).isURL) return parse(config.input.path, { oasClass });
|
|
@@ -23,5 +18,5 @@ function parseFromConfig(config, oasClass = Oas) {
|
|
|
23
18
|
}
|
|
24
19
|
|
|
25
20
|
//#endregion
|
|
26
|
-
export { parseFromConfig };
|
|
27
|
-
//# sourceMappingURL=parseFromConfig-
|
|
21
|
+
export { parseFromConfig as t };
|
|
22
|
+
//# sourceMappingURL=parseFromConfig-DSI6Meg0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseFromConfig-DSI6Meg0.js","names":[],"sources":["../src/utils/parseFromConfig.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, { oasClass })\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, { oasClass })\n } catch (_e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, { oasClass })\n }\n\n if (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, { oasClass })\n }\n\n return parse(resolve(config.root, config.input.path), { oasClass })\n}\n"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,QAAgB,WAAuB,KAAmB;AACxF,KAAI,UAAU,OAAO,OAAO;AAC1B,MAAI,OAAO,OAAO,MAAM,SAAS,SAE/B,QAAO,MAD2B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAC7D,EAAE,UAAU,CAAC;AAGjC,MAAI;AAGF,UAAO,MAFa,KAAK,MAAM,OAAO,MAAM,KAAe,EAEzC,EAAE,UAAU,CAAC;WACxB,IAAI;AAMb,SAAO,MAF2B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAE7D,EAAE,UAAU,CAAC;;AAGjC,KAAI,MAAM,QAAQ,OAAO,MAAM,CAC7B,QAAO,MACL,OAAO,MAAM,KAAK,UAAU,MAAM,KAAK,EACvC,EAAE,UAAU,CACb;AAGH,KAAI,IAAI,QAAQ,OAAO,MAAM,KAAK,CAAC,MACjC,QAAO,MAAM,OAAO,MAAM,MAAM,EAAE,UAAU,CAAC;AAG/C,QAAO,MAAM,QAAQ,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,UAAU,CAAC"}
|
|
@@ -11,16 +11,11 @@ __stoplight_yaml = require_chunk.__toESM(__stoplight_yaml);
|
|
|
11
11
|
//#region src/utils/parseFromConfig.ts
|
|
12
12
|
function parseFromConfig(config, oasClass = __kubb_oas.Oas) {
|
|
13
13
|
if ("data" in config.input) {
|
|
14
|
-
if (typeof config.input.data === "object") {
|
|
15
|
-
const api$1 = JSON.parse(JSON.stringify(config.input.data));
|
|
16
|
-
return (0, __kubb_oas.parse)(api$1, { oasClass });
|
|
17
|
-
}
|
|
14
|
+
if (typeof config.input.data === "object") return (0, __kubb_oas.parse)(JSON.parse(JSON.stringify(config.input.data)), { oasClass });
|
|
18
15
|
try {
|
|
19
|
-
|
|
20
|
-
return (0, __kubb_oas.parse)(api$1, { oasClass });
|
|
16
|
+
return (0, __kubb_oas.parse)(__stoplight_yaml.default.parse(config.input.data), { oasClass });
|
|
21
17
|
} catch (_e) {}
|
|
22
|
-
|
|
23
|
-
return (0, __kubb_oas.parse)(api, { oasClass });
|
|
18
|
+
return (0, __kubb_oas.parse)(JSON.parse(JSON.stringify(config.input.data)), { oasClass });
|
|
24
19
|
}
|
|
25
20
|
if (Array.isArray(config.input)) return (0, __kubb_oas.merge)(config.input.map((input) => input.path), { oasClass });
|
|
26
21
|
if (new __kubb_core_utils.URLPath(config.input.path).isURL) return (0, __kubb_oas.parse)(config.input.path, { oasClass });
|
|
@@ -34,4 +29,4 @@ Object.defineProperty(exports, 'parseFromConfig', {
|
|
|
34
29
|
return parseFromConfig;
|
|
35
30
|
}
|
|
36
31
|
});
|
|
37
|
-
//# sourceMappingURL=parseFromConfig-
|
|
32
|
+
//# sourceMappingURL=parseFromConfig-o3tU1XJt.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseFromConfig-o3tU1XJt.cjs","names":["Oas","yaml","URLPath"],"sources":["../src/utils/parseFromConfig.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, { oasClass })\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, { oasClass })\n } catch (_e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, { oasClass })\n }\n\n if (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, { oasClass })\n }\n\n return parse(resolve(config.root, config.input.path), { oasClass })\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,gBAAgB,QAAgB,WAAuBA,gBAAmB;AACxF,KAAI,UAAU,OAAO,OAAO;AAC1B,MAAI,OAAO,OAAO,MAAM,SAAS,SAE/B,8BADkC,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAC7D,EAAE,UAAU,CAAC;AAGjC,MAAI;AAGF,gCAFoBC,yBAAK,MAAM,OAAO,MAAM,KAAe,EAEzC,EAAE,UAAU,CAAC;WACxB,IAAI;AAMb,+BAFkC,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC,EAE7D,EAAE,UAAU,CAAC;;AAGjC,KAAI,MAAM,QAAQ,OAAO,MAAM,CAC7B,8BACE,OAAO,MAAM,KAAK,UAAU,MAAM,KAAK,EACvC,EAAE,UAAU,CACb;AAGH,KAAI,IAAIC,0BAAQ,OAAO,MAAM,KAAK,CAAC,MACjC,8BAAa,OAAO,MAAM,MAAM,EAAE,UAAU,CAAC;AAG/C,qDAAqB,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,UAAU,CAAC"}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
2
|
const require_getFooter = require('./getFooter-B_nmsoeK.cjs');
|
|
3
3
|
const require_getSchemas = require('./getSchemas-08CU8KWq.cjs');
|
|
4
|
-
const require_parseFromConfig = require('./parseFromConfig-
|
|
4
|
+
const require_parseFromConfig = require('./parseFromConfig-o3tU1XJt.cjs');
|
|
5
5
|
let __kubb_core_transformers = require("@kubb/core/transformers");
|
|
6
6
|
__kubb_core_transformers = require_chunk.__toESM(__kubb_core_transformers);
|
|
7
7
|
let __kubb_core_utils = require("@kubb/core/utils");
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./SchemaMapper-
|
|
1
|
+
import { D as Output, E as Config, F as OpenAPIV3$1, I as OpenAPIV3_1, L as Operation, M as Oas, P as OasTypes, R as SchemaObject$1, g as OperationSchema, j as types_d_exports, z as contentType } from "./OperationGenerator-DiPab7wp.cjs";
|
|
2
|
+
import "./SchemaMapper-BvE5JflR.cjs";
|
|
3
3
|
import { OASDocument, SchemaObject } from "oas/types";
|
|
4
4
|
import { OpenAPIV3 } from "openapi-types";
|
|
5
5
|
|
|
@@ -38,9 +38,6 @@ type FunctionParamsASTWithType = {
|
|
|
38
38
|
* @deprecated
|
|
39
39
|
*/
|
|
40
40
|
type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated
|
|
43
|
-
*/
|
|
44
41
|
//#endregion
|
|
45
42
|
//#region src/utils/getComments.d.ts
|
|
46
43
|
declare function getComments(operation: Operation): string[];
|
|
@@ -50,7 +47,7 @@ declare function getPathParams(operationSchema: OperationSchema | undefined, opt
|
|
|
50
47
|
typed?: boolean;
|
|
51
48
|
casing?: 'camelcase';
|
|
52
49
|
override?: (data: FunctionParamsAST) => FunctionParamsAST;
|
|
53
|
-
}): Params;
|
|
50
|
+
}): types_d_exports.Params;
|
|
54
51
|
//#endregion
|
|
55
52
|
//#region src/utils/getSchemaFactory.d.ts
|
|
56
53
|
/**
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./SchemaMapper-
|
|
1
|
+
import { D as Output, E as Config, F as OpenAPIV3$1, I as OpenAPIV3_1, L as Operation, M as Oas, P as OasTypes, R as SchemaObject$1, g as OperationSchema, j as types_d_exports, z as contentType } from "./OperationGenerator-D9MJSd3H.js";
|
|
2
|
+
import "./SchemaMapper-BWDIvdP9.js";
|
|
3
3
|
import { OASDocument, SchemaObject } from "oas/types";
|
|
4
4
|
import { OpenAPIV3 } from "openapi-types";
|
|
5
5
|
|
|
@@ -38,9 +38,6 @@ type FunctionParamsASTWithType = {
|
|
|
38
38
|
* @deprecated
|
|
39
39
|
*/
|
|
40
40
|
type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
|
|
41
|
-
/**
|
|
42
|
-
* @deprecated
|
|
43
|
-
*/
|
|
44
41
|
//#endregion
|
|
45
42
|
//#region src/utils/getComments.d.ts
|
|
46
43
|
declare function getComments(operation: Operation): string[];
|
|
@@ -50,7 +47,7 @@ declare function getPathParams(operationSchema: OperationSchema | undefined, opt
|
|
|
50
47
|
typed?: boolean;
|
|
51
48
|
casing?: 'camelcase';
|
|
52
49
|
override?: (data: FunctionParamsAST) => FunctionParamsAST;
|
|
53
|
-
}): Params;
|
|
50
|
+
}): types_d_exports.Params;
|
|
54
51
|
//#endregion
|
|
55
52
|
//#region src/utils/getSchemaFactory.d.ts
|
|
56
53
|
/**
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getBanner, getFooter } from "./getFooter-
|
|
2
|
-
import { getSchemaFactory, getSchemas } from "./getSchemas-
|
|
3
|
-
import { parseFromConfig } from "./parseFromConfig-
|
|
1
|
+
import { n as getBanner, t as getFooter } from "./getFooter-DrSj240h.js";
|
|
2
|
+
import { n as getSchemaFactory, t as getSchemas } from "./getSchemas-CvUX0jWa.js";
|
|
3
|
+
import { t as parseFromConfig } from "./parseFromConfig-DSI6Meg0.js";
|
|
4
4
|
import transformers, { camelCase, isValidVarName } from "@kubb/core/transformers";
|
|
5
5
|
import { URLPath } from "@kubb/core/utils";
|
|
6
6
|
import { isOptional, isParameterObject } from "@kubb/oas";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251021133545",
|
|
4
4
|
"description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -82,18 +82,16 @@
|
|
|
82
82
|
"@stoplight/yaml": "^4.3.0",
|
|
83
83
|
"p-limit": "^7.2.0",
|
|
84
84
|
"remeda": "^2.32.0",
|
|
85
|
-
"@kubb/core": "0.0.0-canary-
|
|
86
|
-
"@kubb/oas": "0.0.0-canary-
|
|
87
|
-
"@kubb/react": "0.0.0-canary-
|
|
85
|
+
"@kubb/core": "0.0.0-canary-20251021133545",
|
|
86
|
+
"@kubb/oas": "0.0.0-canary-20251021133545",
|
|
87
|
+
"@kubb/react": "0.0.0-canary-20251021133545"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"
|
|
91
|
-
"react": "^18.3.1",
|
|
92
|
-
"tsdown": "^0.14.2",
|
|
90
|
+
"tsdown": "^0.15.9",
|
|
93
91
|
"typescript": "^5.9.3"
|
|
94
92
|
},
|
|
95
93
|
"peerDependencies": {
|
|
96
|
-
"@kubb/react": "0.0.0-canary-
|
|
94
|
+
"@kubb/react": "0.0.0-canary-20251021133545"
|
|
97
95
|
},
|
|
98
96
|
"engines": {
|
|
99
97
|
"node": ">=20"
|
package/src/generator.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginFactoryOptions } from '@kubb/core'
|
|
2
2
|
import type { KubbFile } from '@kubb/core/fs'
|
|
3
3
|
import type { Operation, SchemaObject } from '@kubb/oas'
|
|
4
|
-
import { App,
|
|
4
|
+
import { App, createApp } from '@kubb/react'
|
|
5
5
|
import type { KubbNode } from '@kubb/react/types'
|
|
6
6
|
import { Oas } from './components/Oas.tsx'
|
|
7
7
|
import type { OperationGenerator } from './OperationGenerator.ts'
|
|
@@ -66,19 +66,21 @@ export function createReactGenerator<TOptions extends PluginFactoryOptions>(pars
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const { pluginManager, oas, plugin, mode } = instance.context
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
)
|
|
81
|
-
|
|
69
|
+
const Operations = parseOptions.Operations
|
|
70
|
+
|
|
71
|
+
function Component() {
|
|
72
|
+
return (
|
|
73
|
+
<App meta={{ pluginManager, plugin, mode }}>
|
|
74
|
+
<Oas oas={oas} operations={operations} generator={instance}>
|
|
75
|
+
<Operations operations={operations} instance={instance} options={options} />
|
|
76
|
+
</Oas>
|
|
77
|
+
</App>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
const app = createApp(Component)
|
|
81
|
+
|
|
82
|
+
app.render()
|
|
83
|
+
return app.getFiles()
|
|
82
84
|
},
|
|
83
85
|
async operation({ instance, operation, options }) {
|
|
84
86
|
if (!parseOptions.Operation) {
|
|
@@ -86,21 +88,23 @@ export function createReactGenerator<TOptions extends PluginFactoryOptions>(pars
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
const { pluginManager, oas, plugin, mode } = instance.context
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
-
|
|
91
|
+
const Operation = parseOptions.Operation
|
|
92
|
+
|
|
93
|
+
function Component() {
|
|
94
|
+
return (
|
|
95
|
+
<App meta={{ pluginManager, plugin: { ...plugin, options }, mode }}>
|
|
96
|
+
<Oas oas={oas} operations={[operation]} generator={instance}>
|
|
97
|
+
<Oas.Operation operation={operation}>
|
|
98
|
+
<Operation operation={operation} options={options} instance={instance} />
|
|
99
|
+
</Oas.Operation>
|
|
100
|
+
</Oas>
|
|
101
|
+
</App>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
const app = createApp(Component)
|
|
105
|
+
|
|
106
|
+
app.render()
|
|
107
|
+
return app.getFiles()
|
|
104
108
|
},
|
|
105
109
|
async schema({ instance, schema, options }) {
|
|
106
110
|
if (!parseOptions.Schema) {
|
|
@@ -109,20 +113,23 @@ export function createReactGenerator<TOptions extends PluginFactoryOptions>(pars
|
|
|
109
113
|
|
|
110
114
|
const { pluginManager, oas, plugin, mode } = instance.context
|
|
111
115
|
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
</Oas
|
|
122
|
-
</
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
const Schema = parseOptions.Schema
|
|
117
|
+
|
|
118
|
+
function Component() {
|
|
119
|
+
return (
|
|
120
|
+
<App meta={{ pluginManager, plugin: { ...plugin, options }, mode }}>
|
|
121
|
+
<Oas oas={oas}>
|
|
122
|
+
<Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>
|
|
123
|
+
<Schema schema={schema} options={options} instance={instance} />
|
|
124
|
+
</Oas.Schema>
|
|
125
|
+
</Oas>
|
|
126
|
+
</App>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
const app = createApp(Component)
|
|
130
|
+
|
|
131
|
+
app.render()
|
|
132
|
+
return app.getFiles()
|
|
126
133
|
},
|
|
127
134
|
}
|
|
128
135
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { useApp, useContext } from '@kubb/react'
|
|
2
|
-
|
|
3
|
-
import { Oas } from '../components/Oas.tsx'
|
|
4
|
-
|
|
5
1
|
import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
|
|
6
|
-
|
|
7
2
|
import type { KubbFile } from '@kubb/core/fs'
|
|
3
|
+
import { usePlugin, usePluginManager } from '@kubb/core/hooks'
|
|
8
4
|
import type { Operation, Operation as OperationType } from '@kubb/oas'
|
|
5
|
+
import { useContext } from '@kubb/react'
|
|
6
|
+
import { Oas } from '../components/Oas.tsx'
|
|
9
7
|
import type { OperationSchemas } from '../types.ts'
|
|
10
8
|
|
|
11
9
|
type FileMeta = FileMetaBase & {
|
|
@@ -66,7 +64,8 @@ type UseOperationManagerResult = {
|
|
|
66
64
|
* `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
|
|
67
65
|
*/
|
|
68
66
|
export function useOperationManager(): UseOperationManagerResult {
|
|
69
|
-
const
|
|
67
|
+
const plugin = usePlugin()
|
|
68
|
+
const pluginManager = usePluginManager()
|
|
70
69
|
const { generator } = useContext(Oas.Context)
|
|
71
70
|
|
|
72
71
|
const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { useApp } from '@kubb/react'
|
|
2
|
-
|
|
3
1
|
import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
|
|
4
2
|
import type { KubbFile } from '@kubb/core/fs'
|
|
3
|
+
import { usePlugin, usePluginManager } from '@kubb/core/hooks'
|
|
5
4
|
import { SchemaGenerator } from '../SchemaGenerator.ts'
|
|
6
5
|
import { type Schema, schemaKeywords } from '../SchemaMapper'
|
|
7
6
|
|
|
@@ -35,7 +34,8 @@ type UseSchemaManagerResult = {
|
|
|
35
34
|
* `useSchemaManager` will return some helper functions that can be used to get the schema file, get the schema name.
|
|
36
35
|
*/
|
|
37
36
|
export function useSchemaManager(): UseSchemaManagerResult {
|
|
38
|
-
const
|
|
37
|
+
const plugin = usePlugin()
|
|
38
|
+
const pluginManager = usePluginManager()
|
|
39
39
|
|
|
40
40
|
const getName: UseSchemaManagerResult['getName'] = (name, { pluginKey = plugin.key, type }) => {
|
|
41
41
|
return pluginManager.resolveName({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-CW7v1RgJ.js","names":[],"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;;AAyCA,SAAgB,gBAAuD,cAA+D;AACpI,QAAO;;;;;;;;;AAiBT,SAAgB,qBAA4D,cAAoE;AAC9I,QAAO;EACL,GAAG;EACH,MAAM,WAAW,EAAE,UAAU,SAAS,cAAc;AAClD,OAAI,CAAC,aAAa,WAChB,QAAO,EAAE;GAGX,MAAM,EAAE,eAAe,KAAK,QAAQ,SAAS,SAAS;GACtD,MAAM,OAAO,WAAW,EACtB,QAAQ,cAAc,QACvB,CAAC;GACF,MAAM,YAAY,aAAa,WAAW,KAAK,KAAK;AAEpD,QAAK,OACH,oBAAC;IAAmB;IAAuB;IAAc;cACvD,oBAAC;KAAS;KAAiB;KAAY,WAAW;eAChD,oBAAC;MAAsB;MAAsB;MAAmB;OAAW;MACvE;KACF,CACP;AACD,UAAO,KAAK;;EAEd,MAAM,UAAU,EAAE,UAAU,WAAW,WAAW;AAChD,OAAI,CAAC,aAAa,UAChB,QAAO,EAAE;GAGX,MAAM,EAAE,eAAe,KAAK,QAAQ,SAAS,SAAS;GACtD,MAAM,OAAO,WAAW,EACtB,QAAQ,cAAc,QACvB,CAAC;GACF,MAAM,YAAY,aAAa,UAAU,KAAK,KAAK;AAEnD,QAAK,OACH,oBAAC;IAAmB;IAAe,QAAQ;KAAE,GAAG;KAAQ;KAAS;IAAQ;cACvE,oBAAC;KAAS;KAAK,YAAY,CAAC,UAAU;KAAE,WAAW;eACjD,oBAAC,IAAI;MAAqB;gBACxB,oBAAC;OAAqB;OAAoB;OAAmB;QAAY;OAC3D;MACZ;KACF,CACP;AACD,UAAO,KAAK;;EAEd,MAAM,OAAO,EAAE,UAAU,QAAQ,WAAW;AAC1C,OAAI,CAAC,aAAa,OAChB,QAAO,EAAE;GAGX,MAAM,EAAE,eAAe,KAAK,QAAQ,SAAS,SAAS;GAEtD,MAAM,YAAY,aAAa,OAAO,KAAK,KAAK;GAChD,MAAM,OAAO,WAAW,EACtB,QAAQ,cAAc,QACvB,CAAC;AACF,QAAK,OACH,oBAAC;IAAmB;IAAe,QAAQ;KAAE,GAAG;KAAQ;KAAS;IAAQ;cACvE,oBAAC;KAAS;eACR,oBAAC,IAAI;MAAO,MAAM,OAAO;MAAM,cAAc,OAAO;MAAO,MAAM,OAAO;gBACtE,oBAAC;OAAkB;OAAiB;OAAmB;QAAY;OACxD;MACT;KACF,CACP;AACD,UAAO,KAAK;;EAEf;;;;;ACxHH,MAAa,gBAAgB,gBAA2B;CACtD,MAAM;CACN,MAAM,OAAO,EAAE,QAAQ,YAAY;EACjC,MAAM,EAAE,eAAe,WAAW,SAAS;AAQ3C,SAAO,CACL;GACE,GATS,cAAc,QAAQ;IACjC,MAAM,UAAU,OAAO,KAAK;IAC5B,SAAS;IACT,MAAM;IACN,WAAW,OAAO;IACnB,CAAC;GAKE,SAAS,CACP;IACE,MAAM,UAAU,OAAO,KAAK;IAC5B,cAAc;IACd,aAAa;IACb,OAAO,KAAK,UAAU,OAAO,MAAM;IACpC,CACF;GACD,QAAQ,UAAU;IAChB,KAAK,SAAS,QAAQ;IACtB,QAAQ,OAAO,QAAQ;IACvB,QAAQ,cAAc;IACvB,CAAC;GACF,QAAQ,UAAU;IAAE,KAAK,SAAS,QAAQ;IAAK,QAAQ,OAAO,QAAQ;IAAQ,CAAC;GAChF,CACF;;CAEJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-L3av7_7B.cjs","names":["App","Oas","getBanner","getFooter"],"sources":["../src/generator.tsx","../src/generators/jsonGenerator.ts"],"sourcesContent":["import type { PluginFactoryOptions } from '@kubb/core'\nimport type { KubbFile } from '@kubb/core/fs'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createRoot } from '@kubb/react'\nimport type { KubbNode } from '@kubb/react/types'\nimport { Oas } from './components/Oas.tsx'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype OperationsProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operations: Array<Operation>\n}\n\ntype OperationProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<OperationGenerator<TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n operation: Operation\n}\n\ntype SchemaProps<TOptions extends PluginFactoryOptions> = {\n instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n options: TOptions['resolvedOptions']\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n }\n}\n\nexport type GeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n operations?: (this: GeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>\n operation?: (this: GeneratorOptions<TOptions>, props: OperationProps<TOptions>) => Promise<KubbFile.File[]>\n schema?: (this: GeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>\n}\n\nexport type Generator<TOptions extends PluginFactoryOptions> = GeneratorOptions<TOptions>\n\nexport function createGenerator<TOptions extends PluginFactoryOptions>(parseOptions: GeneratorOptions<TOptions>): Generator<TOptions> {\n return parseOptions\n}\n\nexport type ReactGeneratorOptions<TOptions extends PluginFactoryOptions> = {\n name: string\n Operations?: (this: ReactGeneratorOptions<TOptions>, props: OperationsProps<TOptions>) => KubbNode\n Operation?: (this: ReactGeneratorOptions<TOptions>, props: OperationProps<TOptions>) => KubbNode\n Schema?: (this: ReactGeneratorOptions<TOptions>, props: SchemaProps<TOptions>) => KubbNode\n}\n\n/****\n * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.\n *\n * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.\n *\n * @returns A generator object with async methods for operations, operation, and schema file generation.\n */\nexport function createReactGenerator<TOptions extends PluginFactoryOptions>(parseOptions: ReactGeneratorOptions<TOptions>): Generator<TOptions> {\n return {\n ...parseOptions,\n async operations({ instance, options, operations }) {\n if (!parseOptions.Operations) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operations.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={plugin} mode={mode}>\n <Oas oas={oas} operations={operations} generator={instance}>\n <Component operations={operations} instance={instance} options={options} />\n </Oas>\n </App>,\n )\n return root.files\n },\n async operation({ instance, operation, options }) {\n if (!parseOptions.Operation) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n const root = createRoot({\n logger: pluginManager.logger,\n })\n const Component = parseOptions.Operation.bind(this)\n\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas} operations={[operation]} generator={instance}>\n <Oas.Operation operation={operation}>\n <Component operation={operation} options={options} instance={instance} />\n </Oas.Operation>\n </Oas>\n </App>,\n )\n return root.files\n },\n async schema({ instance, schema, options }) {\n if (!parseOptions.Schema) {\n return []\n }\n\n const { pluginManager, oas, plugin, mode } = instance.context\n\n const Component = parseOptions.Schema.bind(this)\n const root = createRoot({\n logger: pluginManager.logger,\n })\n root.render(\n <App pluginManager={pluginManager} plugin={{ ...plugin, options }} mode={mode}>\n <Oas oas={oas}>\n <Oas.Schema name={schema.name} schemaObject={schema.value} tree={schema.tree}>\n <Component schema={schema} options={options} instance={instance} />\n </Oas.Schema>\n </Oas>\n </App>,\n )\n return root.files\n },\n }\n}\n","import { camelCase } from '@kubb/core/transformers'\nimport { createGenerator } from '../generator.tsx'\nimport type { PluginOas } from '../types.ts'\nimport { getBanner } from '../utils/getBanner.ts'\nimport { getFooter } from '../utils/getFooter.ts'\n\nexport const jsonGenerator = createGenerator<PluginOas>({\n name: 'plugin-oas',\n async schema({ schema, instance }) {\n const { pluginManager, plugin } = instance.context\n const file = pluginManager.getFile({\n name: camelCase(schema.name),\n extname: '.json',\n mode: 'split',\n pluginKey: plugin.key,\n })\n\n return [\n {\n ...file,\n sources: [\n {\n name: camelCase(schema.name),\n isExportable: false,\n isIndexable: false,\n value: JSON.stringify(schema.value),\n },\n ],\n banner: getBanner({\n oas: instance.context.oas,\n output: plugin.options.output,\n config: pluginManager.config,\n }),\n format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),\n },\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;AAyCA,SAAgB,gBAAuD,cAA+D;AACpI,QAAO;;;;;;;;;AAiBT,SAAgB,qBAA4D,cAAoE;AAC9I,QAAO;EACL,GAAG;EACH,MAAM,WAAW,EAAE,UAAU,SAAS,cAAc;AAClD,OAAI,CAAC,aAAa,WAChB,QAAO,EAAE;GAGX,MAAM,EAAE,eAAe,KAAK,QAAQ,SAAS,SAAS;GACtD,MAAM,oCAAkB,EACtB,QAAQ,cAAc,QACvB,CAAC;GACF,MAAM,YAAY,aAAa,WAAW,KAAK,KAAK;AAEpD,QAAK,OACH,kDAACA;IAAmB;IAAuB;IAAc;cACvD,kDAACC;KAAS;KAAiB;KAAY,WAAW;eAChD,kDAAC;MAAsB;MAAsB;MAAmB;OAAW;MACvE;KACF,CACP;AACD,UAAO,KAAK;;EAEd,MAAM,UAAU,EAAE,UAAU,WAAW,WAAW;AAChD,OAAI,CAAC,aAAa,UAChB,QAAO,EAAE;GAGX,MAAM,EAAE,eAAe,KAAK,QAAQ,SAAS,SAAS;GACtD,MAAM,oCAAkB,EACtB,QAAQ,cAAc,QACvB,CAAC;GACF,MAAM,YAAY,aAAa,UAAU,KAAK,KAAK;AAEnD,QAAK,OACH,kDAACD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IAAQ,CAAC;GAChF,CACF;;CAEJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseFromConfig-CFzprC8B.cjs","names":["Oas","api: OasTypes.OASDocument","api","api: string","yaml","URLPath"],"sources":["../src/utils/parseFromConfig.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, { oasClass })\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, { oasClass })\n } catch (_e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, { oasClass })\n }\n\n if (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, { oasClass })\n }\n\n return parse(resolve(config.root, config.input.path), { oasClass })\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,gBAAgB,QAAgB,WAAuBA,gBAAmB;AACxF,KAAI,UAAU,OAAO,OAAO;AAC1B,MAAI,OAAO,OAAO,MAAM,SAAS,UAAU;GACzC,MAAMC,QAA4B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC;AAC/E,gCAAaC,OAAK,EAAE,UAAU,CAAC;;AAGjC,MAAI;GACF,MAAMC,QAAcC,yBAAK,MAAM,OAAO,MAAM,KAAe;AAE3D,gCAAaF,OAAK,EAAE,UAAU,CAAC;WACxB,IAAI;EAIb,MAAMD,MAA4B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC;AAE/E,+BAAa,KAAK,EAAE,UAAU,CAAC;;AAGjC,KAAI,MAAM,QAAQ,OAAO,MAAM,CAC7B,8BACE,OAAO,MAAM,KAAK,UAAU,MAAM,KAAK,EACvC,EAAE,UAAU,CACb;AAGH,KAAI,IAAII,0BAAQ,OAAO,MAAM,KAAK,CAAC,MACjC,8BAAa,OAAO,MAAM,MAAM,EAAE,UAAU,CAAC;AAG/C,qDAAqB,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseFromConfig-yAiFK03V.js","names":["api: OasTypes.OASDocument","api","api: string"],"sources":["../src/utils/parseFromConfig.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { merge, parse } from '@kubb/oas'\n\nimport type { Config } from '@kubb/core'\nimport { Oas, type OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {\n if ('data' in config.input) {\n if (typeof config.input.data === 'object') {\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n return parse(api, { oasClass })\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, { oasClass })\n } catch (_e) {\n /* empty */\n }\n\n const api: OasTypes.OASDocument = JSON.parse(JSON.stringify(config.input.data)) as OasTypes.OASDocument\n\n return parse(api, { oasClass })\n }\n\n if (Array.isArray(config.input)) {\n return merge(\n config.input.map((input) => input.path),\n { oasClass },\n )\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, { oasClass })\n }\n\n return parse(resolve(config.root, config.input.path), { oasClass })\n}\n"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,QAAgB,WAAuB,KAAmB;AACxF,KAAI,UAAU,OAAO,OAAO;AAC1B,MAAI,OAAO,OAAO,MAAM,SAAS,UAAU;GACzC,MAAMA,QAA4B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC;AAC/E,UAAO,MAAMC,OAAK,EAAE,UAAU,CAAC;;AAGjC,MAAI;GACF,MAAMC,QAAc,KAAK,MAAM,OAAO,MAAM,KAAe;AAE3D,UAAO,MAAMD,OAAK,EAAE,UAAU,CAAC;WACxB,IAAI;EAIb,MAAMD,MAA4B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,CAAC;AAE/E,SAAO,MAAM,KAAK,EAAE,UAAU,CAAC;;AAGjC,KAAI,MAAM,QAAQ,OAAO,MAAM,CAC7B,QAAO,MACL,OAAO,MAAM,KAAK,UAAU,MAAM,KAAK,EACvC,EAAE,UAAU,CACb;AAGH,KAAI,IAAI,QAAQ,OAAO,MAAM,KAAK,CAAC,MACjC,QAAO,MAAM,OAAO,MAAM,MAAM,EAAE,UAAU,CAAC;AAG/C,QAAO,MAAM,QAAQ,OAAO,MAAM,OAAO,MAAM,KAAK,EAAE,EAAE,UAAU,CAAC"}
|