Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

npm license

Juno DID tools

Tools for generating Juno serverless functions code.

🧰 Functions

⚙️ zodToIdl

Converts a Zod schema to a Candid IDL type for use with IDL.encode and IDL.decode.

Function Type
zodToIdl ({ id, schema, suffix }: { id: string; schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; suffix: "Args" or "Result"; }) => IdlResult

Parameters:

  • id: - The base name used to generate the IDL type name.
  • schema: - The Zod schema to convert.
  • suffix: - Whether this represents function arguments or a return type.

Returns:

An object containing the generated IDL type and the base type name.

🔗 Source

⚙️ zodToRust

Converts a Zod schema to a Rust type definition string.

Function Type
zodToRust ({ id, schema, suffix }: { id: string; schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; suffix: "Args" or "Result"; }) => RustResult

Parameters:

  • id: - The base name used to generate the Rust struct or type alias name.
  • schema: - The Zod schema to convert.
  • suffix: - Whether this represents function arguments or a return type.

Returns:

An object containing the generated Rust code and the base type name.

🔗 Source

⚙️ zodToCandid

Converts a Zod schema to a Candid type definition string.

Function Type
zodToCandid ({ id, schema, suffix }: { id: string; schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; suffix: "Args" or "Result"; }) => CandidResult

Parameters:

  • id: - The base name used to generate the type name.
  • schema: - The Zod schema to convert.
  • suffix: - Whether this represents function arguments or a return type.

Returns:

An object containing the generated Candid type declaration and the base type name.

🔗 Source

🍹 Interfaces

⚙️ IdlResult

Property Type Description
baseName string
idl IDL.Type

🔗 Source

⚙️ RustResult

Property Type Description
baseName string
code string

🔗 Source

⚙️ CandidResult

Property Type Description
baseName string
code string

🔗 Source

License

MIT © David Dal Busco