@arpc-packages/client-gen
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "@arpc-packages/client-gen", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"module": "dist/index.mjs", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -11,2 +11,4 @@ export type Exception = { | ||
export type LiteralType = string | number | bigint | boolean | null; | ||
export type Signature = { | ||
@@ -35,3 +37,3 @@ type: "string" | "number" | "bigint" | "boolean"; | ||
type: "literal"; | ||
value: string | number | bigint | boolean | null; | ||
value: LiteralType; | ||
}; | ||
@@ -38,0 +40,0 @@ |
export * from "./BuildData"; | ||
export * from "./python"; | ||
export { php } from "./php"; | ||
export { typescript } from "./typescript"; | ||
export { golang } from "./golang"; |
import type { Client, Enum, Method, Methods, Object, Signature } from "../BuildData"; | ||
// Renders the signature for a type. | ||
function renderSignature(signature: Signature, enums: Enum[]) { | ||
function renderSignature(signature: Signature, enums: Enum[]): string { | ||
// Handle the easy types. | ||
@@ -38,2 +38,5 @@ const v = typeMap[signature.type]; | ||
if (signature.type === "enum_value") return `typing.Literal[${Array.from(enums.find((x) => x.name === signature.enum)!.data.keys()).sort().map((x) => `${signature.enum}.${x}`).join(", ")}]`; | ||
// Throw an error. | ||
throw new Error(`Unknown signature type ${signature.type}.`); | ||
} | ||
@@ -319,3 +322,3 @@ | ||
null: "None", | ||
}; | ||
} as const; | ||
@@ -322,0 +325,0 @@ // Renders the input. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
617334
29
6497