@kubb/plugin-oas 2.18.3 → 2.18.5
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/{OperationGenerator-X6CTMfhG.d.cts → OperationGenerator-B6_KXF47.d.cts} +12 -11
- package/dist/{OperationGenerator-DvnXUUp4.d.ts → OperationGenerator-BL3W1CH2.d.ts} +12 -11
- package/dist/{Schema-DFZBfjF2.d.ts → Schema-ByMOp8RL.d.ts} +6 -12
- package/dist/{Schema-BWPWyiQO.d.cts → Schema-C9Wxng-Q.d.cts} +6 -12
- package/dist/{SchemaGenerator-hK5SHxTI.d.ts → SchemaMapper-DRlWYDvv.d.cts} +2 -74
- package/dist/{SchemaGenerator-z_7YrAAB.d.cts → SchemaMapper-DRlWYDvv.d.ts} +2 -74
- package/dist/{chunk-LQ6IAWRX.js → chunk-37DRAF2Z.js} +51 -4
- package/dist/chunk-37DRAF2Z.js.map +1 -0
- package/dist/chunk-CTFUZW3D.cjs +682 -0
- package/dist/chunk-CTFUZW3D.cjs.map +1 -0
- package/dist/{chunk-EPTOYYAP.js → chunk-FL37EDQ2.js} +12 -30
- package/dist/{chunk-EPTOYYAP.js.map → chunk-FL37EDQ2.js.map} +1 -1
- package/dist/chunk-JWIFGIVZ.js +34 -0
- package/dist/chunk-JWIFGIVZ.js.map +1 -0
- package/dist/{chunk-H52M2RUX.cjs → chunk-OUN5NRHC.cjs} +30 -48
- package/dist/chunk-OUN5NRHC.cjs.map +1 -0
- package/dist/chunk-QLNCBDLM.js +682 -0
- package/dist/chunk-QLNCBDLM.js.map +1 -0
- package/dist/chunk-R4EI2NRQ.cjs +34 -0
- package/dist/chunk-R4EI2NRQ.cjs.map +1 -0
- package/dist/chunk-SSSTH6CP.cjs +115 -0
- package/dist/chunk-SSSTH6CP.cjs.map +1 -0
- package/dist/components.cjs +5 -5
- package/dist/components.d.cts +5 -4
- package/dist/components.d.ts +5 -4
- package/dist/components.js +3 -3
- package/dist/hooks.cjs +13 -13
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +7 -8
- package/dist/hooks.d.ts +7 -8
- package/dist/hooks.js +3 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +69 -642
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -6
- package/dist/index.d.ts +72 -6
- package/dist/index.js +50 -623
- package/dist/index.js.map +1 -1
- package/dist/{types-n5zV4Q3s.d.cts → types-BMBTfHxe.d.cts} +3 -2
- package/dist/{types-n5zV4Q3s.d.ts → types-BMBTfHxe.d.ts} +3 -2
- package/dist/utils.cjs +9 -9
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +5 -4
- package/dist/utils.d.ts +5 -4
- package/dist/utils.js +5 -5
- package/dist/utils.js.map +1 -1
- package/package.json +10 -9
- package/src/OperationGenerator.ts +27 -11
- package/src/SchemaGenerator.ts +30 -35
- package/src/SchemaMapper.ts +1 -1
- package/src/components/Schema.tsx +12 -42
- package/src/hooks/useOperationManager.ts +3 -2
- package/src/hooks/useSchema.ts +1 -8
- package/src/index.ts +1 -0
- package/src/plugin.ts +3 -3
- package/src/types.ts +3 -1
- package/src/utils/getGroupedByTagFiles.ts +4 -3
- package/dist/chunk-2MJ2CQMI.js +0 -61
- package/dist/chunk-2MJ2CQMI.js.map +0 -1
- package/dist/chunk-3RCQ2LNT.js +0 -81
- package/dist/chunk-3RCQ2LNT.js.map +0 -1
- package/dist/chunk-55NUFNT6.cjs +0 -68
- package/dist/chunk-55NUFNT6.cjs.map +0 -1
- package/dist/chunk-ECXSQTMV.cjs +0 -81
- package/dist/chunk-ECXSQTMV.cjs.map +0 -1
- package/dist/chunk-H52M2RUX.cjs.map +0 -1
- package/dist/chunk-LQ6IAWRX.js.map +0 -1
- package/dist/chunk-VNFSHGSN.cjs +0 -61
- package/dist/chunk-VNFSHGSN.cjs.map +0 -1
package/src/SchemaGenerator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Generator } from '@kubb/core'
|
|
1
|
+
import { type FileMetaBase, Generator } from '@kubb/core'
|
|
2
2
|
import transformers, { pascalCase } from '@kubb/core/transformers'
|
|
3
3
|
import { getUniqueName } from '@kubb/core/utils'
|
|
4
4
|
|
|
@@ -8,12 +8,16 @@ import { isKeyword, schemaKeywords } from './SchemaMapper.ts'
|
|
|
8
8
|
import { getSchemaFactory } from './utils/getSchemaFactory.ts'
|
|
9
9
|
import { getSchemas } from './utils/getSchemas.ts'
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'
|
|
12
|
+
import type * as KubbFile from '@kubb/fs/types'
|
|
13
|
+
|
|
12
14
|
import type { Oas, OpenAPIV3, SchemaObject, contentType } from '@kubb/oas'
|
|
13
15
|
import type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'
|
|
14
16
|
import type { OperationSchema, Override, Refs } from './types.ts'
|
|
15
17
|
|
|
16
|
-
export type
|
|
18
|
+
export type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never
|
|
19
|
+
|
|
20
|
+
export type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>
|
|
17
21
|
|
|
18
22
|
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
19
23
|
oas: Oas
|
|
@@ -62,7 +66,7 @@ type SchemaProps = {
|
|
|
62
66
|
export abstract class SchemaGenerator<
|
|
63
67
|
TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,
|
|
64
68
|
TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,
|
|
65
|
-
TFileMeta extends
|
|
69
|
+
TFileMeta extends FileMetaBase = FileMetaBase,
|
|
66
70
|
> extends Generator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
67
71
|
// Collect the types of all referenced schemas, so we can export them later
|
|
68
72
|
refs: Refs = {}
|
|
@@ -75,7 +79,7 @@ export abstract class SchemaGenerator<
|
|
|
75
79
|
* Delegates to getBaseTypeFromSchema internally and
|
|
76
80
|
* optionally adds a union with null.
|
|
77
81
|
*/
|
|
78
|
-
|
|
82
|
+
parse(props: SchemaProps): Schema[] {
|
|
79
83
|
const options = this.#getOptions(props)
|
|
80
84
|
|
|
81
85
|
const defaultSchemas = this.#parseSchemaObject(props)
|
|
@@ -84,18 +88,18 @@ export abstract class SchemaGenerator<
|
|
|
84
88
|
return uniqueWith<Schema>(schemas, isDeepEqual)
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
deepSearch<T extends keyof SchemaKeywordMapper>(
|
|
88
|
-
return SchemaGenerator.deepSearch<T>(
|
|
91
|
+
deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {
|
|
92
|
+
return SchemaGenerator.deepSearch<T>(tree, keyword)
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
find<T extends keyof SchemaKeywordMapper>(
|
|
92
|
-
return SchemaGenerator.find<T>(
|
|
95
|
+
find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {
|
|
96
|
+
return SchemaGenerator.find<T>(tree, keyword)
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(
|
|
99
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] {
|
|
96
100
|
const foundItems: SchemaKeywordMapper[T][] = []
|
|
97
101
|
|
|
98
|
-
|
|
102
|
+
tree?.forEach((schema) => {
|
|
99
103
|
if (schema.keyword === keyword) {
|
|
100
104
|
foundItems.push(schema as SchemaKeywordMapper[T])
|
|
101
105
|
}
|
|
@@ -148,10 +152,10 @@ export abstract class SchemaGenerator<
|
|
|
148
152
|
return foundItems
|
|
149
153
|
}
|
|
150
154
|
|
|
151
|
-
static findInObject<T extends keyof SchemaKeywordMapper>(
|
|
155
|
+
static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {
|
|
152
156
|
let foundItem: SchemaKeywordMapper[T] | undefined = undefined
|
|
153
157
|
|
|
154
|
-
|
|
158
|
+
tree?.forEach((schema) => {
|
|
155
159
|
if (!foundItem && schema.keyword === keyword) {
|
|
156
160
|
foundItem = schema as SchemaKeywordMapper[T]
|
|
157
161
|
}
|
|
@@ -176,10 +180,10 @@ export abstract class SchemaGenerator<
|
|
|
176
180
|
return foundItem
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
static find<T extends keyof SchemaKeywordMapper>(
|
|
183
|
+
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {
|
|
180
184
|
let foundItem: SchemaKeywordMapper[T] | undefined = undefined
|
|
181
185
|
|
|
182
|
-
|
|
186
|
+
tree?.forEach((schema) => {
|
|
183
187
|
if (!foundItem && schema.keyword === keyword) {
|
|
184
188
|
foundItem = schema as SchemaKeywordMapper[T]
|
|
185
189
|
}
|
|
@@ -275,7 +279,7 @@ export abstract class SchemaGenerator<
|
|
|
275
279
|
const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required
|
|
276
280
|
const nullable = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false
|
|
277
281
|
|
|
278
|
-
validationFunctions.push(...this.
|
|
282
|
+
validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name }))
|
|
279
283
|
|
|
280
284
|
validationFunctions.push({
|
|
281
285
|
keyword: schemaKeywords.name,
|
|
@@ -299,7 +303,7 @@ export abstract class SchemaGenerator<
|
|
|
299
303
|
additionalPropertiesSchemas =
|
|
300
304
|
additionalProperties === true
|
|
301
305
|
? [{ keyword: this.#getUnknownReturn({ schema, name }) }]
|
|
302
|
-
: this.
|
|
306
|
+
: this.parse({ schema: additionalProperties as SchemaObject, parentName: name })
|
|
303
307
|
}
|
|
304
308
|
|
|
305
309
|
return [
|
|
@@ -462,7 +466,7 @@ export abstract class SchemaGenerator<
|
|
|
462
466
|
keyword: schemaKeywords.union,
|
|
463
467
|
args: schema.oneOf
|
|
464
468
|
.map((item) => {
|
|
465
|
-
return item && this.
|
|
469
|
+
return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]
|
|
466
470
|
})
|
|
467
471
|
.filter(Boolean)
|
|
468
472
|
.filter((item) => {
|
|
@@ -470,7 +474,7 @@ export abstract class SchemaGenerator<
|
|
|
470
474
|
}),
|
|
471
475
|
}
|
|
472
476
|
if (schemaWithoutOneOf.properties) {
|
|
473
|
-
return [...this.
|
|
477
|
+
return [...this.parse({ schema: schemaWithoutOneOf, name, parentName }), union, ...baseItems]
|
|
474
478
|
}
|
|
475
479
|
|
|
476
480
|
return [union, ...baseItems]
|
|
@@ -484,7 +488,7 @@ export abstract class SchemaGenerator<
|
|
|
484
488
|
keyword: schemaKeywords.union,
|
|
485
489
|
args: schema.anyOf
|
|
486
490
|
.map((item) => {
|
|
487
|
-
return item && this.
|
|
491
|
+
return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]
|
|
488
492
|
})
|
|
489
493
|
.filter(Boolean)
|
|
490
494
|
.filter((item) => {
|
|
@@ -504,7 +508,7 @@ export abstract class SchemaGenerator<
|
|
|
504
508
|
}),
|
|
505
509
|
}
|
|
506
510
|
if (schemaWithoutAnyOf.properties) {
|
|
507
|
-
return [...this.
|
|
511
|
+
return [...this.parse({ schema: schemaWithoutAnyOf, name, parentName }), union, ...baseItems]
|
|
508
512
|
}
|
|
509
513
|
|
|
510
514
|
return [union, ...baseItems]
|
|
@@ -517,7 +521,7 @@ export abstract class SchemaGenerator<
|
|
|
517
521
|
keyword: schemaKeywords.and,
|
|
518
522
|
args: schema.allOf
|
|
519
523
|
.map((item) => {
|
|
520
|
-
return item && this.
|
|
524
|
+
return item && this.parse({ schema: item as SchemaObject, name, parentName })[0]
|
|
521
525
|
})
|
|
522
526
|
.filter(Boolean)
|
|
523
527
|
.filter((item) => {
|
|
@@ -529,7 +533,7 @@ export abstract class SchemaGenerator<
|
|
|
529
533
|
return [
|
|
530
534
|
{
|
|
531
535
|
...and,
|
|
532
|
-
args: [...(and.args || []), ...this.
|
|
536
|
+
args: [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName })],
|
|
533
537
|
},
|
|
534
538
|
...baseItems,
|
|
535
539
|
]
|
|
@@ -629,7 +633,7 @@ export abstract class SchemaGenerator<
|
|
|
629
633
|
keyword: schemaKeywords.tuple,
|
|
630
634
|
args: prefixItems
|
|
631
635
|
.map((item) => {
|
|
632
|
-
return this.
|
|
636
|
+
return this.parse({ schema: item, name, parentName })[0]
|
|
633
637
|
})
|
|
634
638
|
.filter(Boolean),
|
|
635
639
|
},
|
|
@@ -746,7 +750,7 @@ export abstract class SchemaGenerator<
|
|
|
746
750
|
if ('items' in schema || schema.type === ('array' as 'string')) {
|
|
747
751
|
const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined
|
|
748
752
|
const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined
|
|
749
|
-
const items = this.
|
|
753
|
+
const items = this.parse({ schema: 'items' in schema ? (schema.items as SchemaObject) : [], name, parentName })
|
|
750
754
|
|
|
751
755
|
return [
|
|
752
756
|
{
|
|
@@ -771,7 +775,7 @@ export abstract class SchemaGenerator<
|
|
|
771
775
|
const [type] = schema.type as Array<OpenAPIV3.NonArraySchemaObjectType>
|
|
772
776
|
|
|
773
777
|
return [
|
|
774
|
-
...this.
|
|
778
|
+
...this.parse({
|
|
775
779
|
schema: {
|
|
776
780
|
...schema,
|
|
777
781
|
type,
|
|
@@ -815,13 +819,4 @@ export abstract class SchemaGenerator<
|
|
|
815
819
|
* Schema
|
|
816
820
|
*/
|
|
817
821
|
abstract schema(name: string, object: SchemaObject): SchemaMethodResult<TFileMeta>
|
|
818
|
-
/**
|
|
819
|
-
* Returns the source, in the future it will return a React component
|
|
820
|
-
*/
|
|
821
|
-
abstract getSource<TOptions extends SchemaGeneratorBuildOptions = SchemaGeneratorBuildOptions>(name: string, schemas: Schema[], options?: TOptions): string[]
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* @deprecated only used for testing
|
|
825
|
-
*/
|
|
826
|
-
abstract buildSource(name: string, object: SchemaObject | undefined, options?: SchemaGeneratorBuildOptions): string[]
|
|
827
822
|
}
|
package/src/SchemaMapper.ts
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { File, Parser, createContext, useApp, useFile } from '@kubb/react'
|
|
2
2
|
|
|
3
3
|
import { schemaKeywords } from '../SchemaMapper.ts'
|
|
4
4
|
import { useSchema } from '../hooks/useSchema.ts'
|
|
5
5
|
|
|
6
|
-
import type
|
|
6
|
+
import type * as KubbFile from '@kubb/fs/types'
|
|
7
7
|
import type { SchemaObject } from '@kubb/oas'
|
|
8
8
|
import type { KubbNode } from '@kubb/react'
|
|
9
9
|
import type { ReactNode } from 'react'
|
|
10
|
-
import
|
|
10
|
+
import { SchemaGenerator } from '../SchemaGenerator.ts'
|
|
11
11
|
import type { Schema as SchemaType } from '../SchemaMapper.ts'
|
|
12
12
|
import type { PluginOas } from '../types.ts'
|
|
13
13
|
|
|
14
14
|
export type SchemaContextProps = {
|
|
15
15
|
name: string
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
schemas: SchemaType[]
|
|
16
|
+
schema?: SchemaObject
|
|
17
|
+
tree: Array<SchemaType>
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
type Props = {
|
|
22
21
|
name: string
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
value?: SchemaObject
|
|
23
|
+
tree?: Array<SchemaType>
|
|
25
24
|
children?: KubbNode
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
const SchemaContext = createContext<SchemaContextProps>({
|
|
29
28
|
name: 'unknown',
|
|
30
|
-
|
|
29
|
+
tree: [],
|
|
31
30
|
})
|
|
32
31
|
|
|
33
|
-
export function Schema({ name,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return <SchemaContext.Provider value={{ name, schemas, object, generator }}>{children}</SchemaContext.Provider>
|
|
32
|
+
export function Schema({ name, value, tree = [], children }: Props): KubbNode {
|
|
33
|
+
return <SchemaContext.Provider value={{ name, schema: value, tree }}>{children}</SchemaContext.Provider>
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
type FileProps = {
|
|
@@ -66,9 +63,6 @@ Schema.File = function ({ output, isTypeOnly, children }: FileProps): ReactNode
|
|
|
66
63
|
pluginKey: plugin.key,
|
|
67
64
|
}}
|
|
68
65
|
>
|
|
69
|
-
<File.Source>
|
|
70
|
-
<Schema.Source />
|
|
71
|
-
</File.Source>
|
|
72
66
|
{children}
|
|
73
67
|
</File>
|
|
74
68
|
</Parser>
|
|
@@ -99,9 +93,6 @@ Schema.File = function ({ output, isTypeOnly, children }: FileProps): ReactNode
|
|
|
99
93
|
}}
|
|
100
94
|
>
|
|
101
95
|
<Schema.Imports isTypeOnly={isTypeOnly} />
|
|
102
|
-
<File.Source>
|
|
103
|
-
<Schema.Source />
|
|
104
|
-
</File.Source>
|
|
105
96
|
{children}
|
|
106
97
|
</File>
|
|
107
98
|
</Parser>
|
|
@@ -113,10 +104,10 @@ type SchemaImportsProps = {
|
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
Schema.Imports = ({ isTypeOnly }: SchemaImportsProps): ReactNode => {
|
|
116
|
-
const {
|
|
107
|
+
const { tree } = useSchema()
|
|
117
108
|
const { path: root } = useFile()
|
|
118
109
|
|
|
119
|
-
const refs =
|
|
110
|
+
const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)
|
|
120
111
|
|
|
121
112
|
return (
|
|
122
113
|
<>
|
|
@@ -132,25 +123,4 @@ Schema.Imports = ({ isTypeOnly }: SchemaImportsProps): ReactNode => {
|
|
|
132
123
|
</>
|
|
133
124
|
)
|
|
134
125
|
}
|
|
135
|
-
|
|
136
|
-
type SchemaSourceProps<TOptions extends SchemaGeneratorBuildOptions = SchemaGeneratorBuildOptions> = {
|
|
137
|
-
extraSchemas?: SchemaType[]
|
|
138
|
-
options?: TOptions
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
Schema.Source = <TOptions extends SchemaGeneratorBuildOptions = SchemaGeneratorBuildOptions>({
|
|
142
|
-
options,
|
|
143
|
-
extraSchemas = [],
|
|
144
|
-
}: SchemaSourceProps<TOptions>): ReactNode => {
|
|
145
|
-
const { name, generator, schemas } = useSchema()
|
|
146
|
-
|
|
147
|
-
const source = generator.getSource(name, [...schemas, ...extraSchemas], options as SchemaGeneratorBuildOptions)
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<>
|
|
151
|
-
{source}
|
|
152
|
-
<br />
|
|
153
|
-
</>
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
126
|
Schema.Context = SchemaContext
|
|
@@ -2,11 +2,12 @@ import { useApp, useContext } from '@kubb/react'
|
|
|
2
2
|
|
|
3
3
|
import { Oas } from '../components/Oas.tsx'
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core'
|
|
6
|
+
import type * as KubbFile from '@kubb/fs/types'
|
|
6
7
|
import type { Operation, Operation as OperationType } from '@kubb/oas'
|
|
7
8
|
import type { OperationSchemas } from '../types.ts'
|
|
8
9
|
|
|
9
|
-
type FileMeta =
|
|
10
|
+
type FileMeta = FileMetaBase & {
|
|
10
11
|
pluginKey: Plugin['key']
|
|
11
12
|
name: string
|
|
12
13
|
tag?: string
|
package/src/hooks/useSchema.ts
CHANGED
|
@@ -3,11 +3,8 @@ import { useContext } from '@kubb/react'
|
|
|
3
3
|
import { Schema } from '../components/Schema.tsx'
|
|
4
4
|
|
|
5
5
|
import type { SchemaContextProps } from '../components/Schema.tsx'
|
|
6
|
-
import type { SchemaGenerator } from '../SchemaGenerator.ts'
|
|
7
6
|
|
|
8
|
-
type UseSchemaResult =
|
|
9
|
-
generator: SchemaGenerator
|
|
10
|
-
}
|
|
7
|
+
type UseSchemaResult = SchemaContextProps
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
* `useSchema` will return the current `schema properties`
|
|
@@ -15,9 +12,5 @@ type UseSchemaResult = Omit<SchemaContextProps, 'generator'> & {
|
|
|
15
12
|
export function useSchema(): UseSchemaResult {
|
|
16
13
|
const props = useContext(Schema.Context)
|
|
17
14
|
|
|
18
|
-
if (!props.generator) {
|
|
19
|
-
throw new Error('Generator is not defined')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
15
|
return props as UseSchemaResult
|
|
23
16
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type {
|
|
|
7
7
|
export { OperationGenerator } from './OperationGenerator.ts'
|
|
8
8
|
export { pluginOas, pluginOasName } from './plugin.ts'
|
|
9
9
|
export type {
|
|
10
|
+
GetSchemaGeneratorOptions,
|
|
10
11
|
SchemaGeneratorBuildOptions,
|
|
11
12
|
SchemaGeneratorOptions,
|
|
12
13
|
} from './SchemaGenerator.ts'
|
package/src/plugin.ts
CHANGED
|
@@ -77,12 +77,12 @@ export const pluginOas = createPlugin<PluginOas>((options) => {
|
|
|
77
77
|
resolveName(name, type) {
|
|
78
78
|
return camelCase(name, { isFile: type === 'file' })
|
|
79
79
|
},
|
|
80
|
-
async writeFile(
|
|
81
|
-
if (!
|
|
80
|
+
async writeFile(path, source) {
|
|
81
|
+
if (!path.endsWith('.json') || !source) {
|
|
82
82
|
return
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
return this.fileManager.write(
|
|
85
|
+
return this.fileManager.write(path, source, { sanity: false })
|
|
86
86
|
},
|
|
87
87
|
async buildStart() {
|
|
88
88
|
if (!output) {
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from '@kubb/core'
|
|
2
|
-
import type {
|
|
2
|
+
import type { PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
3
|
+
import type * as KubbFile from '@kubb/fs/types'
|
|
4
|
+
|
|
3
5
|
import type { HttpMethod, Oas, Operation, SchemaObject, contentType } from '@kubb/oas'
|
|
4
6
|
import type { FormatOptions } from '@kubb/oas/parser'
|
|
5
7
|
import type { GetSchemasProps } from './utils/getSchemas.ts'
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { resolve } from 'node:path'
|
|
2
2
|
|
|
3
3
|
import { FileManager } from '@kubb/core'
|
|
4
|
-
import { getRelativePath } from '@kubb/core/fs'
|
|
5
4
|
import transformers from '@kubb/core/transformers'
|
|
6
5
|
import { renderTemplate } from '@kubb/core/utils'
|
|
6
|
+
import { getRelativePath } from '@kubb/fs'
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { Plugin } from '@kubb/core'
|
|
9
9
|
import type { Logger } from '@kubb/core/logger'
|
|
10
|
+
import type * as KubbFile from '@kubb/fs/types'
|
|
10
11
|
|
|
11
12
|
type Options = {
|
|
12
13
|
logger: Logger
|
|
13
|
-
files: KubbFile.File
|
|
14
|
+
files: Array<KubbFile.File<FileMeta>>
|
|
14
15
|
plugin: Plugin
|
|
15
16
|
template: string
|
|
16
17
|
exportAs: string
|
package/dist/chunk-2MJ2CQMI.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-LQ6IAWRX.js";
|
|
4
|
-
|
|
5
|
-
// src/SchemaMapper.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
var schemaKeywords = {
|
|
8
|
-
any: "any",
|
|
9
|
-
strict: "strict",
|
|
10
|
-
unknown: "unknown",
|
|
11
|
-
number: "number",
|
|
12
|
-
integer: "integer",
|
|
13
|
-
string: "string",
|
|
14
|
-
boolean: "boolean",
|
|
15
|
-
undefined: "undefined",
|
|
16
|
-
nullable: "nullable",
|
|
17
|
-
null: "null",
|
|
18
|
-
nullish: "nullish",
|
|
19
|
-
array: "array",
|
|
20
|
-
tuple: "tuple",
|
|
21
|
-
enum: "enum",
|
|
22
|
-
union: "union",
|
|
23
|
-
datetime: "datetime",
|
|
24
|
-
date: "date",
|
|
25
|
-
email: "email",
|
|
26
|
-
uuid: "uuid",
|
|
27
|
-
url: "url",
|
|
28
|
-
/* intersection */
|
|
29
|
-
default: "default",
|
|
30
|
-
const: "const",
|
|
31
|
-
and: "and",
|
|
32
|
-
describe: "describe",
|
|
33
|
-
min: "min",
|
|
34
|
-
max: "max",
|
|
35
|
-
optional: "optional",
|
|
36
|
-
readOnly: "readOnly",
|
|
37
|
-
// custom ones
|
|
38
|
-
object: "object",
|
|
39
|
-
ref: "ref",
|
|
40
|
-
matches: "matches",
|
|
41
|
-
firstName: "firstName",
|
|
42
|
-
lastName: "lastName",
|
|
43
|
-
password: "password",
|
|
44
|
-
phone: "phone",
|
|
45
|
-
blob: "blob",
|
|
46
|
-
deprecated: "deprecated",
|
|
47
|
-
example: "example",
|
|
48
|
-
schema: "schema",
|
|
49
|
-
catchall: "catchall",
|
|
50
|
-
time: "time",
|
|
51
|
-
name: "name"
|
|
52
|
-
};
|
|
53
|
-
function isKeyword(meta, keyword) {
|
|
54
|
-
return meta.keyword === keyword;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
schemaKeywords,
|
|
59
|
-
isKeyword
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=chunk-2MJ2CQMI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/core'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n strict: { keyword: 'strict' }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: Schema[] }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number'\n value?: string | number\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: { name: string; path: KubbFile.OptionalPath; isTypeOnly?: boolean }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n strict: 'strict',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n optional: 'optional',\n readOnly: 'readOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";;;;;AAAA;AA+EO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,KAAK;AAAA;AAAA,EAEL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,KAAK;AAAA,EACL,UAAU;AAAA,EACV,KAAK;AAAA,EACL,KAAK;AAAA,EACL,UAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAGV,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AACR;AAiBO,SAAS,UAAiE,MAAS,SAAwD;AAChJ,SAAO,KAAK,YAAY;AAC1B;","names":[]}
|
package/dist/chunk-3RCQ2LNT.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_esm_shims
|
|
3
|
-
} from "./chunk-LQ6IAWRX.js";
|
|
4
|
-
|
|
5
|
-
// src/utils/getSchemas.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
function getSchemas({ oas, contentType, includes = ["schemas", "requestBodies", "responses"] }) {
|
|
8
|
-
const components = oas.getDefinition().components;
|
|
9
|
-
let schemas = {};
|
|
10
|
-
if (includes.includes("schemas")) {
|
|
11
|
-
schemas = {
|
|
12
|
-
...schemas,
|
|
13
|
-
...components?.schemas || {}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const requestBodies = components?.requestBodies || {};
|
|
17
|
-
if (includes.includes("responses")) {
|
|
18
|
-
const responses = components?.responses || {};
|
|
19
|
-
Object.entries(responses).forEach(([name, response]) => {
|
|
20
|
-
if (response.content && !schemas[name]) {
|
|
21
|
-
const firstContentType = Object.keys(response.content)[0] || "application/json";
|
|
22
|
-
schemas[name] = response.content?.[contentType || firstContentType]?.schema;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
if (includes.includes("requestBodies")) {
|
|
27
|
-
Object.entries(requestBodies).forEach(([name, request]) => {
|
|
28
|
-
if (request.content && !schemas[name]) {
|
|
29
|
-
const firstContentType = Object.keys(request.content)[0] || "application/json";
|
|
30
|
-
schemas[name] = request.content?.[contentType || firstContentType]?.schema;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return schemas;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// src/utils/parseFromConfig.ts
|
|
38
|
-
init_esm_shims();
|
|
39
|
-
import { resolve } from "path";
|
|
40
|
-
import { URLPath } from "@kubb/core/utils";
|
|
41
|
-
import { parse } from "@kubb/oas/parser";
|
|
42
|
-
import yaml from "@stoplight/yaml";
|
|
43
|
-
function parseFromConfig(config, options = {}) {
|
|
44
|
-
if ("data" in config.input) {
|
|
45
|
-
if (typeof config.input.data === "object") {
|
|
46
|
-
const api2 = JSON.parse(JSON.stringify(config.input.data));
|
|
47
|
-
return parse(api2, options);
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const api2 = yaml.parse(config.input.data);
|
|
51
|
-
return parse(api2, options);
|
|
52
|
-
} catch (e) {
|
|
53
|
-
}
|
|
54
|
-
const api = JSON.parse(JSON.stringify(config.input.data));
|
|
55
|
-
return parse(api, options);
|
|
56
|
-
}
|
|
57
|
-
if (new URLPath(config.input.path).isURL) {
|
|
58
|
-
return parse(config.input.path, options);
|
|
59
|
-
}
|
|
60
|
-
return parse(resolve(config.root, config.input.path), options);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/utils/getSchemaFactory.ts
|
|
64
|
-
init_esm_shims();
|
|
65
|
-
import { isOpenApiV3_1Document } from "@kubb/oas";
|
|
66
|
-
function getSchemaFactory(oas) {
|
|
67
|
-
return (schema) => {
|
|
68
|
-
const version = isOpenApiV3_1Document(oas.api) ? "3.1" : "3.0";
|
|
69
|
-
return {
|
|
70
|
-
schema,
|
|
71
|
-
version
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
getSchemas,
|
|
78
|
-
parseFromConfig,
|
|
79
|
-
getSchemaFactory
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=chunk-3RCQ2LNT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/getSchemas.ts","../src/utils/parseFromConfig.ts","../src/utils/getSchemaFactory.ts"],"sourcesContent":["import type { Oas, OasTypes, contentType } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\nexport type GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n const requestBodies = components?.requestBodies || {}\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n\n Object.entries(responses).forEach(([name, response]: [string, OasTypes.ResponseObject]) => {\n if (response.content && !schemas[name]) {\n const firstContentType = Object.keys(response.content)[0] || 'application/json'\n schemas[name] = response.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n if (includes.includes('requestBodies')) {\n Object.entries(requestBodies).forEach(([name, request]: [string, OasTypes.RequestBodyObject]) => {\n if (request.content && !schemas[name]) {\n const firstContentType = Object.keys(request.content)[0] || 'application/json'\n schemas[name] = request.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n })\n }\n\n return schemas\n}\n","import { resolve } from 'node:path'\n\nimport { URLPath } from '@kubb/core/utils'\n\nimport { type FormatOptions, parse } from '@kubb/oas/parser'\n\nimport type { Config } from '@kubb/core'\nimport type { Oas, OasTypes } from '@kubb/oas'\nimport yaml from '@stoplight/yaml'\n\nexport function parseFromConfig(config: Config, options: FormatOptions = {}): 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, options)\n }\n\n try {\n const api: string = yaml.parse(config.input.data as string) as string\n\n return parse(api, options)\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, options)\n }\n\n if (new URLPath(config.input.path).isURL) {\n return parse(config.input.path, options)\n }\n\n return parse(resolve(config.root, config.input.path), options)\n}\n","import { isOpenApiV3_1Document } from '@kubb/oas'\n\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.0'\n }\n | {\n schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n }\n version: '3.1'\n }\n\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef> {\n return (schema?: SchemaObject) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schema,\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"],"mappings":";;;;;AAAA;AAUO,SAAS,WAAW,EAAE,KAAK,aAAa,WAAW,CAAC,WAAW,iBAAiB,WAAW,EAAE,GAA2D;AAC7J,QAAM,aAAa,IAAI,cAAc,EAAE;AAEvC,MAAI,UAAiD,CAAC;AAEtD,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,cAAU;AAAA,MACR,GAAG;AAAA,MACH,GAAK,YAAY,WAAqD,CAAC;AAAA,IACzE;AAAA,EACF;AAEA,QAAM,gBAAgB,YAAY,iBAAiB,CAAC;AACpD,MAAI,SAAS,SAAS,WAAW,GAAG;AAClC,UAAM,YAAY,YAAY,aAAa,CAAC;AAE5C,WAAO,QAAQ,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,QAAQ,MAAyC;AACzF,UAAI,SAAS,WAAW,CAAC,QAAQ,IAAI,GAAG;AACtC,cAAM,mBAAmB,OAAO,KAAK,SAAS,OAAO,EAAE,CAAC,KAAK;AAC7D,gBAAQ,IAAI,IAAI,SAAS,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACvE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,SAAS,SAAS,eAAe,GAAG;AACtC,WAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,MAAM,OAAO,MAA4C;AAC/F,UAAI,QAAQ,WAAW,CAAC,QAAQ,IAAI,GAAG;AACrC,cAAM,mBAAmB,OAAO,KAAK,QAAQ,OAAO,EAAE,CAAC,KAAK;AAC5D,gBAAQ,IAAI,IAAI,QAAQ,UAAU,eAAe,gBAAgB,GAAG;AAAA,MACtE;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO;AACT;;;AC5CA;AAAA,SAAS,eAAe;AAExB,SAAS,eAAe;AAExB,SAA6B,aAAa;AAI1C,OAAO,UAAU;AAEV,SAAS,gBAAgB,QAAgB,UAAyB,CAAC,GAAiB;AACzF,MAAI,UAAU,OAAO,OAAO;AAC1B,QAAI,OAAO,OAAO,MAAM,SAAS,UAAU;AACzC,YAAMA,OAA4B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,IAAI,CAAC;AAC9E,aAAO,MAAMA,MAAK,OAAO;AAAA,IAC3B;AAEA,QAAI;AACF,YAAMA,OAAc,KAAK,MAAM,OAAO,MAAM,IAAc;AAE1D,aAAO,MAAMA,MAAK,OAAO;AAAA,IAC3B,SAAS,GAAG;AAAA,IAEZ;AAEA,UAAM,MAA4B,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,IAAI,CAAC;AAE9E,WAAO,MAAM,KAAK,OAAO;AAAA,EAC3B;AAEA,MAAI,IAAI,QAAQ,OAAO,MAAM,IAAI,EAAE,OAAO;AACxC,WAAO,MAAM,OAAO,MAAM,MAAM,OAAO;AAAA,EACzC;AAEA,SAAO,MAAM,QAAQ,OAAO,MAAM,OAAO,MAAM,IAAI,GAAG,OAAO;AAC/D;;;ACnCA;AAAA,SAAS,6BAA6B;AAuB/B,SAAS,iBAAmD,KAA6D;AAC9H,SAAO,CAAC,WAA0B;AAChC,UAAM,UAAU,sBAAsB,IAAI,GAAG,IAAI,QAAQ;AAEzD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":["api"]}
|
package/dist/chunk-55NUFNT6.cjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __esm = (fn, res) => function __init() {
|
|
8
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
-
};
|
|
10
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __accessCheck = (obj, member, msg) => {
|
|
30
|
-
if (!member.has(obj))
|
|
31
|
-
throw TypeError("Cannot " + msg);
|
|
32
|
-
};
|
|
33
|
-
var __privateGet = (obj, member, getter) => {
|
|
34
|
-
__accessCheck(obj, member, "read from private field");
|
|
35
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
36
|
-
};
|
|
37
|
-
var __privateAdd = (obj, member, value) => {
|
|
38
|
-
if (member.has(obj))
|
|
39
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
40
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
41
|
-
};
|
|
42
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
43
|
-
__accessCheck(obj, member, "write to private field");
|
|
44
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
45
|
-
return value;
|
|
46
|
-
};
|
|
47
|
-
var __privateMethod = (obj, member, method) => {
|
|
48
|
-
__accessCheck(obj, member, "access private method");
|
|
49
|
-
return method;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// ../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.3_@types+node@20.12.11__postcss@8.4.38_ts-node@10.9._m3ved7kneisj6uq6vsf2lw6r5q/node_modules/tsup/assets/cjs_shims.js
|
|
53
|
-
var init_cjs_shims = __esm({
|
|
54
|
-
"../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.3_@types+node@20.12.11__postcss@8.4.38_ts-node@10.9._m3ved7kneisj6uq6vsf2lw6r5q/node_modules/tsup/assets/cjs_shims.js"() {
|
|
55
|
-
"use strict";
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateMethod = __privateMethod; exports.init_cjs_shims = init_cjs_shims;
|
|
68
|
-
//# sourceMappingURL=chunk-55NUFNT6.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/tsup@8.0.2_@microsoft+api-extractor@7.43.3_@types+node@20.12.11__postcss@8.4.38_ts-node@10.9._m3ved7kneisj6uq6vsf2lw6r5q/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL('file:' + __filename).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
|