@omnidotdev/odk 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -2
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +141 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile.d.ts +152 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +11 -0
- package/dist/compile.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonSchemaExtract.d.ts +40 -0
- package/dist/jsonSchemaExtract.d.ts.map +1 -0
- package/dist/jsonSchemaExtract.js +144 -0
- package/dist/jsonSchemaExtract.js.map +1 -0
- package/dist/odk.d.ts +169 -0
- package/dist/odk.d.ts.map +1 -0
- package/dist/odk.js +186 -0
- package/dist/odk.js.map +1 -0
- package/dist/odk.test.d.ts +2 -0
- package/dist/odk.test.d.ts.map +1 -0
- package/dist/odk.test.js +36 -0
- package/dist/odk.test.js.map +1 -0
- package/dist/standardSchemaAdapter.d.ts +16 -0
- package/dist/standardSchemaAdapter.d.ts.map +1 -0
- package/dist/standardSchemaAdapter.js +277 -0
- package/dist/standardSchemaAdapter.js.map +1 -0
- package/dist/typespecBridge.d.ts +27 -0
- package/dist/typespecBridge.d.ts.map +1 -0
- package/dist/typespecBridge.js +274 -0
- package/dist/typespecBridge.js.map +1 -0
- package/package.json +63 -4
- package/src/cli.ts +160 -0
- package/src/compile.ts +172 -0
- package/src/index.ts +63 -0
- package/src/jsonSchemaExtract.ts +226 -0
- package/src/odk.test.ts +49 -0
- package/src/odk.ts +219 -0
- package/src/standardSchemaAdapter.ts +355 -0
- package/src/typespecBridge.ts +340 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Schema Adapter
|
|
3
|
+
*
|
|
4
|
+
* Converts any Standard Schema-compliant library (Zod, ArkType, Valibot)
|
|
5
|
+
* to ODK's CompiledSchema IR format.
|
|
6
|
+
*/
|
|
7
|
+
import { extractJsonSchema } from "./jsonSchemaExtract.js";
|
|
8
|
+
/**
|
|
9
|
+
* Convert a collection of Standard Schema types to CompiledSchema.
|
|
10
|
+
*/
|
|
11
|
+
export function standardSchemaToCompiled(name, types, options = {}) {
|
|
12
|
+
const models = [];
|
|
13
|
+
const unions = [];
|
|
14
|
+
const warnings = [];
|
|
15
|
+
const processedDefs = new Set();
|
|
16
|
+
for (const [typeName, schema] of Object.entries(types)) {
|
|
17
|
+
// Check for non-serializable constraints
|
|
18
|
+
checkSerializability(schema, typeName, warnings);
|
|
19
|
+
// Extract JSON Schema representation
|
|
20
|
+
const jsonSchema = extractJsonSchema(schema);
|
|
21
|
+
// Process any $defs/definitions first
|
|
22
|
+
const defs = { ...jsonSchema.$defs, ...jsonSchema.definitions };
|
|
23
|
+
for (const [defName, defSchema] of Object.entries(defs)) {
|
|
24
|
+
if (processedDefs.has(defName))
|
|
25
|
+
continue;
|
|
26
|
+
processedDefs.add(defName);
|
|
27
|
+
const result = jsonSchemaToType(defName, defSchema);
|
|
28
|
+
if (result.model)
|
|
29
|
+
models.push(result.model);
|
|
30
|
+
if (result.union)
|
|
31
|
+
unions.push(result.union);
|
|
32
|
+
}
|
|
33
|
+
// Process the main type
|
|
34
|
+
const result = jsonSchemaToType(typeName, jsonSchema);
|
|
35
|
+
if (result.model)
|
|
36
|
+
models.push(result.model);
|
|
37
|
+
if (result.union)
|
|
38
|
+
unions.push(result.union);
|
|
39
|
+
}
|
|
40
|
+
// Emit warnings
|
|
41
|
+
if (!options.suppressWarnings) {
|
|
42
|
+
for (const warning of warnings) {
|
|
43
|
+
console.warn(`\u26A0\uFE0F ${warning}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { name, models, unions, warnings };
|
|
47
|
+
}
|
|
48
|
+
function jsonSchemaToType(name, schema) {
|
|
49
|
+
// Handle enums as unions
|
|
50
|
+
if (schema.enum) {
|
|
51
|
+
return {
|
|
52
|
+
union: {
|
|
53
|
+
name,
|
|
54
|
+
variants: schema.enum.map((v) => ({
|
|
55
|
+
name: String(v),
|
|
56
|
+
type: { kind: "literal", value: v },
|
|
57
|
+
})),
|
|
58
|
+
description: schema.description,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Handle oneOf/anyOf as unions
|
|
63
|
+
const variants = schema.oneOf ?? schema.anyOf;
|
|
64
|
+
if (variants) {
|
|
65
|
+
return {
|
|
66
|
+
union: {
|
|
67
|
+
name,
|
|
68
|
+
variants: variants.map((v, i) => {
|
|
69
|
+
const variantName = v.title || `Variant${i + 1}`;
|
|
70
|
+
return {
|
|
71
|
+
name: variantName,
|
|
72
|
+
type: jsonSchemaPropertyToType(v),
|
|
73
|
+
};
|
|
74
|
+
}),
|
|
75
|
+
description: schema.description,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// Handle objects as models
|
|
80
|
+
if (schema.type === "object" || schema.properties) {
|
|
81
|
+
const fields = [];
|
|
82
|
+
const required = new Set(schema.required || []);
|
|
83
|
+
for (const [propName, propSchema] of Object.entries(schema.properties || {})) {
|
|
84
|
+
fields.push({
|
|
85
|
+
name: propName,
|
|
86
|
+
type: jsonSchemaPropertyToType(propSchema),
|
|
87
|
+
optional: !required.has(propName),
|
|
88
|
+
description: propSchema.description,
|
|
89
|
+
constraints: extractConstraints(propSchema),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
model: {
|
|
94
|
+
name,
|
|
95
|
+
fields,
|
|
96
|
+
description: schema.description,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// Handle arrays
|
|
101
|
+
if (schema.type === "array") {
|
|
102
|
+
return {
|
|
103
|
+
type: {
|
|
104
|
+
kind: "array",
|
|
105
|
+
items: schema.items
|
|
106
|
+
? jsonSchemaPropertyToType(schema.items)
|
|
107
|
+
: { kind: "scalar", name: "unknown" },
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// Handle refs
|
|
112
|
+
if (schema.$ref) {
|
|
113
|
+
const refName = schema.$ref.split("/").pop() || "Unknown";
|
|
114
|
+
return {
|
|
115
|
+
type: { kind: "ref", name: refName },
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// Handle primitives - create an alias
|
|
119
|
+
return {
|
|
120
|
+
type: jsonSchemaPropertyToType(schema),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function jsonSchemaPropertyToType(schema) {
|
|
124
|
+
// Handle refs
|
|
125
|
+
if (schema.$ref) {
|
|
126
|
+
const refName = schema.$ref.split("/").pop() || "Unknown";
|
|
127
|
+
return { kind: "ref", name: refName };
|
|
128
|
+
}
|
|
129
|
+
// Handle const
|
|
130
|
+
if (schema.const !== undefined) {
|
|
131
|
+
return {
|
|
132
|
+
kind: "literal",
|
|
133
|
+
value: schema.const,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
// Handle enum (inline)
|
|
137
|
+
if (schema.enum) {
|
|
138
|
+
return {
|
|
139
|
+
kind: "union",
|
|
140
|
+
variants: schema.enum.map((v) => ({
|
|
141
|
+
kind: "literal",
|
|
142
|
+
value: v,
|
|
143
|
+
})),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// Handle oneOf/anyOf
|
|
147
|
+
const unionVariants = schema.oneOf ?? schema.anyOf;
|
|
148
|
+
if (unionVariants) {
|
|
149
|
+
return {
|
|
150
|
+
kind: "union",
|
|
151
|
+
variants: unionVariants.map((v) => jsonSchemaPropertyToType(v)),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
// Handle arrays
|
|
155
|
+
if (schema.type === "array") {
|
|
156
|
+
return {
|
|
157
|
+
kind: "array",
|
|
158
|
+
items: schema.items
|
|
159
|
+
? jsonSchemaPropertyToType(schema.items)
|
|
160
|
+
: { kind: "scalar", name: "unknown" },
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
// Handle objects (inline)
|
|
164
|
+
if (schema.type === "object" || schema.properties) {
|
|
165
|
+
const fields = [];
|
|
166
|
+
const required = new Set(schema.required || []);
|
|
167
|
+
for (const [propName, propSchema] of Object.entries(schema.properties || {})) {
|
|
168
|
+
fields.push({
|
|
169
|
+
name: propName,
|
|
170
|
+
type: jsonSchemaPropertyToType(propSchema),
|
|
171
|
+
optional: !required.has(propName),
|
|
172
|
+
constraints: extractConstraints(propSchema),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return { kind: "object", fields };
|
|
176
|
+
}
|
|
177
|
+
// Handle type arrays (union of types)
|
|
178
|
+
if (Array.isArray(schema.type)) {
|
|
179
|
+
return {
|
|
180
|
+
kind: "union",
|
|
181
|
+
variants: schema.type.map((t) => ({
|
|
182
|
+
kind: "scalar",
|
|
183
|
+
name: jsonTypeToScalar(t),
|
|
184
|
+
})),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// Handle primitive types
|
|
188
|
+
if (typeof schema.type === "string") {
|
|
189
|
+
return { kind: "scalar", name: jsonTypeToScalar(schema.type) };
|
|
190
|
+
}
|
|
191
|
+
return { kind: "scalar", name: "unknown" };
|
|
192
|
+
}
|
|
193
|
+
function jsonTypeToScalar(type) {
|
|
194
|
+
switch (type) {
|
|
195
|
+
case "string":
|
|
196
|
+
return "string";
|
|
197
|
+
case "number":
|
|
198
|
+
return "float64";
|
|
199
|
+
case "integer":
|
|
200
|
+
return "int64";
|
|
201
|
+
case "boolean":
|
|
202
|
+
return "boolean";
|
|
203
|
+
case "null":
|
|
204
|
+
return "unknown"; // TypeSpec doesn't have null, handle via optional
|
|
205
|
+
default:
|
|
206
|
+
return "unknown";
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function extractConstraints(schema) {
|
|
210
|
+
const constraints = {};
|
|
211
|
+
let hasConstraints = false;
|
|
212
|
+
if (schema.minLength !== undefined) {
|
|
213
|
+
constraints.minLength = schema.minLength;
|
|
214
|
+
hasConstraints = true;
|
|
215
|
+
}
|
|
216
|
+
if (schema.maxLength !== undefined) {
|
|
217
|
+
constraints.maxLength = schema.maxLength;
|
|
218
|
+
hasConstraints = true;
|
|
219
|
+
}
|
|
220
|
+
if (schema.minimum !== undefined) {
|
|
221
|
+
constraints.minValue = schema.minimum;
|
|
222
|
+
hasConstraints = true;
|
|
223
|
+
}
|
|
224
|
+
if (schema.maximum !== undefined) {
|
|
225
|
+
constraints.maxValue = schema.maximum;
|
|
226
|
+
hasConstraints = true;
|
|
227
|
+
}
|
|
228
|
+
if (schema.exclusiveMinimum !== undefined) {
|
|
229
|
+
constraints.minValue = schema.exclusiveMinimum;
|
|
230
|
+
hasConstraints = true;
|
|
231
|
+
}
|
|
232
|
+
if (schema.exclusiveMaximum !== undefined) {
|
|
233
|
+
constraints.maxValue = schema.exclusiveMaximum;
|
|
234
|
+
hasConstraints = true;
|
|
235
|
+
}
|
|
236
|
+
if (schema.pattern !== undefined) {
|
|
237
|
+
constraints.pattern = schema.pattern;
|
|
238
|
+
hasConstraints = true;
|
|
239
|
+
}
|
|
240
|
+
if (schema.format !== undefined) {
|
|
241
|
+
constraints.format = schema.format;
|
|
242
|
+
hasConstraints = true;
|
|
243
|
+
}
|
|
244
|
+
if (schema.multipleOf !== undefined) {
|
|
245
|
+
constraints.multipleOf = schema.multipleOf;
|
|
246
|
+
hasConstraints = true;
|
|
247
|
+
}
|
|
248
|
+
return hasConstraints ? constraints : undefined;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Check for constraints that cannot be serialized to TypeSpec.
|
|
252
|
+
*/
|
|
253
|
+
function checkSerializability(schema, typeName, warnings) {
|
|
254
|
+
// Zod-specific checks
|
|
255
|
+
if (isZodSchemaWithDef(schema)) {
|
|
256
|
+
const def = schema._def;
|
|
257
|
+
// Check for transforms
|
|
258
|
+
if (def.typeName === "ZodEffects" && def.effect?.type === "transform") {
|
|
259
|
+
warnings.push(`${typeName}: .transform() is not serializable - will be ignored in emission`);
|
|
260
|
+
}
|
|
261
|
+
// Check for refines
|
|
262
|
+
if (def.typeName === "ZodEffects" && def.effect?.type === "refinement") {
|
|
263
|
+
warnings.push(`${typeName}: .refine()/.superRefine() is not serializable - will be ignored in emission`);
|
|
264
|
+
}
|
|
265
|
+
// Check for preprocessors
|
|
266
|
+
if (def.typeName === "ZodEffects" && def.effect?.type === "preprocess") {
|
|
267
|
+
warnings.push(`${typeName}: .preprocess() is not serializable - will be ignored in emission`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function isZodSchemaWithDef(schema) {
|
|
272
|
+
return (schema !== null &&
|
|
273
|
+
typeof schema === "object" &&
|
|
274
|
+
"_def" in schema &&
|
|
275
|
+
typeof schema._def === "object");
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=standardSchemaAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standardSchemaAdapter.js","sourceRoot":"","sources":["../src/standardSchemaAdapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAkB3D;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAY,EACZ,KAA8B,EAC9B,UAA0B,EAAE;IAE5B,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,yCAAyC;QACzC,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE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AC1B,IAAI,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,KAAK,YAAY,EAAE,CAAC;YACvE,QAAQ,CAAC,IAAI,CACX,GAAG,QAAQ,mEAAmE,CAC/E,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAe;IAEf,OAAO,CACL,MAAM,KAAK,IAAI;QACf,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,IAAI,MAAM;QAChB,OAAQ,MAAkC,CAAC,IAAI,KAAK,QAAQ,CAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeSpec Bridge
|
|
3
|
+
*
|
|
4
|
+
* Converts CompiledSchema to TypeSpec source code, then uses
|
|
5
|
+
* the TypeSpec compiler to emit to various targets.
|
|
6
|
+
*/
|
|
7
|
+
import type { CompiledSchema } from "./compile.js";
|
|
8
|
+
export interface EmitOptions {
|
|
9
|
+
/** Target emitters (e.g., "@typespec/openapi3", "@typespec/protobuf") */
|
|
10
|
+
targets: string[];
|
|
11
|
+
/** Output directory */
|
|
12
|
+
outDir: string;
|
|
13
|
+
/** Namespace for generated TypeSpec */
|
|
14
|
+
namespace?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Convert CompiledSchema to TypeSpec source code.
|
|
18
|
+
*/
|
|
19
|
+
export declare function compiledSchemaToTypeSpec(schema: CompiledSchema, namespace?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Emit CompiledSchema to target formats using TypeSpec compiler.
|
|
22
|
+
*
|
|
23
|
+
* This creates a temporary TypeSpec project with proper package.json
|
|
24
|
+
* to resolve emitter dependencies.
|
|
25
|
+
*/
|
|
26
|
+
export declare function emitToTargets(schema: CompiledSchema, options: EmitOptions): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=typespecBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typespecBridge.d.ts","sourceRoot":"","sources":["../src/typespecBridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAGV,cAAc,EAGf,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,WAAW;IAC1B,yEAAyE;IACzE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,cAAc,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA0BR;AAqLD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA6Ff"}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeSpec Bridge
|
|
3
|
+
*
|
|
4
|
+
* Converts CompiledSchema to TypeSpec source code, then uses
|
|
5
|
+
* the TypeSpec compiler to emit to various targets.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Convert CompiledSchema to TypeSpec source code.
|
|
9
|
+
*/
|
|
10
|
+
export function compiledSchemaToTypeSpec(schema, namespace) {
|
|
11
|
+
const lines = [];
|
|
12
|
+
const ns = namespace || schema.name;
|
|
13
|
+
// Imports
|
|
14
|
+
lines.push('import "@typespec/json-schema";');
|
|
15
|
+
lines.push("using TypeSpec.JsonSchema;");
|
|
16
|
+
lines.push("");
|
|
17
|
+
// Namespace
|
|
18
|
+
lines.push(`namespace ${sanitizeIdentifier(ns)};`);
|
|
19
|
+
lines.push("");
|
|
20
|
+
// Emit unions first (enums)
|
|
21
|
+
for (const union of schema.unions) {
|
|
22
|
+
lines.push(emitUnion(union));
|
|
23
|
+
lines.push("");
|
|
24
|
+
}
|
|
25
|
+
// Emit models
|
|
26
|
+
for (const model of schema.models) {
|
|
27
|
+
lines.push(emitModel(model));
|
|
28
|
+
lines.push("");
|
|
29
|
+
}
|
|
30
|
+
return lines.join("\n");
|
|
31
|
+
}
|
|
32
|
+
function emitUnion(union) {
|
|
33
|
+
const lines = [];
|
|
34
|
+
if (union.description) {
|
|
35
|
+
lines.push(`/** ${union.description} */`);
|
|
36
|
+
}
|
|
37
|
+
// Check if it's a string literal enum
|
|
38
|
+
const isStringEnum = union.variants.every((v) => v.type?.kind === "literal" && typeof v.type.value === "string");
|
|
39
|
+
if (isStringEnum) {
|
|
40
|
+
lines.push(`enum ${sanitizeIdentifier(union.name)} {`);
|
|
41
|
+
for (const variant of union.variants) {
|
|
42
|
+
const value = variant.type.value;
|
|
43
|
+
// If the name is a valid identifier, use it; otherwise quote it
|
|
44
|
+
if (isValidIdentifier(variant.name)) {
|
|
45
|
+
if (variant.name === value) {
|
|
46
|
+
lines.push(` ${variant.name},`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
lines.push(` ${variant.name}: "${value}",`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
lines.push(` "${value}",`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
lines.push("}");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Union type
|
|
60
|
+
const variantTypes = union.variants
|
|
61
|
+
.map((v) => (v.type ? typeToString(v.type) : v.name))
|
|
62
|
+
.join(" | ");
|
|
63
|
+
lines.push(`alias ${sanitizeIdentifier(union.name)} = ${variantTypes};`);
|
|
64
|
+
}
|
|
65
|
+
return lines.join("\n");
|
|
66
|
+
}
|
|
67
|
+
function emitModel(model) {
|
|
68
|
+
const lines = [];
|
|
69
|
+
if (model.description) {
|
|
70
|
+
lines.push(`/** ${model.description} */`);
|
|
71
|
+
}
|
|
72
|
+
lines.push("@jsonSchema");
|
|
73
|
+
lines.push(`model ${sanitizeIdentifier(model.name)} {`);
|
|
74
|
+
for (const field of model.fields) {
|
|
75
|
+
lines.push(emitField(field));
|
|
76
|
+
}
|
|
77
|
+
lines.push("}");
|
|
78
|
+
return lines.join("\n");
|
|
79
|
+
}
|
|
80
|
+
function emitField(field) {
|
|
81
|
+
const decorators = [];
|
|
82
|
+
// Add constraint decorators
|
|
83
|
+
if (field.constraints) {
|
|
84
|
+
const c = field.constraints;
|
|
85
|
+
if (c.minLength !== undefined)
|
|
86
|
+
decorators.push(`@minLength(${c.minLength})`);
|
|
87
|
+
if (c.maxLength !== undefined)
|
|
88
|
+
decorators.push(`@maxLength(${c.maxLength})`);
|
|
89
|
+
if (c.minValue !== undefined)
|
|
90
|
+
decorators.push(`@minValue(${c.minValue})`);
|
|
91
|
+
if (c.maxValue !== undefined)
|
|
92
|
+
decorators.push(`@maxValue(${c.maxValue})`);
|
|
93
|
+
if (c.pattern !== undefined)
|
|
94
|
+
decorators.push(`@pattern("${escapeString(c.pattern)}")`);
|
|
95
|
+
if (c.multipleOf !== undefined)
|
|
96
|
+
decorators.push(`@multipleOf(${c.multipleOf})`);
|
|
97
|
+
if (c.format !== undefined) {
|
|
98
|
+
// Map common formats to TypeSpec decorators
|
|
99
|
+
switch (c.format) {
|
|
100
|
+
case "uuid":
|
|
101
|
+
decorators.push('@format("uuid")');
|
|
102
|
+
break;
|
|
103
|
+
case "email":
|
|
104
|
+
decorators.push('@format("email")');
|
|
105
|
+
break;
|
|
106
|
+
case "uri":
|
|
107
|
+
case "url":
|
|
108
|
+
decorators.push('@format("uri")');
|
|
109
|
+
break;
|
|
110
|
+
case "date":
|
|
111
|
+
decorators.push('@format("date")');
|
|
112
|
+
break;
|
|
113
|
+
case "date-time":
|
|
114
|
+
decorators.push('@format("date-time")');
|
|
115
|
+
break;
|
|
116
|
+
default:
|
|
117
|
+
decorators.push(`@format("${c.format}")`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const decoratorStr = decorators.length > 0 ? `${decorators.join(" ")} ` : "";
|
|
122
|
+
const optionalMark = field.optional ? "?" : "";
|
|
123
|
+
const typeStr = typeToString(field.type);
|
|
124
|
+
const fieldName = sanitizeIdentifier(field.name);
|
|
125
|
+
return ` ${decoratorStr}${fieldName}${optionalMark}: ${typeStr};`;
|
|
126
|
+
}
|
|
127
|
+
function typeToString(type) {
|
|
128
|
+
switch (type.kind) {
|
|
129
|
+
case "scalar":
|
|
130
|
+
return scalarToTypeSpec(type.name);
|
|
131
|
+
case "array":
|
|
132
|
+
return `${typeToString(type.items)}[]`;
|
|
133
|
+
case "ref":
|
|
134
|
+
return sanitizeIdentifier(type.name);
|
|
135
|
+
case "literal":
|
|
136
|
+
if (typeof type.value === "string") {
|
|
137
|
+
return `"${escapeString(type.value)}"`;
|
|
138
|
+
}
|
|
139
|
+
return String(type.value);
|
|
140
|
+
case "union":
|
|
141
|
+
return type.variants.map(typeToString).join(" | ");
|
|
142
|
+
case "object": {
|
|
143
|
+
const fields = type.fields
|
|
144
|
+
.map((f) => {
|
|
145
|
+
const opt = f.optional ? "?" : "";
|
|
146
|
+
return `${f.name}${opt}: ${typeToString(f.type)}`;
|
|
147
|
+
})
|
|
148
|
+
.join("; ");
|
|
149
|
+
return `{ ${fields} }`;
|
|
150
|
+
}
|
|
151
|
+
default:
|
|
152
|
+
return "unknown";
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function scalarToTypeSpec(scalar) {
|
|
156
|
+
switch (scalar) {
|
|
157
|
+
case "string":
|
|
158
|
+
return "string";
|
|
159
|
+
case "int32":
|
|
160
|
+
return "int32";
|
|
161
|
+
case "int64":
|
|
162
|
+
return "int64";
|
|
163
|
+
case "float32":
|
|
164
|
+
return "float32";
|
|
165
|
+
case "float64":
|
|
166
|
+
return "float64";
|
|
167
|
+
case "boolean":
|
|
168
|
+
return "boolean";
|
|
169
|
+
case "date":
|
|
170
|
+
return "plainDate";
|
|
171
|
+
case "datetime":
|
|
172
|
+
return "utcDateTime";
|
|
173
|
+
case "bytes":
|
|
174
|
+
return "bytes";
|
|
175
|
+
default:
|
|
176
|
+
return "unknown";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function sanitizeIdentifier(name) {
|
|
180
|
+
// Replace invalid characters with underscores
|
|
181
|
+
let sanitized = name.replace(/[^A-Za-z0-9_]/g, "_");
|
|
182
|
+
// Ensure it doesn't start with a number
|
|
183
|
+
if (/^[0-9]/.test(sanitized)) {
|
|
184
|
+
sanitized = `_${sanitized}`;
|
|
185
|
+
}
|
|
186
|
+
return sanitized || "_";
|
|
187
|
+
}
|
|
188
|
+
function isValidIdentifier(name) {
|
|
189
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name);
|
|
190
|
+
}
|
|
191
|
+
function escapeString(s) {
|
|
192
|
+
return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Emit CompiledSchema to target formats using TypeSpec compiler.
|
|
196
|
+
*
|
|
197
|
+
* This creates a temporary TypeSpec project with proper package.json
|
|
198
|
+
* to resolve emitter dependencies.
|
|
199
|
+
*/
|
|
200
|
+
export async function emitToTargets(schema, options) {
|
|
201
|
+
const { targets, outDir, namespace } = options;
|
|
202
|
+
const fs = await import("node:fs/promises");
|
|
203
|
+
const path = await import("node:path");
|
|
204
|
+
const os = await import("node:os");
|
|
205
|
+
// Generate TypeSpec source
|
|
206
|
+
const tspSource = compiledSchemaToTypeSpec(schema, namespace);
|
|
207
|
+
// Create temp directory with a proper TypeSpec project structure
|
|
208
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "odk-"));
|
|
209
|
+
const tspPath = path.join(tempDir, "main.tsp");
|
|
210
|
+
try {
|
|
211
|
+
// Write the TypeSpec source
|
|
212
|
+
await fs.writeFile(tspPath, tspSource, "utf-8");
|
|
213
|
+
// Create package.json with dependencies so TypeSpec can find them
|
|
214
|
+
const packageJson = {
|
|
215
|
+
name: "odk-temp-project",
|
|
216
|
+
type: "module",
|
|
217
|
+
dependencies: {
|
|
218
|
+
"@typespec/compiler": "*",
|
|
219
|
+
"@typespec/json-schema": "*",
|
|
220
|
+
...Object.fromEntries(targets.map((t) => [t, "*"])),
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
await fs.writeFile(path.join(tempDir, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8");
|
|
224
|
+
// Symlink node_modules from odk-ts to the temp directory
|
|
225
|
+
// This avoids having to install packages
|
|
226
|
+
const odkNodeModules = path.resolve(import.meta.dirname, "../node_modules");
|
|
227
|
+
const tempNodeModules = path.join(tempDir, "node_modules");
|
|
228
|
+
try {
|
|
229
|
+
await fs.symlink(odkNodeModules, tempNodeModules, "dir");
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
// If symlink fails (e.g., on Windows without admin), copy the approach below
|
|
233
|
+
// For now, just try to compile with the current working directory
|
|
234
|
+
}
|
|
235
|
+
// Create tspconfig.yaml
|
|
236
|
+
const absoluteOutDir = path.resolve(process.cwd(), outDir);
|
|
237
|
+
const tspConfigContent = `
|
|
238
|
+
emit:
|
|
239
|
+
${targets.map((t) => ` - "${t}"`).join("\n")}
|
|
240
|
+
options:
|
|
241
|
+
${targets.map((t) => ` "${t}":\n output-dir: "${absoluteOutDir}"`).join("\n")}
|
|
242
|
+
`;
|
|
243
|
+
await fs.writeFile(path.join(tempDir, "tspconfig.yaml"), tspConfigContent, "utf-8");
|
|
244
|
+
// Ensure output directory exists
|
|
245
|
+
await fs.mkdir(absoluteOutDir, { recursive: true });
|
|
246
|
+
// Run TypeSpec compiler
|
|
247
|
+
const { compile, NodeHost } = await import("@typespec/compiler");
|
|
248
|
+
const program = await compile(NodeHost, tspPath, {
|
|
249
|
+
outputDir: absoluteOutDir,
|
|
250
|
+
emit: targets,
|
|
251
|
+
});
|
|
252
|
+
if (program.diagnostics.length > 0) {
|
|
253
|
+
for (const diag of program.diagnostics) {
|
|
254
|
+
if (diag.severity === "error") {
|
|
255
|
+
console.error(`TypeSpec error: ${diag.message}`);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
console.warn(`TypeSpec warning: ${diag.message}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const errors = program.diagnostics.filter((d) => d.severity === "error");
|
|
262
|
+
if (errors.length > 0) {
|
|
263
|
+
throw new Error(`TypeSpec compilation failed with ${errors.length} errors`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// biome-ignore lint/suspicious/noConsole: intentional emit-completion notice for CLI output
|
|
267
|
+
console.log(`Emitted to ${absoluteOutDir}`);
|
|
268
|
+
}
|
|
269
|
+
finally {
|
|
270
|
+
// Cleanup temp files
|
|
271
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=typespecBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typespecBridge.js","sourceRoot":"","sources":["../src/typespecBridge.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAsB,EACtB,SAAkB;IAElB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,EAAE,GAAG,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC;IAEpC,UAAU;IACV,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACzC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,YAAY;IACZ,KAAK,CAAC,IAAI,CAAC,aAAa,kBAAkB,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,4BAA4B;IAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,KAAK,CAAC,IAA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