@kubb/plugin-oas 0.0.0-canary-20251028170426 → 0.0.0-canary-20251103125929

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.
Files changed (95) hide show
  1. package/dist/{SchemaGenerator-DWj6buY0.cjs → SchemaGenerator-B8Reay1m.cjs} +114 -16
  2. package/dist/SchemaGenerator-B8Reay1m.cjs.map +1 -0
  3. package/dist/{SchemaGenerator-b7XixzRv.js → SchemaGenerator-ChoBQWm5.js} +93 -15
  4. package/dist/SchemaGenerator-ChoBQWm5.js.map +1 -0
  5. package/dist/{SchemaMapper-DoL-a6qq.cjs → SchemaMapper-BUV8vhg0.cjs} +1 -1
  6. package/dist/{SchemaMapper-DoL-a6qq.cjs.map → SchemaMapper-BUV8vhg0.cjs.map} +1 -1
  7. package/dist/{SchemaMapper-Cx4X1al6.js → SchemaMapper-D30tqRoX.js} +1 -1
  8. package/dist/{SchemaMapper-Cx4X1al6.js.map → SchemaMapper-D30tqRoX.js.map} +1 -1
  9. package/dist/{SchemaMapper-CtfTw3hq.d.ts → SchemaMapper-m5TKynWt.d.ts} +1 -1
  10. package/dist/{OperationGenerator-CRZpkIpZ.d.ts → createGenerator-DlSlv4sR.d.ts} +114 -167
  11. package/dist/{OperationGenerator-S_1PevQN.d.cts → createGenerator-PIseu7v9.d.cts} +114 -167
  12. package/dist/{generators-C61FxVIj.js → generators-CJDEf8Kn.js} +6 -6
  13. package/dist/{generators-C61FxVIj.js.map → generators-CJDEf8Kn.js.map} +1 -1
  14. package/dist/{generators-B27La9Vd.cjs → generators-udGOxdUV.cjs} +6 -6
  15. package/dist/{generators-B27La9Vd.cjs.map → generators-udGOxdUV.cjs.map} +1 -1
  16. package/dist/generators.cjs +2 -7
  17. package/dist/generators.d.cts +7 -2
  18. package/dist/generators.d.ts +8 -3
  19. package/dist/generators.js +3 -5
  20. package/dist/{getFooter-D5MdeUVv.js → getFooter-CV73pVXj.js} +2 -2
  21. package/dist/{getFooter-D5MdeUVv.js.map → getFooter-CV73pVXj.js.map} +1 -1
  22. package/dist/{getFooter-CwjCW4h5.cjs → getFooter-DPh4lxBH.cjs} +3 -3
  23. package/dist/{getFooter-CwjCW4h5.cjs.map → getFooter-DPh4lxBH.cjs.map} +1 -1
  24. package/dist/{getSchemas-DY8s2CSl.cjs → getSchemas-CP_YS4_2.cjs} +1 -1
  25. package/dist/getSchemas-CP_YS4_2.cjs.map +1 -0
  26. package/dist/{getSchemas-Bdg6n9Qk.js → getSchemas-CTi8zYew.js} +1 -1
  27. package/dist/getSchemas-CTi8zYew.js.map +1 -0
  28. package/dist/hooks.cjs +4 -29
  29. package/dist/hooks.cjs.map +1 -1
  30. package/dist/hooks.d.cts +3 -17
  31. package/dist/hooks.d.ts +4 -18
  32. package/dist/hooks.js +6 -29
  33. package/dist/hooks.js.map +1 -1
  34. package/dist/index.cjs +37 -32
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +57 -2
  37. package/dist/index.d.ts +58 -3
  38. package/dist/index.js +32 -24
  39. package/dist/index.js.map +1 -1
  40. package/dist/mocks.cjs +1 -1
  41. package/dist/mocks.d.ts +1 -1
  42. package/dist/mocks.js +1 -1
  43. package/dist/{parseFromConfig-CqiiLCPe.js → parseFromConfig-BkUoWC2U.js} +1 -1
  44. package/dist/parseFromConfig-BkUoWC2U.js.map +1 -0
  45. package/dist/{parseFromConfig-RR31a98-.cjs → parseFromConfig-EjsCZ0-8.cjs} +1 -1
  46. package/dist/parseFromConfig-EjsCZ0-8.cjs.map +1 -0
  47. package/dist/utils.cjs +3 -3
  48. package/dist/utils.cjs.map +1 -1
  49. package/dist/utils.d.cts +23 -23
  50. package/dist/utils.d.ts +24 -24
  51. package/dist/utils.js +3 -3
  52. package/dist/utils.js.map +1 -1
  53. package/package.json +5 -12
  54. package/src/OperationGenerator.ts +26 -13
  55. package/src/SchemaGenerator.ts +18 -10
  56. package/src/generators/index.ts +0 -1
  57. package/src/generators/jsonGenerator.ts +4 -4
  58. package/src/generators/types.ts +13 -14
  59. package/src/hooks/index.ts +0 -2
  60. package/src/hooks/useOperationManager.ts +2 -4
  61. package/src/index.ts +1 -1
  62. package/src/utils/getBanner.ts +1 -1
  63. package/src/utils/getParams.ts +1 -2
  64. package/src/utils/getSchemaFactory.ts +1 -2
  65. package/src/utils/getSchemas.ts +1 -1
  66. package/src/utils/index.ts +3 -4
  67. package/src/utils/parseFromConfig.ts +2 -6
  68. package/src/utils.tsx +101 -0
  69. package/dist/Oas-CHC1IC5D.js +0 -56
  70. package/dist/Oas-CHC1IC5D.js.map +0 -1
  71. package/dist/Oas-CQrRP_NH.cjs +0 -76
  72. package/dist/Oas-CQrRP_NH.cjs.map +0 -1
  73. package/dist/Schema-CZsDEhET.d.cts +0 -38
  74. package/dist/Schema-DBvtiLS7.d.ts +0 -38
  75. package/dist/SchemaGenerator-DWj6buY0.cjs.map +0 -1
  76. package/dist/SchemaGenerator-b7XixzRv.js.map +0 -1
  77. package/dist/components.cjs +0 -5
  78. package/dist/components.d.cts +0 -38
  79. package/dist/components.d.ts +0 -38
  80. package/dist/components.js +0 -3
  81. package/dist/getSchemas-Bdg6n9Qk.js.map +0 -1
  82. package/dist/getSchemas-DY8s2CSl.cjs.map +0 -1
  83. package/dist/parseFromConfig-CqiiLCPe.js.map +0 -1
  84. package/dist/parseFromConfig-RR31a98-.cjs.map +0 -1
  85. package/dist/utils-DYf-j63H.cjs +0 -115
  86. package/dist/utils-DYf-j63H.cjs.map +0 -1
  87. package/dist/utils-DaV25sy8.js +0 -95
  88. package/dist/utils-DaV25sy8.js.map +0 -1
  89. package/src/components/Oas.tsx +0 -30
  90. package/src/components/Operation.tsx +0 -20
  91. package/src/components/Schema.tsx +0 -38
  92. package/src/components/index.ts +0 -3
  93. package/src/generators/utils.tsx +0 -114
  94. package/src/hooks/useOperation.ts +0 -18
  95. package/src/hooks/useSchema.ts +0 -16
@@ -6,8 +6,8 @@ import type { contentType, HttpMethod, Oas, OasTypes, Operation, SchemaObject }
6
6
  import type { Fabric } from '@kubb/react-fabric'
7
7
  import pLimit from 'p-limit'
8
8
  import type { Generator } from './generators/types.ts'
9
- import { buildOperation, buildOperations } from './generators/utils.tsx'
10
9
  import type { Exclude, Include, OperationSchemas, Override } from './types.ts'
10
+ import { buildOperation, buildOperations } from './utils.tsx'
11
11
 
12
12
  export type OperationMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>
13
13
 
@@ -229,12 +229,16 @@ export class OperationGenerator<
229
229
 
230
230
  if (generator.type === 'react') {
231
231
  await buildOperation(operation, {
232
+ config: this.context.pluginManager.config,
232
233
  fabric: this.context.fabric,
233
- generator,
234
- instance: this,
235
- options: {
236
- ...this.options,
237
- ...options,
234
+ Component: generator.Operation,
235
+ generator: this,
236
+ plugin: {
237
+ ...this.context.plugin,
238
+ options: {
239
+ ...this.options,
240
+ ...options,
241
+ },
238
242
  },
239
243
  })
240
244
 
@@ -242,9 +246,16 @@ export class OperationGenerator<
242
246
  }
243
247
 
244
248
  const result = await generator.operation?.({
245
- instance: this,
249
+ generator: this,
250
+ config: this.context.pluginManager.config,
246
251
  operation,
247
- options: { ...this.options, ...options },
252
+ plugin: {
253
+ ...this.context.plugin,
254
+ options: {
255
+ ...this.options,
256
+ ...options,
257
+ },
258
+ },
248
259
  })
249
260
 
250
261
  return result ?? []
@@ -259,9 +270,10 @@ export class OperationGenerator<
259
270
  operations.map((op) => op.operation),
260
271
  {
261
272
  fabric: this.context.fabric,
262
- generator,
263
- instance: this,
264
- options: this.options,
273
+ config: this.context.pluginManager.config,
274
+ Component: generator.Operations,
275
+ generator: this,
276
+ plugin: this.context.plugin,
265
277
  },
266
278
  )
267
279
 
@@ -269,9 +281,10 @@ export class OperationGenerator<
269
281
  }
270
282
 
271
283
  const operationsResult = await generator.operations?.({
272
- instance: this,
284
+ generator: this,
285
+ config: this.context.pluginManager.config,
273
286
  operations: operations.map((op) => op.operation),
274
- options: this.options,
287
+ plugin: this.context.plugin,
275
288
  })
276
289
 
277
290
  return [...opResultsFlat, ...(operationsResult ?? [])] as unknown as KubbFile.File<TFileMeta>
@@ -9,12 +9,12 @@ import type { Fabric } from '@kubb/react-fabric'
9
9
  import pLimit from 'p-limit'
10
10
  import { isDeepEqual, isNumber, uniqueWith } from 'remeda'
11
11
  import type { Generator } from './generators/types.ts'
12
- import { buildSchema } from './generators/utils.tsx'
13
12
  import type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'
14
13
  import { isKeyword, schemaKeywords } from './SchemaMapper.ts'
15
14
  import type { OperationSchema, Override, Refs } from './types.ts'
16
15
  import { getSchemaFactory } from './utils/getSchemaFactory.ts'
17
16
  import { getSchemas } from './utils/getSchemas.ts'
17
+ import { buildSchema } from './utils.tsx'
18
18
 
19
19
  export type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never
20
20
 
@@ -1127,12 +1127,16 @@ export class SchemaGenerator<
1127
1127
  tree,
1128
1128
  },
1129
1129
  {
1130
+ config: this.context.pluginManager.config,
1130
1131
  fabric: this.context.fabric,
1131
- generator,
1132
- instance: this,
1133
- options: {
1134
- ...this.options,
1135
- ...options,
1132
+ Component: generator.Schema,
1133
+ generator: this,
1134
+ plugin: {
1135
+ ...this.context.plugin,
1136
+ options: {
1137
+ ...this.options,
1138
+ ...options,
1139
+ },
1136
1140
  },
1137
1141
  },
1138
1142
  )
@@ -1141,15 +1145,19 @@ export class SchemaGenerator<
1141
1145
  }
1142
1146
 
1143
1147
  const result = await generator.schema?.({
1144
- instance: this,
1148
+ config: this.context.pluginManager.config,
1149
+ generator: this,
1145
1150
  schema: {
1146
1151
  name,
1147
1152
  value: schemaObject,
1148
1153
  tree,
1149
1154
  },
1150
- options: {
1151
- ...this.options,
1152
- ...options,
1155
+ plugin: {
1156
+ ...this.context.plugin,
1157
+ options: {
1158
+ ...this.options,
1159
+ ...options,
1160
+ },
1153
1161
  },
1154
1162
  })
1155
1163
 
@@ -2,4 +2,3 @@ export { createGenerator } from './createGenerator.ts'
2
2
  export { createReactGenerator } from './createReactGenerator.ts'
3
3
  export { jsonGenerator } from './jsonGenerator.ts'
4
4
  export type { Generator } from './types.ts'
5
- export { buildOperation, buildOperations, buildSchema } from './utils.tsx'
@@ -6,8 +6,8 @@ import { createGenerator } from './createGenerator.ts'
6
6
 
7
7
  export const jsonGenerator = createGenerator<PluginOas>({
8
8
  name: 'plugin-oas',
9
- async schema({ schema, instance }) {
10
- const { pluginManager, plugin } = instance.context
9
+ async schema({ schema, generator }) {
10
+ const { pluginManager, plugin } = generator.context
11
11
  const file = pluginManager.getFile({
12
12
  name: camelCase(schema.name),
13
13
  extname: '.json',
@@ -27,11 +27,11 @@ export const jsonGenerator = createGenerator<PluginOas>({
27
27
  },
28
28
  ],
29
29
  banner: getBanner({
30
- oas: instance.context.oas,
30
+ oas: generator.context.oas,
31
31
  output: plugin.options.output,
32
32
  config: pluginManager.config,
33
33
  }),
34
- format: getFooter({ oas: instance.context.oas, output: plugin.options.output }),
34
+ format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),
35
35
  },
36
36
  ]
37
37
  },
@@ -1,30 +1,29 @@
1
- import type { PluginFactoryOptions } from '@kubb/core'
1
+ import type { Config, Plugin, PluginFactoryOptions } from '@kubb/core'
2
2
  import type { Operation, SchemaObject } from '@kubb/oas'
3
- import type { OperationGenerator, Schema, SchemaGenerator, SchemaGeneratorOptions } from '@kubb/plugin-oas'
3
+ import type { OperationGenerator } from '../OperationGenerator.ts'
4
+ import type { SchemaGenerator, SchemaGeneratorOptions } from '../SchemaGenerator.ts'
5
+ import type { Schema } from '../SchemaMapper.ts'
4
6
  import type { CoreGenerator } from './createGenerator.ts'
5
7
  import type { ReactGenerator } from './createReactGenerator.ts'
6
8
 
7
9
  export type OperationsProps<TOptions extends PluginFactoryOptions> = {
8
- /**
9
- * @deprecated
10
- */
11
- instance: Omit<OperationGenerator<TOptions>, 'build'>
12
- options: TOptions['resolvedOptions']
10
+ config: Config
11
+ generator: Omit<OperationGenerator<TOptions>, 'build'>
12
+ plugin: Plugin<TOptions>
13
13
  operations: Array<Operation>
14
14
  }
15
15
 
16
16
  export type OperationProps<TOptions extends PluginFactoryOptions> = {
17
- /**
18
- * @deprecated
19
- */
20
- instance: Omit<OperationGenerator<TOptions>, 'build'>
21
- options: TOptions['resolvedOptions']
17
+ config: Config
18
+ generator: Omit<OperationGenerator<TOptions>, 'build'>
19
+ plugin: Plugin<TOptions>
22
20
  operation: Operation
23
21
  }
24
22
 
25
23
  export type SchemaProps<TOptions extends PluginFactoryOptions> = {
26
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>
27
- options: TOptions['resolvedOptions']
24
+ config: Config
25
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>
26
+ plugin: Plugin<TOptions>
28
27
  schema: {
29
28
  name: string
30
29
  tree: Array<Schema>
@@ -1,6 +1,4 @@
1
1
  export { useOas } from './useOas.ts'
2
- export { useOperation } from './useOperation.ts'
3
2
  export type { SchemaNames } from './useOperationManager.ts'
4
3
  export { useOperationManager } from './useOperationManager.ts'
5
- export { useSchema } from './useSchema.ts'
6
4
  export { useSchemaManager } from './useSchemaManager.ts'
@@ -2,8 +2,7 @@ import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
2
2
  import { usePlugin, usePluginManager } from '@kubb/core/hooks'
3
3
  import type { KubbFile } from '@kubb/fabric-core/types'
4
4
  import type { Operation, Operation as OperationType } from '@kubb/oas'
5
- import { useContext } from '@kubb/react-fabric'
6
- import { Oas } from '../components/Oas.tsx'
5
+ import type { OperationGenerator } from '../OperationGenerator.ts'
7
6
  import type { OperationSchemas } from '../types.ts'
8
7
 
9
8
  type FileMeta = FileMetaBase & {
@@ -63,10 +62,9 @@ type UseOperationManagerResult = {
63
62
  /**
64
63
  * `useOperationManager` will return some helper functions that can be used to get the operation file, get the operation name.
65
64
  */
66
- export function useOperationManager(): UseOperationManagerResult {
65
+ export function useOperationManager(generator: Omit<OperationGenerator, 'build'>): UseOperationManagerResult {
67
66
  const plugin = usePlugin()
68
67
  const pluginManager = usePluginManager()
69
- const { generator } = useContext(Oas.Context)
70
68
 
71
69
  const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginKey = plugin.key, type }) => {
72
70
  return pluginManager.resolveName({
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './generators/index.ts'
2
1
  export type { OperationMethodResult } from './OperationGenerator.ts'
3
2
  export { OperationGenerator } from './OperationGenerator.ts'
4
3
  export { pluginOas, pluginOasName } from './plugin.ts'
@@ -19,3 +18,4 @@ export type {
19
18
  } from './SchemaMapper.ts'
20
19
  export { isKeyword, schemaKeywords } from './SchemaMapper.ts'
21
20
  export type * from './types.ts'
21
+ export { buildOperation, buildOperations, buildSchema } from './utils.tsx'
@@ -1,7 +1,7 @@
1
+ import path from 'node:path'
1
2
  import type { Config, Output } from '@kubb/core'
2
3
  import type { Oas } from '@kubb/oas'
3
4
  import { isFunction } from 'remeda'
4
- import path from 'node:path'
5
5
 
6
6
  type Props<TOas extends Oas> = {
7
7
  oas: TOas
@@ -1,8 +1,7 @@
1
- import { isParameterObject } from '@kubb/oas'
2
-
3
1
  import { camelCase, isValidVarName } from '@kubb/core/transformers'
4
2
  import type { FunctionParamsAST } from '@kubb/core/utils'
5
3
  import type { OasTypes } from '@kubb/oas'
4
+ import { isParameterObject } from '@kubb/oas'
6
5
  import type { Params } from '@kubb/react-fabric/types'
7
6
  import type { OperationSchema } from '../types.ts'
8
7
  /**
@@ -1,6 +1,5 @@
1
- import { isOpenApiV3_1Document } from '@kubb/oas'
2
-
3
1
  import type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'
2
+ import { isOpenApiV3_1Document } from '@kubb/oas'
4
3
 
5
4
  /**
6
5
  * Make it possible to narrow down the schema based on a specific version(3 or 3.1)
@@ -1,4 +1,4 @@
1
- import type { Oas, OasTypes, contentType } from '@kubb/oas'
1
+ import type { contentType, Oas, OasTypes } from '@kubb/oas'
2
2
 
3
3
  type Mode = 'schemas' | 'responses' | 'requestBodies'
4
4
 
@@ -1,9 +1,8 @@
1
+ export { isOptional } from '@kubb/oas'
2
+ export { getBanner } from './getBanner.ts'
1
3
  export { getComments } from './getComments.ts'
4
+ export { getFooter } from './getFooter.ts'
2
5
  export { getPathParams } from './getParams.ts'
3
6
  export { getSchemaFactory } from './getSchemaFactory.ts'
4
7
  export { getSchemas } from './getSchemas.ts'
5
8
  export { parseFromConfig } from './parseFromConfig.ts'
6
- export { getBanner } from './getBanner.ts'
7
- export { getFooter } from './getFooter.ts'
8
-
9
- export { isOptional } from '@kubb/oas'
@@ -1,11 +1,7 @@
1
1
  import { resolve } from 'node:path'
2
-
3
- import { URLPath } from '@kubb/core/utils'
4
-
5
- import { merge, parse } from '@kubb/oas'
6
-
7
2
  import type { Config } from '@kubb/core'
8
- import { Oas, type OasTypes } from '@kubb/oas'
3
+ import { URLPath } from '@kubb/core/utils'
4
+ import { merge, Oas, type OasTypes, parse } from '@kubb/oas'
9
5
  import yaml from '@stoplight/yaml'
10
6
 
11
7
  export function parseFromConfig(config: Config, oasClass: typeof Oas = Oas): Promise<Oas> {
package/src/utils.tsx ADDED
@@ -0,0 +1,101 @@
1
+ import type { Config, Plugin, PluginFactoryOptions } from '@kubb/core'
2
+ import type { Operation, SchemaObject } from '@kubb/oas'
3
+ import { App, createReactFabric, type Fabric } from '@kubb/react-fabric'
4
+ import type { ReactGenerator } from './generators/createReactGenerator.ts'
5
+ import type { OperationGenerator } from './OperationGenerator.ts'
6
+ import type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'
7
+ import type { Schema } from './SchemaMapper.ts'
8
+
9
+ type BuildOperationsOptions<TOptions extends PluginFactoryOptions> = {
10
+ config: Config
11
+ fabric: Fabric
12
+ Component: ReactGenerator<any>['Operations']
13
+ generator: Omit<OperationGenerator<TOptions>, 'build'>
14
+ plugin: Plugin<TOptions>
15
+ }
16
+
17
+ export async function buildOperations<TOptions extends PluginFactoryOptions>(
18
+ operations: Array<Operation>,
19
+ { config, fabric, plugin, generator, Component }: BuildOperationsOptions<TOptions>,
20
+ ): Promise<void> {
21
+ if (!Component) {
22
+ return undefined
23
+ }
24
+
25
+ const { pluginManager, oas, mode } = generator.context
26
+
27
+ const fabricChild = createReactFabric()
28
+ fabricChild.render(() => {
29
+ return (
30
+ <App meta={{ pluginManager, plugin, mode, oas }}>
31
+ <Component config={config} operations={operations} generator={generator} plugin={plugin} />
32
+ </App>
33
+ )
34
+ })
35
+
36
+ await fabric.context.fileManager.add(...fabricChild.files)
37
+ }
38
+
39
+ type BuildOperationOptions<TOptions extends PluginFactoryOptions> = {
40
+ config: Config
41
+ fabric: Fabric
42
+ Component: ReactGenerator<any>['Operation']
43
+ generator: Omit<OperationGenerator<TOptions>, 'build'>
44
+ plugin: Plugin<TOptions>
45
+ }
46
+
47
+ export async function buildOperation<TOptions extends PluginFactoryOptions>(
48
+ operation: Operation,
49
+ { config, fabric, plugin, generator, Component }: BuildOperationOptions<TOptions>,
50
+ ): Promise<void> {
51
+ if (!Component) {
52
+ return undefined
53
+ }
54
+
55
+ const { pluginManager, oas, mode } = generator.context
56
+
57
+ const fabricChild = createReactFabric()
58
+ fabricChild.render(() => {
59
+ return (
60
+ <App meta={{ pluginManager, plugin, mode, oas }}>
61
+ <Component config={config} operation={operation} plugin={plugin} generator={generator} />
62
+ </App>
63
+ )
64
+ })
65
+
66
+ await fabric.context.fileManager.add(...fabricChild.files)
67
+ }
68
+
69
+ type BuildSchemaOptions<TOptions extends PluginFactoryOptions> = {
70
+ config: Config
71
+ fabric: Fabric
72
+ Component: ReactGenerator<any>['Schema']
73
+ generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>
74
+ plugin: Plugin<TOptions>
75
+ }
76
+
77
+ export async function buildSchema<TOptions extends PluginFactoryOptions>(
78
+ schema: {
79
+ name: string
80
+ tree: Array<Schema>
81
+ value: SchemaObject
82
+ },
83
+ { config, fabric, plugin, Component, generator }: BuildSchemaOptions<TOptions>,
84
+ ): Promise<void> {
85
+ if (!Component) {
86
+ return undefined
87
+ }
88
+
89
+ const { pluginManager, oas, mode } = generator.context
90
+
91
+ const fabricChild = createReactFabric()
92
+ fabricChild.render(() => {
93
+ return (
94
+ <App meta={{ pluginManager, plugin, mode, oas }}>
95
+ <Component config={config} schema={schema} plugin={plugin} generator={generator} />
96
+ </App>
97
+ )
98
+ })
99
+
100
+ await fabric.context.fileManager.add(...fabricChild.files)
101
+ }
@@ -1,56 +0,0 @@
1
- import { createContext } from "@kubb/react-fabric";
2
- import { jsx } from "@kubb/react-fabric/jsx-runtime";
3
-
4
- //#region src/components/Operation.tsx
5
- const OperationContext = createContext({});
6
- function Operation({ operation, children }) {
7
- return /* @__PURE__ */ jsx(OperationContext.Provider, {
8
- value: { operation },
9
- children
10
- });
11
- }
12
- Operation.Context = OperationContext;
13
-
14
- //#endregion
15
- //#region src/components/Schema.tsx
16
- const SchemaContext = createContext({
17
- name: "unknown",
18
- tree: []
19
- });
20
- /**
21
- * Provides schema-related context to descendant components.
22
- *
23
- * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.
24
- *
25
- * @param name - The name of the schema.
26
- * @param schemaObject - The schema object to provide in context, if available.
27
- * @param tree - An array representing the schema type hierarchy.
28
- */
29
- function Schema({ name, schemaObject, tree = [], children }) {
30
- return /* @__PURE__ */ jsx(SchemaContext.Provider, {
31
- value: {
32
- name,
33
- schemaObject,
34
- tree
35
- },
36
- children
37
- });
38
- }
39
- Schema.Context = SchemaContext;
40
-
41
- //#endregion
42
- //#region src/components/Oas.tsx
43
- const OasContext = createContext({});
44
- function Oas({ children, generator }) {
45
- return /* @__PURE__ */ jsx(OasContext.Provider, {
46
- value: { generator },
47
- children
48
- });
49
- }
50
- Oas.Context = OasContext;
51
- Oas.Operation = Operation;
52
- Oas.Schema = Schema;
53
-
54
- //#endregion
55
- export { Schema as n, Operation as r, Oas as t };
56
- //# sourceMappingURL=Oas-CHC1IC5D.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Oas-CHC1IC5D.js","names":[],"sources":["../src/components/Operation.tsx","../src/components/Schema.tsx","../src/components/Oas.tsx"],"sourcesContent":["import type { Operation as OperationType } from '@kubb/oas'\nimport { createContext } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n operation: OperationType\n children?: KubbNode\n}\n\ntype OperationContextProps = {\n operation?: OperationType\n}\n\nconst OperationContext = createContext<OperationContextProps>({})\n\nexport function Operation({ operation, children }: Props): KubbNode {\n return <OperationContext.Provider value={{ operation }}>{children}</OperationContext.Provider>\n}\n\nOperation.Context = OperationContext\n","import type { SchemaObject } from '@kubb/oas'\nimport { createContext } from '@kubb/react-fabric'\nimport type { Key, KubbNode } from '@kubb/react-fabric/types'\nimport type { Schema as SchemaType } from '../SchemaMapper.ts'\n\nexport type SchemaContextProps = {\n name: string\n schemaObject?: SchemaObject\n tree: Array<SchemaType>\n}\n\ntype Props = {\n key?: Key\n name: string\n schemaObject?: SchemaObject\n tree?: Array<SchemaType>\n children?: KubbNode\n}\n\nconst SchemaContext = createContext<SchemaContextProps>({\n name: 'unknown',\n tree: [],\n})\n\n/**\n * Provides schema-related context to descendant components.\n *\n * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.\n *\n * @param name - The name of the schema.\n * @param schemaObject - The schema object to provide in context, if available.\n * @param tree - An array representing the schema type hierarchy.\n */\nexport function Schema({ name, schemaObject, tree = [], children }: Props): KubbNode {\n return <SchemaContext.Provider value={{ name, schemaObject, tree }}>{children}</SchemaContext.Provider>\n}\n\nSchema.Context = SchemaContext\n","import { createContext } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { OperationGenerator } from '../OperationGenerator.ts'\nimport { Operation } from './Operation.tsx'\nimport { Schema } from './Schema.tsx'\n\ntype Props = {\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n children?: KubbNode\n}\n\ntype OasContextProps = {\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n}\n\nconst OasContext = createContext<OasContextProps>({})\n\nexport function Oas({ children, generator }: Props): KubbNode {\n return <OasContext.Provider value={{ generator }}>{children}</OasContext.Provider>\n}\n\nOas.Context = OasContext\nOas.Operation = Operation\nOas.Schema = Schema\n"],"mappings":";;;;AAaA,MAAM,mBAAmB,cAAqC,EAAE,CAAC;AAEjE,SAAgB,UAAU,EAAE,WAAW,YAA6B;AAClE,QAAO,oBAAC,iBAAiB;EAAS,OAAO,EAAE,WAAW;EAAG;GAAqC;;AAGhG,UAAU,UAAU;;;;ACApB,MAAM,gBAAgB,cAAkC;CACtD,MAAM;CACN,MAAM,EAAE;CACT,CAAC;;;;;;;;;;AAWF,SAAgB,OAAO,EAAE,MAAM,cAAc,OAAO,EAAE,EAAE,YAA6B;AACnF,QAAO,oBAAC,cAAc;EAAS,OAAO;GAAE;GAAM;GAAc;GAAM;EAAG;GAAkC;;AAGzG,OAAO,UAAU;;;;AChBjB,MAAM,aAAa,cAA+B,EAAE,CAAC;AAErD,SAAgB,IAAI,EAAE,UAAU,aAA8B;AAC5D,QAAO,oBAAC,WAAW;EAAS,OAAO,EAAE,WAAW;EAAG;GAA+B;;AAGpF,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,SAAS"}
@@ -1,76 +0,0 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- let __kubb_react_fabric = require("@kubb/react-fabric");
3
- __kubb_react_fabric = require_chunk.__toESM(__kubb_react_fabric);
4
- let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
5
- __kubb_react_fabric_jsx_runtime = require_chunk.__toESM(__kubb_react_fabric_jsx_runtime);
6
-
7
- //#region src/components/Operation.tsx
8
- const OperationContext = (0, __kubb_react_fabric.createContext)({});
9
- function Operation({ operation, children }) {
10
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(OperationContext.Provider, {
11
- value: { operation },
12
- children
13
- });
14
- }
15
- Operation.Context = OperationContext;
16
-
17
- //#endregion
18
- //#region src/components/Schema.tsx
19
- const SchemaContext = (0, __kubb_react_fabric.createContext)({
20
- name: "unknown",
21
- tree: []
22
- });
23
- /**
24
- * Provides schema-related context to descendant components.
25
- *
26
- * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.
27
- *
28
- * @param name - The name of the schema.
29
- * @param schemaObject - The schema object to provide in context, if available.
30
- * @param tree - An array representing the schema type hierarchy.
31
- */
32
- function Schema({ name, schemaObject, tree = [], children }) {
33
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(SchemaContext.Provider, {
34
- value: {
35
- name,
36
- schemaObject,
37
- tree
38
- },
39
- children
40
- });
41
- }
42
- Schema.Context = SchemaContext;
43
-
44
- //#endregion
45
- //#region src/components/Oas.tsx
46
- const OasContext = (0, __kubb_react_fabric.createContext)({});
47
- function Oas({ children, generator }) {
48
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(OasContext.Provider, {
49
- value: { generator },
50
- children
51
- });
52
- }
53
- Oas.Context = OasContext;
54
- Oas.Operation = Operation;
55
- Oas.Schema = Schema;
56
-
57
- //#endregion
58
- Object.defineProperty(exports, 'Oas', {
59
- enumerable: true,
60
- get: function () {
61
- return Oas;
62
- }
63
- });
64
- Object.defineProperty(exports, 'Operation', {
65
- enumerable: true,
66
- get: function () {
67
- return Operation;
68
- }
69
- });
70
- Object.defineProperty(exports, 'Schema', {
71
- enumerable: true,
72
- get: function () {
73
- return Schema;
74
- }
75
- });
76
- //# sourceMappingURL=Oas-CQrRP_NH.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Oas-CQrRP_NH.cjs","names":[],"sources":["../src/components/Operation.tsx","../src/components/Schema.tsx","../src/components/Oas.tsx"],"sourcesContent":["import type { Operation as OperationType } from '@kubb/oas'\nimport { createContext } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n operation: OperationType\n children?: KubbNode\n}\n\ntype OperationContextProps = {\n operation?: OperationType\n}\n\nconst OperationContext = createContext<OperationContextProps>({})\n\nexport function Operation({ operation, children }: Props): KubbNode {\n return <OperationContext.Provider value={{ operation }}>{children}</OperationContext.Provider>\n}\n\nOperation.Context = OperationContext\n","import type { SchemaObject } from '@kubb/oas'\nimport { createContext } from '@kubb/react-fabric'\nimport type { Key, KubbNode } from '@kubb/react-fabric/types'\nimport type { Schema as SchemaType } from '../SchemaMapper.ts'\n\nexport type SchemaContextProps = {\n name: string\n schemaObject?: SchemaObject\n tree: Array<SchemaType>\n}\n\ntype Props = {\n key?: Key\n name: string\n schemaObject?: SchemaObject\n tree?: Array<SchemaType>\n children?: KubbNode\n}\n\nconst SchemaContext = createContext<SchemaContextProps>({\n name: 'unknown',\n tree: [],\n})\n\n/**\n * Provides schema-related context to descendant components.\n *\n * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.\n *\n * @param name - The name of the schema.\n * @param schemaObject - The schema object to provide in context, if available.\n * @param tree - An array representing the schema type hierarchy.\n */\nexport function Schema({ name, schemaObject, tree = [], children }: Props): KubbNode {\n return <SchemaContext.Provider value={{ name, schemaObject, tree }}>{children}</SchemaContext.Provider>\n}\n\nSchema.Context = SchemaContext\n","import { createContext } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { OperationGenerator } from '../OperationGenerator.ts'\nimport { Operation } from './Operation.tsx'\nimport { Schema } from './Schema.tsx'\n\ntype Props = {\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n children?: KubbNode\n}\n\ntype OasContextProps = {\n /**\n * @deprecated\n */\n generator?: Omit<OperationGenerator, 'build'>\n}\n\nconst OasContext = createContext<OasContextProps>({})\n\nexport function Oas({ children, generator }: Props): KubbNode {\n return <OasContext.Provider value={{ generator }}>{children}</OasContext.Provider>\n}\n\nOas.Context = OasContext\nOas.Operation = Operation\nOas.Schema = Schema\n"],"mappings":";;;;;;;AAaA,MAAM,0DAAwD,EAAE,CAAC;AAEjE,SAAgB,UAAU,EAAE,WAAW,YAA6B;AAClE,QAAO,yDAAC,iBAAiB;EAAS,OAAO,EAAE,WAAW;EAAG;GAAqC;;AAGhG,UAAU,UAAU;;;;ACApB,MAAM,uDAAkD;CACtD,MAAM;CACN,MAAM,EAAE;CACT,CAAC;;;;;;;;;;AAWF,SAAgB,OAAO,EAAE,MAAM,cAAc,OAAO,EAAE,EAAE,YAA6B;AACnF,QAAO,yDAAC,cAAc;EAAS,OAAO;GAAE;GAAM;GAAc;GAAM;EAAG;GAAkC;;AAGzG,OAAO,UAAU;;;;AChBjB,MAAM,oDAA4C,EAAE,CAAC;AAErD,SAAgB,IAAI,EAAE,UAAU,aAA8B;AAC5D,QAAO,yDAAC,WAAW;EAAS,OAAO,EAAE,WAAW;EAAG;GAA+B;;AAGpF,IAAI,UAAU;AACd,IAAI,YAAY;AAChB,IAAI,SAAS"}
@@ -1,38 +0,0 @@
1
- import { z as SchemaObject } from "./OperationGenerator-S_1PevQN.cjs";
2
- import { t as Schema } from "./SchemaMapper-CX7sIIuZ.cjs";
3
- import { Key, KubbNode } from "@kubb/react-fabric/types";
4
-
5
- //#region src/components/Schema.d.ts
6
- type SchemaContextProps = {
7
- name: string;
8
- schemaObject?: SchemaObject;
9
- tree: Array<Schema>;
10
- };
11
- type Props = {
12
- key?: Key;
13
- name: string;
14
- schemaObject?: SchemaObject;
15
- tree?: Array<Schema>;
16
- children?: KubbNode;
17
- };
18
- /**
19
- * Provides schema-related context to descendant components.
20
- *
21
- * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.
22
- *
23
- * @param name - The name of the schema.
24
- * @param schemaObject - The schema object to provide in context, if available.
25
- * @param tree - An array representing the schema type hierarchy.
26
- */
27
- declare function Schema$1({
28
- name,
29
- schemaObject,
30
- tree,
31
- children
32
- }: Props): KubbNode;
33
- declare namespace Schema$1 {
34
- var Context;
35
- }
36
- //#endregion
37
- export { SchemaContextProps as n, Schema$1 as t };
38
- //# sourceMappingURL=Schema-CZsDEhET.d.cts.map
@@ -1,38 +0,0 @@
1
- import { z as SchemaObject } from "./OperationGenerator-CRZpkIpZ.js";
2
- import { t as Schema } from "./SchemaMapper-CtfTw3hq.js";
3
- import { Key, KubbNode } from "@kubb/react-fabric/types";
4
-
5
- //#region src/components/Schema.d.ts
6
- type SchemaContextProps = {
7
- name: string;
8
- schemaObject?: SchemaObject;
9
- tree: Array<Schema>;
10
- };
11
- type Props = {
12
- key?: Key;
13
- name: string;
14
- schemaObject?: SchemaObject;
15
- tree?: Array<Schema>;
16
- children?: KubbNode;
17
- };
18
- /**
19
- * Provides schema-related context to descendant components.
20
- *
21
- * Wraps its children with a context containing the schema name, optional schema object, and an optional schema type tree.
22
- *
23
- * @param name - The name of the schema.
24
- * @param schemaObject - The schema object to provide in context, if available.
25
- * @param tree - An array representing the schema type hierarchy.
26
- */
27
- declare function Schema$1({
28
- name,
29
- schemaObject,
30
- tree,
31
- children
32
- }: Props): KubbNode;
33
- declare namespace Schema$1 {
34
- var Context;
35
- }
36
- //#endregion
37
- export { SchemaContextProps as n, Schema$1 as t };
38
- //# sourceMappingURL=Schema-DBvtiLS7.d.ts.map