@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
package/README.md
CHANGED
|
@@ -1,3 +1,123 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @omnidotdev/odk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Define schemas with Zod, ArkType, or Valibot. Emit to OpenAPI, Protobuf, JSON Schema, and more via TypeSpec.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @omnidotdev/odk
|
|
9
|
+
|
|
10
|
+
# Plus your schema library of choice:
|
|
11
|
+
bun add zod
|
|
12
|
+
# or: bun add arktype
|
|
13
|
+
# or: bun add valibot @valibot/to-json-schema
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { odk } from "@omnidotdev/odk";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
|
|
22
|
+
// Define schemas with your favorite library
|
|
23
|
+
const UserRole = z.enum(["admin", "user", "guest"]);
|
|
24
|
+
|
|
25
|
+
const User = z.object({
|
|
26
|
+
id: z.string().uuid(),
|
|
27
|
+
email: z.string().email(),
|
|
28
|
+
name: z.string().min(1).max(100),
|
|
29
|
+
role: UserRole,
|
|
30
|
+
createdAt: z.iso.datetime(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Create ODK schema
|
|
34
|
+
const schema = odk.schema("MyAPI", { UserRole, User });
|
|
35
|
+
|
|
36
|
+
// Generate TypeSpec source
|
|
37
|
+
const tsp = odk.toTypeSpec(schema);
|
|
38
|
+
console.log(tsp);
|
|
39
|
+
|
|
40
|
+
// Or emit to JSON Schema, OpenAPI, etc.
|
|
41
|
+
await odk.emit(schema, {
|
|
42
|
+
targets: ["@typespec/json-schema"],
|
|
43
|
+
outDir: "./generated",
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
### `odk.schema(name, types)`
|
|
50
|
+
|
|
51
|
+
Create an ODK schema from Standard Schema-compliant types.
|
|
52
|
+
|
|
53
|
+
- `name`: Namespace name for the generated TypeSpec
|
|
54
|
+
- `types`: Record of named types (Zod, ArkType, or Valibot schemas)
|
|
55
|
+
|
|
56
|
+
### `odk.toTypeSpec(schema, namespace?)`
|
|
57
|
+
|
|
58
|
+
Generate TypeSpec source code from an ODK schema.
|
|
59
|
+
|
|
60
|
+
### `odk.emit(schema, options)`
|
|
61
|
+
|
|
62
|
+
Emit to target formats using the TypeSpec compiler.
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
- `targets`: Array of emitters (e.g., `["@typespec/json-schema", "@typespec/openapi3"]`)
|
|
66
|
+
- `outDir`: Output directory
|
|
67
|
+
|
|
68
|
+
### `odk.toJSON(schema)`
|
|
69
|
+
|
|
70
|
+
Serialize the compiled schema to JSON (for use with the Rust CLI).
|
|
71
|
+
|
|
72
|
+
## Supported Schema Libraries
|
|
73
|
+
|
|
74
|
+
| Library | Version | Support |
|
|
75
|
+
|---------|---------|---------|
|
|
76
|
+
| Zod | 4.x | Native `toJSONSchema()` |
|
|
77
|
+
| Zod | 3.x | Via `zod-to-json-schema` |
|
|
78
|
+
| ArkType | 2.x | Native `toJsonSchema()` |
|
|
79
|
+
| Valibot | 1.x | Via `@valibot/to-json-schema` |
|
|
80
|
+
|
|
81
|
+
## TypeSpec Emitters
|
|
82
|
+
|
|
83
|
+
ODK supports any TypeSpec emitter. Common ones:
|
|
84
|
+
|
|
85
|
+
- `@typespec/json-schema` - JSON Schema output
|
|
86
|
+
- `@typespec/openapi3` - OpenAPI 3.0 (for HTTP APIs)
|
|
87
|
+
- `@typespec/protobuf` - Protocol Buffers
|
|
88
|
+
- Community emitters (install separately)
|
|
89
|
+
|
|
90
|
+
## Constraint Mapping
|
|
91
|
+
|
|
92
|
+
| Schema Constraint | TypeSpec Decorator |
|
|
93
|
+
|-------------------|-------------------|
|
|
94
|
+
| `.min(n)` / `.minLength(n)` | `@minLength(n)` |
|
|
95
|
+
| `.max(n)` / `.maxLength(n)` | `@maxLength(n)` |
|
|
96
|
+
| `.min(n)` (numbers) | `@minValue(n)` |
|
|
97
|
+
| `.max(n)` (numbers) | `@maxValue(n)` |
|
|
98
|
+
| `.regex(pattern)` | `@pattern("...")` |
|
|
99
|
+
| `.email()` | `@format("email")` |
|
|
100
|
+
| `.uuid()` | `@format("uuid")` |
|
|
101
|
+
| `.datetime()` | `@format("date-time")` |
|
|
102
|
+
|
|
103
|
+
### Non-Serializable Constraints
|
|
104
|
+
|
|
105
|
+
Some constraints can't be represented in TypeSpec/JSON Schema:
|
|
106
|
+
|
|
107
|
+
- `.transform()` - Runtime only
|
|
108
|
+
- `.refine()` / `.superRefine()` - Runtime only
|
|
109
|
+
- `.preprocess()` - Runtime only
|
|
110
|
+
|
|
111
|
+
These will emit warnings but won't break compilation.
|
|
112
|
+
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
See the `examples/` directory:
|
|
116
|
+
|
|
117
|
+
- `blog-zod.ts` - Zod 4 example
|
|
118
|
+
- `blog-arktype.ts` - ArkType example
|
|
119
|
+
- `emit-test.ts` - End-to-end emit test
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
The code in this repository is licensed under Apache 2.0, © [Omni LLC](https://omni.dev). See [LICENSE.md](LICENSE.md) for more information.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// biome-ignore-all lint/suspicious/noConsole: CLI tool — console output is expected
|
|
3
|
+
/**
|
|
4
|
+
* ODK CLI (TypeScript)
|
|
5
|
+
*
|
|
6
|
+
* Commands:
|
|
7
|
+
* odk compile <schema.ts> Compile and emit schema
|
|
8
|
+
* odk init Initialize a new ODK project
|
|
9
|
+
*/
|
|
10
|
+
import { writeFile } from "node:fs/promises";
|
|
11
|
+
import { resolve } from "node:path";
|
|
12
|
+
async function main() {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const command = args[0];
|
|
15
|
+
switch (command) {
|
|
16
|
+
case "compile":
|
|
17
|
+
await compileCommand(args.slice(1));
|
|
18
|
+
break;
|
|
19
|
+
case "init":
|
|
20
|
+
await initCommand();
|
|
21
|
+
break;
|
|
22
|
+
case "--help":
|
|
23
|
+
case "-h":
|
|
24
|
+
case undefined:
|
|
25
|
+
printHelp();
|
|
26
|
+
break;
|
|
27
|
+
default:
|
|
28
|
+
console.error(`Unknown command: ${command}`);
|
|
29
|
+
printHelp();
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function printHelp() {
|
|
34
|
+
console.log(`
|
|
35
|
+
ODK - Omni Development Kit
|
|
36
|
+
|
|
37
|
+
Usage:
|
|
38
|
+
odk compile <schema.ts> [options] Compile and emit schema
|
|
39
|
+
odk init Initialize a new ODK project
|
|
40
|
+
odk --help Show this help
|
|
41
|
+
|
|
42
|
+
Compile Options:
|
|
43
|
+
--out, -o <dir> Output directory (default: ./generated)
|
|
44
|
+
--target, -t <name> TypeSpec emitter (can be repeated)
|
|
45
|
+
Examples: @typespec/openapi3, @typespec/json-schema
|
|
46
|
+
|
|
47
|
+
Examples:
|
|
48
|
+
odk compile schema.ts
|
|
49
|
+
odk compile schema.ts -o ./out -t @typespec/openapi3 -t @typespec/json-schema
|
|
50
|
+
odk init
|
|
51
|
+
`);
|
|
52
|
+
}
|
|
53
|
+
async function compileCommand(args) {
|
|
54
|
+
const schemaArg = args[0];
|
|
55
|
+
if (!schemaArg) {
|
|
56
|
+
console.error("Error: No schema file specified");
|
|
57
|
+
console.error("Usage: odk compile <schema.ts>");
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
const schemaPath = resolve(schemaArg);
|
|
61
|
+
let outDir = "./generated";
|
|
62
|
+
let targets = [];
|
|
63
|
+
// Parse options
|
|
64
|
+
for (let i = 1; i < args.length; i++) {
|
|
65
|
+
if (args[i] === "--out" || args[i] === "-o") {
|
|
66
|
+
outDir = args[++i] ?? outDir;
|
|
67
|
+
}
|
|
68
|
+
else if (args[i] === "--target" || args[i] === "-t") {
|
|
69
|
+
const target = args[++i];
|
|
70
|
+
if (target)
|
|
71
|
+
targets.push(target);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (targets.length === 0) {
|
|
75
|
+
targets = ["@typespec/json-schema", "@typespec/openapi3"];
|
|
76
|
+
}
|
|
77
|
+
console.log(`Compiling ${schemaPath}...`);
|
|
78
|
+
console.log(`Targets: ${targets.join(", ")}`);
|
|
79
|
+
console.log(`Output: ${outDir}`);
|
|
80
|
+
try {
|
|
81
|
+
// Dynamic import of the schema file
|
|
82
|
+
const schemaModule = await import(schemaPath);
|
|
83
|
+
// Look for exported schema (ODKSchema from odk.schema())
|
|
84
|
+
const schema = schemaModule.default || schemaModule.schema;
|
|
85
|
+
if (!schema) {
|
|
86
|
+
console.error("Error: No schema found. Export a schema as default or named 'schema'.");
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
// Import odk and emit
|
|
90
|
+
const { odk } = await import("./odk.js");
|
|
91
|
+
await odk.emit(schema, {
|
|
92
|
+
targets,
|
|
93
|
+
outDir: resolve(outDir),
|
|
94
|
+
});
|
|
95
|
+
console.log("Done!");
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error("Compilation failed:", error);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async function initCommand() {
|
|
103
|
+
console.log("Initializing ODK project...");
|
|
104
|
+
// Create example schema using modern Zod-based API
|
|
105
|
+
const exampleSchema = `import { odk } from "@omnidotdev/odk";
|
|
106
|
+
import { z } from "zod";
|
|
107
|
+
|
|
108
|
+
// Define your models with Zod
|
|
109
|
+
const UserRole = z.enum(["admin", "user", "guest"]);
|
|
110
|
+
|
|
111
|
+
const User = z.object({
|
|
112
|
+
id: z.string().uuid(),
|
|
113
|
+
email: z.string().email(),
|
|
114
|
+
name: z.string().optional(),
|
|
115
|
+
role: UserRole,
|
|
116
|
+
createdAt: z.string().datetime(),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const Post = z.object({
|
|
120
|
+
id: z.string().uuid(),
|
|
121
|
+
title: z.string().min(1).max(200),
|
|
122
|
+
content: z.string(),
|
|
123
|
+
authorId: z.string().uuid(),
|
|
124
|
+
status: z.enum(["draft", "published", "archived"]),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Create and export the schema
|
|
128
|
+
export default odk.schema("MyApp", { User, Post, UserRole });
|
|
129
|
+
`;
|
|
130
|
+
await writeFile("schema.ts", exampleSchema);
|
|
131
|
+
console.log("Created schema.ts");
|
|
132
|
+
console.log(`
|
|
133
|
+
Next steps:
|
|
134
|
+
1. Install dependencies: bun add zod @omnidotdev/odk
|
|
135
|
+
2. Edit schema.ts to define your models
|
|
136
|
+
3. Run: odk compile schema.ts
|
|
137
|
+
4. Find generated files in ./generated/
|
|
138
|
+
`);
|
|
139
|
+
}
|
|
140
|
+
main().catch(console.error);
|
|
141
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,oFAAoF;AAEpF;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,SAAS;YACZ,MAAM,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;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;IAClB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,WAAW;IACxB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAE3C,mDAAmD;IACnD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBvB,CAAC;IAEA,MAAM,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAEjC,OAAO,CAAC,GAAG,CAAC;;;;;;CAMb,CAAC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CompiledSchema: The intermediate representation (IR) for ODK schemas.
|
|
3
|
+
* This format is consumed by the Rust CLI (tspgen) to emit TypeSpec.
|
|
4
|
+
*/
|
|
5
|
+
/** A span in a source file for error mapping. */
|
|
6
|
+
export interface SourceSpan {
|
|
7
|
+
file: string;
|
|
8
|
+
line: number;
|
|
9
|
+
column: number;
|
|
10
|
+
endLine?: number;
|
|
11
|
+
endColumn?: number;
|
|
12
|
+
}
|
|
13
|
+
/** A raw TypeSpec block to pass through verbatim. */
|
|
14
|
+
export interface RawTypeSpecBlock {
|
|
15
|
+
content: string;
|
|
16
|
+
source?: SourceSpan;
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Known extension types that ODK understands. */
|
|
20
|
+
type KnownExtension = {
|
|
21
|
+
kind: "zodTransform";
|
|
22
|
+
code: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "zodRefinement";
|
|
25
|
+
code: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "decorator";
|
|
29
|
+
value: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "openApi";
|
|
32
|
+
key: string;
|
|
33
|
+
value: unknown;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "drizzle";
|
|
36
|
+
decorator: string;
|
|
37
|
+
args?: string[];
|
|
38
|
+
};
|
|
39
|
+
/** Container for extensions on a field or model. */
|
|
40
|
+
export interface Extensions {
|
|
41
|
+
known?: KnownExtension[];
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface CompiledField {
|
|
45
|
+
name: string;
|
|
46
|
+
type: CompiledType;
|
|
47
|
+
optional?: boolean;
|
|
48
|
+
description?: string;
|
|
49
|
+
constraints?: FieldConstraints;
|
|
50
|
+
/** Decorators and extensions for this field */
|
|
51
|
+
extensions?: Extensions;
|
|
52
|
+
/** Source location for error mapping */
|
|
53
|
+
source?: SourceSpan;
|
|
54
|
+
}
|
|
55
|
+
export interface FieldConstraints {
|
|
56
|
+
minLength?: number;
|
|
57
|
+
maxLength?: number;
|
|
58
|
+
minValue?: number;
|
|
59
|
+
maxValue?: number;
|
|
60
|
+
pattern?: string;
|
|
61
|
+
format?: string;
|
|
62
|
+
multipleOf?: number;
|
|
63
|
+
}
|
|
64
|
+
export type CompiledType = {
|
|
65
|
+
kind: "scalar";
|
|
66
|
+
name: ScalarType;
|
|
67
|
+
} | {
|
|
68
|
+
kind: "array";
|
|
69
|
+
items: CompiledType;
|
|
70
|
+
} | {
|
|
71
|
+
kind: "ref";
|
|
72
|
+
name: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "literal";
|
|
75
|
+
value: string | number | boolean;
|
|
76
|
+
} | {
|
|
77
|
+
kind: "union";
|
|
78
|
+
variants: CompiledType[];
|
|
79
|
+
} | {
|
|
80
|
+
kind: "object";
|
|
81
|
+
fields: CompiledField[];
|
|
82
|
+
};
|
|
83
|
+
export type ScalarType = "string" | "int32" | "int64" | "float32" | "float64" | "boolean" | "date" | "datetime" | "bytes" | "unknown";
|
|
84
|
+
export interface CompiledModel {
|
|
85
|
+
name: string;
|
|
86
|
+
fields: CompiledField[];
|
|
87
|
+
description?: string;
|
|
88
|
+
/** Decorators and extensions for this model */
|
|
89
|
+
extensions?: Extensions;
|
|
90
|
+
/** Source location for error mapping */
|
|
91
|
+
source?: SourceSpan;
|
|
92
|
+
}
|
|
93
|
+
export interface CompiledUnion {
|
|
94
|
+
name: string;
|
|
95
|
+
variants: CompiledUnionVariant[];
|
|
96
|
+
description?: string;
|
|
97
|
+
/** Decorators and extensions for this union */
|
|
98
|
+
extensions?: Extensions;
|
|
99
|
+
/** Source location for error mapping */
|
|
100
|
+
source?: SourceSpan;
|
|
101
|
+
}
|
|
102
|
+
export interface CompiledUnionVariant {
|
|
103
|
+
name: string;
|
|
104
|
+
type?: CompiledType;
|
|
105
|
+
}
|
|
106
|
+
/** The kind of operation. */
|
|
107
|
+
export type OperationKind = "query" | "mutation" | "subscription" | "rpc" | "endpoint";
|
|
108
|
+
/** A compiled operation representing something a client can do. */
|
|
109
|
+
export interface CompiledOperation {
|
|
110
|
+
name: string;
|
|
111
|
+
kind: OperationKind;
|
|
112
|
+
input?: CompiledType;
|
|
113
|
+
output: CompiledType;
|
|
114
|
+
selection?: SelectionSet;
|
|
115
|
+
description?: string;
|
|
116
|
+
extensions?: Extensions;
|
|
117
|
+
}
|
|
118
|
+
/** A set of selected fields within an operation. */
|
|
119
|
+
export interface SelectionSet {
|
|
120
|
+
fields: FieldSelection[];
|
|
121
|
+
}
|
|
122
|
+
/** A single field selection within a selection set. */
|
|
123
|
+
export interface FieldSelection {
|
|
124
|
+
name: string;
|
|
125
|
+
alias?: string;
|
|
126
|
+
arguments?: [string, CompiledType][];
|
|
127
|
+
selection?: SelectionSet;
|
|
128
|
+
directives?: Directive[];
|
|
129
|
+
}
|
|
130
|
+
/** A directive applied to a field selection. */
|
|
131
|
+
export interface Directive {
|
|
132
|
+
name: string;
|
|
133
|
+
arguments?: [string, unknown][];
|
|
134
|
+
}
|
|
135
|
+
export interface CompiledSchema {
|
|
136
|
+
name: string;
|
|
137
|
+
models: CompiledModel[];
|
|
138
|
+
unions: CompiledUnion[];
|
|
139
|
+
/** Operation definitions (queries, mutations, endpoints, RPCs) */
|
|
140
|
+
operations?: CompiledOperation[];
|
|
141
|
+
/** Raw TypeSpec blocks to pass through verbatim */
|
|
142
|
+
rawBlocks?: RawTypeSpecBlock[];
|
|
143
|
+
/** TypeSpec imports required by this schema */
|
|
144
|
+
imports?: string[];
|
|
145
|
+
warnings?: string[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Serialize a CompiledSchema to JSON for the Rust CLI.
|
|
149
|
+
*/
|
|
150
|
+
export declare function serializeSchema(schema: CompiledSchema): string;
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,kDAAkD;AAClD,KAAK,cAAc,GACf;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,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ED,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;IACrC,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AAED,gDAAgD;AAChD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,kEAAkE;IAClE,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACjC,mDAAmD;IACnD,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE9D"}
|
package/dist/compile.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CompiledSchema: The intermediate representation (IR) for ODK schemas.
|
|
3
|
+
* This format is consumed by the Rust CLI (tspgen) to emit TypeSpec.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Serialize a CompiledSchema to JSON for the Rust CLI.
|
|
7
|
+
*/
|
|
8
|
+
export function serializeSchema(schema) {
|
|
9
|
+
return JSON.stringify(schema, null, 2);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmKH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAsB;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @omnidotdev/odk
|
|
3
|
+
*
|
|
4
|
+
* Define schemas with Zod, ArkType, or Valibot.
|
|
5
|
+
* Emit to OpenAPI, Protobuf, JSON Schema, and more via TypeSpec.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { odk } from "@omnidotdev/odk";
|
|
10
|
+
* import { z } from "zod";
|
|
11
|
+
*
|
|
12
|
+
* const User = z.object({
|
|
13
|
+
* id: z.string().uuid(),
|
|
14
|
+
* email: z.string().email(),
|
|
15
|
+
* role: z.enum(["admin", "user", "guest"]),
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* const schema = odk.schema("MyAPI", { User });
|
|
19
|
+
*
|
|
20
|
+
* // Emit to OpenAPI
|
|
21
|
+
* await odk.emit(schema, {
|
|
22
|
+
* targets: ["@typespec/openapi3"],
|
|
23
|
+
* outDir: "./generated",
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Or get TypeSpec source
|
|
27
|
+
* const tsp = odk.toTypeSpec(schema);
|
|
28
|
+
*
|
|
29
|
+
* // Or JSON for the Rust CLI
|
|
30
|
+
* const json = odk.toJSON(schema);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export { serializeSchema } from "./compile.js";
|
|
34
|
+
export { extractJsonSchema, getSchemaLibrary } from "./jsonSchemaExtract.js";
|
|
35
|
+
export { odk } from "./odk.js";
|
|
36
|
+
export { standardSchemaToCompiled } from "./standardSchemaAdapter.js";
|
|
37
|
+
export { compiledSchemaToTypeSpec, emitToTargets } from "./typespecBridge.js";
|
|
38
|
+
export type { CompiledField, CompiledModel, CompiledOperation, CompiledSchema, CompiledType, CompiledUnion, CompiledUnionVariant, Directive, FieldConstraints, FieldSelection, OperationKind, ScalarType, SelectionSet, } from "./compile.js";
|
|
39
|
+
export type { JSONSchema } from "./jsonSchemaExtract.js";
|
|
40
|
+
export type { ODKSchema, SchemaOptions } from "./odk.js";
|
|
41
|
+
export type { AdapterOptions } from "./standardSchemaAdapter.js";
|
|
42
|
+
export type { EmitOptions } from "./typespecBridge.js";
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG9E,YAAY,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,UAAU,EACV,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzD,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @omnidotdev/odk
|
|
3
|
+
*
|
|
4
|
+
* Define schemas with Zod, ArkType, or Valibot.
|
|
5
|
+
* Emit to OpenAPI, Protobuf, JSON Schema, and more via TypeSpec.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { odk } from "@omnidotdev/odk";
|
|
10
|
+
* import { z } from "zod";
|
|
11
|
+
*
|
|
12
|
+
* const User = z.object({
|
|
13
|
+
* id: z.string().uuid(),
|
|
14
|
+
* email: z.string().email(),
|
|
15
|
+
* role: z.enum(["admin", "user", "guest"]),
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* const schema = odk.schema("MyAPI", { User });
|
|
19
|
+
*
|
|
20
|
+
* // Emit to OpenAPI
|
|
21
|
+
* await odk.emit(schema, {
|
|
22
|
+
* targets: ["@typespec/openapi3"],
|
|
23
|
+
* outDir: "./generated",
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Or get TypeSpec source
|
|
27
|
+
* const tsp = odk.toTypeSpec(schema);
|
|
28
|
+
*
|
|
29
|
+
* // Or JSON for the Rust CLI
|
|
30
|
+
* const json = odk.toJSON(schema);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export { serializeSchema } from "./compile.js";
|
|
34
|
+
export { extractJsonSchema, getSchemaLibrary } from "./jsonSchemaExtract.js";
|
|
35
|
+
// Main API
|
|
36
|
+
export { odk } from "./odk.js";
|
|
37
|
+
export { standardSchemaToCompiled } from "./standardSchemaAdapter.js";
|
|
38
|
+
export { compiledSchemaToTypeSpec, emitToTargets } from "./typespecBridge.js";
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,WAAW;AACX,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema extraction from different Standard Schema libraries.
|
|
3
|
+
* Each library has its own method for converting to JSON Schema.
|
|
4
|
+
*/
|
|
5
|
+
export interface JSONSchema {
|
|
6
|
+
type?: string | string[];
|
|
7
|
+
properties?: Record<string, JSONSchema>;
|
|
8
|
+
required?: string[];
|
|
9
|
+
items?: JSONSchema;
|
|
10
|
+
enum?: (string | number | boolean)[];
|
|
11
|
+
oneOf?: JSONSchema[];
|
|
12
|
+
anyOf?: JSONSchema[];
|
|
13
|
+
allOf?: JSONSchema[];
|
|
14
|
+
$ref?: string;
|
|
15
|
+
$defs?: Record<string, JSONSchema>;
|
|
16
|
+
definitions?: Record<string, JSONSchema>;
|
|
17
|
+
description?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
minLength?: number;
|
|
20
|
+
maxLength?: number;
|
|
21
|
+
minimum?: number;
|
|
22
|
+
maximum?: number;
|
|
23
|
+
exclusiveMinimum?: number;
|
|
24
|
+
exclusiveMaximum?: number;
|
|
25
|
+
pattern?: string;
|
|
26
|
+
format?: string;
|
|
27
|
+
multipleOf?: number;
|
|
28
|
+
additionalProperties?: boolean | JSONSchema;
|
|
29
|
+
default?: unknown;
|
|
30
|
+
const?: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Detect which schema library the schema comes from and extract JSON Schema.
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractJsonSchema(schema: unknown): JSONSchema;
|
|
36
|
+
/**
|
|
37
|
+
* Get the library name from a schema for error messages.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getSchemaLibrary(schema: unknown): string;
|
|
40
|
+
//# sourceMappingURL=jsonSchemaExtract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonSchemaExtract.d.ts","sourceRoot":"","sources":["../src/jsonSchemaExtract.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC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