@geekmidas/schema 0.1.0 → 1.0.0
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/CHANGELOG.md +7 -0
- package/dist/conversion-BJGLAqtd.mjs.map +1 -1
- package/dist/conversion-CFlFrSru.cjs.map +1 -1
- package/dist/conversion-CH_EmflL.d.cts.map +1 -0
- package/dist/conversion-DUyZYTWO.d.mts.map +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/{openapi-DR4_PG-e.d.cts → openapi-Aeb_1e9T.d.cts} +3 -1
- package/dist/openapi-Aeb_1e9T.d.cts.map +1 -0
- package/dist/openapi-DH5yCqKh.mjs.map +1 -1
- package/dist/openapi-DVvLYx-8.cjs.map +1 -1
- package/dist/{openapi-j01kFjpI.d.mts → openapi-Dxc4FuMP.d.mts} +3 -1
- package/dist/openapi-Dxc4FuMP.d.mts.map +1 -0
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.d.cts +3 -1
- package/dist/parser.d.cts.map +1 -0
- package/dist/parser.d.mts +3 -1
- package/dist/parser.d.mts.map +1 -0
- package/dist/parser.mjs.map +1 -1
- package/dist/{types-ByLHeRGs.d.mts → types-D7ZRea_7.d.cts} +3 -1
- package/dist/types-D7ZRea_7.d.cts.map +1 -0
- package/dist/{types-DfcgE7cO.d.cts → types-o4dOkvCd.d.mts} +3 -1
- package/dist/types-o4dOkvCd.d.mts.map +1 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +1 -1
- package/src/__benchmarks__/conversion.bench.ts +67 -67
- package/src/__tests__/conversion.spec.ts +440 -257
- package/src/__tests__/openapi.spec.ts +390 -390
- package/src/__tests__/parser.spec.ts +202 -202
- package/src/conversion.ts +154 -154
- package/src/index.ts +8 -9
- package/src/openapi.ts +49 -49
- package/src/parser.ts +11 -11
- package/src/types.ts +16 -16
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +1 -1
package/src/conversion.ts
CHANGED
|
@@ -1,195 +1,195 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
|
|
3
3
|
export enum SchemaVendor {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
zod = 'zod',
|
|
5
|
+
valibot = 'valibot',
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export type VendorConvertor = (schema: any) => Promise<any>;
|
|
9
9
|
export type VendorConvertors = Record<SchemaVendor, VendorConvertor>;
|
|
10
10
|
|
|
11
11
|
function isSchemaVendor(vendor?: string): vendor is SchemaVendor {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (!vendor) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
return Object.values(SchemaVendor).includes(vendor as SchemaVendor);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const StandardSchemaJsonSchema: VendorConvertors = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
zod: async (schema): Promise<any> => {
|
|
21
|
+
try {
|
|
22
|
+
const { z } = await import('zod/v4').catch(() => ({ z: {} }));
|
|
23
|
+
|
|
24
|
+
if ('toJSONSchema' in z && typeof z.toJSONSchema === 'function') {
|
|
25
|
+
return z.toJSONSchema(schema);
|
|
26
|
+
}
|
|
27
|
+
const { zodToJsonSchema } = await import('zod-to-json-schema');
|
|
28
|
+
|
|
29
|
+
const result = zodToJsonSchema(schema, {
|
|
30
|
+
removeAdditionalStrategy: 'strict',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return result;
|
|
34
|
+
} catch {
|
|
35
|
+
// Fallback to basic conversion if zod-to-json-schema is not available
|
|
36
|
+
return { type: 'object' };
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
valibot: async (schema): Promise<any> => {
|
|
40
|
+
const { toJsonSchema } = await import('@valibot/to-json-schema');
|
|
41
|
+
return toJsonSchema(schema as any);
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
function extractAndConvertDefs(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
jsonSchema: any,
|
|
47
|
+
componentCollector?: {
|
|
48
|
+
addSchema(id: string, schema: any): void;
|
|
49
|
+
getReference(id: string): { $ref: string };
|
|
50
|
+
},
|
|
51
51
|
): any {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
52
|
+
if (!jsonSchema || typeof jsonSchema !== 'object') {
|
|
53
|
+
return jsonSchema;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Process the schema recursively to update references
|
|
57
|
+
const processSchema = (schema: any): any => {
|
|
58
|
+
if (!schema || typeof schema !== 'object') {
|
|
59
|
+
return schema;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Handle $ref
|
|
63
|
+
if (schema.$ref && typeof schema.$ref === 'string') {
|
|
64
|
+
// Convert #/$defs/X to #/components/schemas/X
|
|
65
|
+
if (schema.$ref.startsWith('#/$defs/')) {
|
|
66
|
+
const refName = schema.$ref.replace('#/$defs/', '');
|
|
67
|
+
return componentCollector
|
|
68
|
+
? componentCollector.getReference(refName)
|
|
69
|
+
: schema;
|
|
70
|
+
}
|
|
71
|
+
return schema;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Handle arrays
|
|
75
|
+
if (Array.isArray(schema)) {
|
|
76
|
+
return schema.map(processSchema);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Process all properties recursively
|
|
80
|
+
const processed: any = {};
|
|
81
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
82
|
+
if (key === '$defs') {
|
|
83
|
+
// Skip $defs as they've been extracted
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
processed[key] = processSchema(value);
|
|
87
|
+
}
|
|
88
|
+
return processed;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Extract $defs if present
|
|
92
|
+
if (jsonSchema.$defs && componentCollector) {
|
|
93
|
+
for (const [defName, defSchema] of Object.entries(jsonSchema.$defs)) {
|
|
94
|
+
// Process the definition recursively to handle nested $refs
|
|
95
|
+
const processedDefSchema = processSchema(defSchema);
|
|
96
|
+
// Add each definition to the component collector
|
|
97
|
+
componentCollector.addSchema(defName, processedDefSchema);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Process the schema and remove $defs
|
|
102
|
+
const { $defs, ...schemaWithoutDefs } = jsonSchema;
|
|
103
|
+
return processSchema(schemaWithoutDefs);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export async function convertStandardSchemaToJsonSchema(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
schema?: StandardSchemaV1,
|
|
108
|
+
componentCollector?: {
|
|
109
|
+
addSchema(id: string, schema: any): void;
|
|
110
|
+
getReference(id: string): { $ref: string };
|
|
111
|
+
},
|
|
112
112
|
): Promise<any> {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
113
|
+
if (!schema) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const vendor = schema['~standard']?.vendor;
|
|
118
|
+
if (!isSchemaVendor(vendor)) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`Unsupported or missing vendor "${vendor}" for Standard Schema. Supported vendors are: ${Object.keys(StandardSchemaJsonSchema).join(', ')}`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const toJSONSchema = StandardSchemaJsonSchema[vendor];
|
|
125
|
+
const jsonSchema = await toJSONSchema(schema);
|
|
126
|
+
|
|
127
|
+
// Extract and convert $defs to components
|
|
128
|
+
return extractAndConvertDefs(jsonSchema, componentCollector);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
export async function getZodMetadata(
|
|
132
|
-
|
|
132
|
+
schema: StandardSchemaV1,
|
|
133
133
|
): Promise<SchemaMeta | undefined> {
|
|
134
|
-
|
|
134
|
+
const { ZodObject } = await import('zod/v4');
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
if (schema instanceof ZodObject) {
|
|
137
|
+
return schema.meta();
|
|
138
|
+
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
return undefined;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export async function getSchemaMetadata(
|
|
144
|
-
|
|
144
|
+
schema: StandardSchemaV1,
|
|
145
145
|
): Promise<SchemaMeta | undefined> {
|
|
146
|
-
|
|
146
|
+
const vendor = schema['~standard']?.vendor;
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
if (vendor === 'zod') {
|
|
149
|
+
return getZodMetadata(schema);
|
|
150
|
+
}
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
return undefined;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
interface SchemaMeta {
|
|
156
|
-
|
|
156
|
+
id?: string;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export async function convertSchemaWithComponents(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
schema: StandardSchemaV1 | undefined,
|
|
161
|
+
componentCollector?: {
|
|
162
|
+
addSchema(id: string, schema: any): void;
|
|
163
|
+
getReference(id: string): { $ref: string };
|
|
164
|
+
},
|
|
165
165
|
): Promise<any> {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
166
|
+
if (!schema) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Convert to JSON Schema with component collector to handle $defs
|
|
171
|
+
const jsonSchema = await convertStandardSchemaToJsonSchema(
|
|
172
|
+
schema,
|
|
173
|
+
componentCollector,
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
if (!componentCollector) {
|
|
177
|
+
return jsonSchema;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Check if this schema has metadata with an ID
|
|
181
|
+
const metadata = await getSchemaMetadata(schema);
|
|
182
|
+
|
|
183
|
+
// Also check if the JSON Schema itself has an id field (from Zod's meta)
|
|
184
|
+
const schemaId = metadata?.id || jsonSchema?.id;
|
|
185
|
+
|
|
186
|
+
if (schemaId) {
|
|
187
|
+
// Remove the id from the schema before adding to components
|
|
188
|
+
const { id, ...schemaWithoutId } = jsonSchema;
|
|
189
|
+
// Add this schema to components and return a reference
|
|
190
|
+
componentCollector.addSchema(schemaId, schemaWithoutId);
|
|
191
|
+
return componentCollector.getReference(schemaId);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return jsonSchema;
|
|
195
195
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
InferStandardSchema,
|
|
3
|
-
ComposableStandardSchema,
|
|
4
|
-
InferComposableStandardSchema,
|
|
5
|
-
} from './types';
|
|
6
|
-
|
|
7
1
|
// Re-export conversion utilities for convenience
|
|
8
2
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
convertSchemaWithComponents,
|
|
4
|
+
convertStandardSchemaToJsonSchema,
|
|
11
5
|
} from './conversion';
|
|
6
|
+
export type { ComponentCollector, OpenApiSchemaOptions } from './openapi';
|
|
12
7
|
|
|
13
8
|
// Re-export OpenAPI utilities for convenience
|
|
14
9
|
export { buildOpenApiSchema, createComponentCollector } from './openapi';
|
|
15
|
-
export type {
|
|
10
|
+
export type {
|
|
11
|
+
ComposableStandardSchema,
|
|
12
|
+
InferComposableStandardSchema,
|
|
13
|
+
InferStandardSchema,
|
|
14
|
+
} from './types';
|
package/src/openapi.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
2
2
|
|
|
3
3
|
export interface OpenApiSchemaOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
title?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
description?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface ComponentCollector {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
schemas: Record<string, OpenAPIV3_1.SchemaObject>;
|
|
11
|
+
addSchema(id: string, schema: OpenAPIV3_1.SchemaObject): void;
|
|
12
|
+
getReference(id: string): OpenAPIV3_1.ReferenceObject;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function createComponentCollector(): ComponentCollector {
|
|
16
|
-
|
|
16
|
+
const schemas: Record<string, OpenAPIV3_1.SchemaObject> = {};
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
return {
|
|
19
|
+
schemas,
|
|
20
|
+
addSchema(id: string, schema: OpenAPIV3_1.SchemaObject) {
|
|
21
|
+
schemas[id] = schema;
|
|
22
|
+
},
|
|
23
|
+
getReference(id: string): OpenAPIV3_1.ReferenceObject {
|
|
24
|
+
return { $ref: `#/components/schemas/${id}` };
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -33,43 +33,43 @@ export function createComponentCollector(): ComponentCollector {
|
|
|
33
33
|
* The actual implementation is in @geekmidas/constructs to avoid circular dependencies.
|
|
34
34
|
*/
|
|
35
35
|
export async function buildOpenApiSchema(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
endpoints: Array<{
|
|
37
|
+
toOpenApi3Route(collector?: ComponentCollector): Promise<any>;
|
|
38
|
+
}>,
|
|
39
|
+
options: OpenApiSchemaOptions = {},
|
|
40
40
|
): Promise<OpenAPIV3_1.Document> {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const { title = 'API', version = '1.0.0', description } = options;
|
|
42
|
+
const paths: OpenAPIV3_1.PathsObject = {};
|
|
43
|
+
const componentCollector = createComponentCollector();
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
for (const endpoint of endpoints) {
|
|
46
|
+
const route = await endpoint.toOpenApi3Route(componentCollector);
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
// Merge the route into the paths object
|
|
49
|
+
for (const [path, methods] of Object.entries(route)) {
|
|
50
|
+
if (!paths[path]) {
|
|
51
|
+
paths[path] = {};
|
|
52
|
+
}
|
|
53
|
+
Object.assign(paths[path], methods);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
const doc: OpenAPIV3_1.Document = {
|
|
58
|
+
openapi: '3.0.0',
|
|
59
|
+
info: {
|
|
60
|
+
title,
|
|
61
|
+
version,
|
|
62
|
+
...(description && { description }),
|
|
63
|
+
},
|
|
64
|
+
paths,
|
|
65
|
+
};
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
// Add components if any schemas were collected
|
|
68
|
+
if (Object.keys(componentCollector.schemas).length > 0) {
|
|
69
|
+
doc.components = {
|
|
70
|
+
schemas: componentCollector.schemas,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
return doc;
|
|
75
75
|
}
|
package/src/parser.ts
CHANGED
|
@@ -9,22 +9,22 @@ import type { InferStandardSchema } from './types';
|
|
|
9
9
|
* @returns Validation result with value or issues
|
|
10
10
|
*/
|
|
11
11
|
export function validate<T extends StandardSchemaV1>(schema: T, data: unknown) {
|
|
12
|
-
|
|
12
|
+
return schema['~standard'].validate(data);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export async function parseSchema<T extends StandardSchemaV1>(
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
schema: T,
|
|
17
|
+
data: unknown,
|
|
18
18
|
): Promise<InferStandardSchema<T>> {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (!schema) {
|
|
20
|
+
return undefined as InferStandardSchema<T>;
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const parsed = await validate(schema as unknown as StandardSchemaV1, data);
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
if (parsed.issues) {
|
|
26
|
+
throw parsed.issues;
|
|
27
|
+
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
return parsed.value as InferStandardSchema<T>;
|
|
30
30
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
|
|
3
3
|
export type InferStandardSchema<T> = T extends StandardSchemaV1
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
? StandardSchemaV1.InferOutput<T>
|
|
5
|
+
: never;
|
|
6
6
|
|
|
7
7
|
export type ComposableStandardSchema =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
| StandardSchemaV1
|
|
9
|
+
| {
|
|
10
|
+
[key: string]: StandardSchemaV1 | undefined;
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
export type InferComposableStandardSchema<T> = T extends StandardSchemaV1
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
? StandardSchemaV1.InferOutput<T>
|
|
15
|
+
: T extends { [key: string]: StandardSchemaV1 | undefined }
|
|
16
|
+
? {
|
|
17
|
+
[K in keyof T as T[K] extends StandardSchemaV1
|
|
18
|
+
? K
|
|
19
|
+
: never]: T[K] extends StandardSchemaV1
|
|
20
|
+
? StandardSchemaV1.InferOutput<T[K]>
|
|
21
|
+
: never;
|
|
22
|
+
}
|
|
23
|
+
: {};
|
package/tsconfig.json
ADDED
package/tsdown.config.ts
CHANGED