@seam-rpc/server 4.3.2 → 4.3.3
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/bin/generate.js +1 -1
- package/dist/test.d.ts +2 -0
- package/dist/test.js +38 -0
- package/package.json +1 -1
package/dist/bin/generate.js
CHANGED
|
@@ -137,7 +137,7 @@ export async function generateClientFile({ tsPath, jsPath, outputPath, }) {
|
|
|
137
137
|
* +===================================+
|
|
138
138
|
*/
|
|
139
139
|
|
|
140
|
-
import { callApi
|
|
140
|
+
import { callApi } from "@seam-rpc/client";
|
|
141
141
|
|
|
142
142
|
`;
|
|
143
143
|
const functions = [];
|
package/dist/test.d.ts
ADDED
package/dist/test.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { zodToTs, createAuxiliaryTypeStore } from "zod-to-ts";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
export function convert(schema) {
|
|
5
|
+
const store = createAuxiliaryTypeStore();
|
|
6
|
+
const { node } = zodToTs(schema, {
|
|
7
|
+
auxiliaryTypeStore: store,
|
|
8
|
+
});
|
|
9
|
+
const typeAlias = ts.factory.createTypeAliasDeclaration([ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)], ts.factory.createIdentifier("GeneratedType"), undefined, node);
|
|
10
|
+
const file = ts.createSourceFile("types.ts", "", ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
|
|
11
|
+
const printer = ts.createPrinter({
|
|
12
|
+
newLine: ts.NewLineKind.LineFeed,
|
|
13
|
+
removeComments: false,
|
|
14
|
+
});
|
|
15
|
+
return printer.printNode(ts.EmitHint.Unspecified, typeAlias, file);
|
|
16
|
+
}
|
|
17
|
+
console.log(convert(z.object({
|
|
18
|
+
test: z.object({
|
|
19
|
+
a: z.string(),
|
|
20
|
+
b: z.string(),
|
|
21
|
+
c: z.string(),
|
|
22
|
+
d: z.string(),
|
|
23
|
+
e: z.string(),
|
|
24
|
+
f: z.string(),
|
|
25
|
+
ga: z.string(),
|
|
26
|
+
wea: z.string(),
|
|
27
|
+
waa: z.string(),
|
|
28
|
+
wga: z.string(),
|
|
29
|
+
weega: z.string(),
|
|
30
|
+
wwa: z.string(),
|
|
31
|
+
af: z.string(),
|
|
32
|
+
wha: z.string(),
|
|
33
|
+
ag: z.string(),
|
|
34
|
+
wwea: z.string(),
|
|
35
|
+
we3a: z.string(),
|
|
36
|
+
wada: z.string(),
|
|
37
|
+
})
|
|
38
|
+
})));
|