Skip to content

Commit 33b6b0f

Browse files
docs: schema types (#669)
* docs: schema types Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> * 📄 Update LLMs.txt snapshot for PR review --------- Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 4c70243 commit 33b6b0f

4 files changed

Lines changed: 97 additions & 2 deletions

File tree

.llms-snapshots/llms-full.txt

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11325,7 +11325,7 @@ API reference for writing serverless functions in Rust or TypeScript.
1132511325

1132611326
[## 🗃️ TypeScript
1132711327

11328-
5 items](/docs/reference/functions/typescript.md)
11328+
6 items](/docs/reference/functions/typescript.md)
1132911329

1133011330
# Plugins
1133111331

@@ -11729,7 +11729,7 @@ API reference for writing serverless functions in Rust or TypeScript.
1172911729

1173011730
[## 🗃️ TypeScript
1173111731

11732-
5 items](/docs/reference/functions/typescript.md)
11732+
6 items](/docs/reference/functions/typescript.md)
1173311733

1173411734
# Rust
1173511735

@@ -11755,6 +11755,10 @@ This page lists the crate versions for each Juno release, to help you upgrade yo
1175511755

1175611756
API reference for writing serverless functions with TypeScript.
1175711757

11758+
[## 📄️ Schema Types
11759+
11760+
Juno provides a type system built on top of Zod, extended with a few additional types you'll need when working with serverless functions.](/docs/reference/functions/typescript/schema.md)
11761+
1175811762
[## 📄️ SDK
1175911763

1176011764
The SDK is provided by the @junobuild/functions library.](/docs/reference/functions/typescript/sdk.md)
@@ -12237,6 +12241,10 @@ pub fn encode_doc_data_to_string<T: Serialize>( data: &T,) -> Result<String,
1223712241

1223812242
API reference for writing serverless functions with TypeScript.
1223912243

12244+
[## 📄️ Schema Types
12245+
12246+
Juno provides a type system built on top of Zod, extended with a few additional types you'll need when working with serverless functions.](/docs/reference/functions/typescript/schema.md)
12247+
1224012248
[## 📄️ SDK
1224112249

1224212250
The SDK is provided by the @junobuild/functions library.](/docs/reference/functions/typescript/sdk.md)
@@ -12698,6 +12706,48 @@ Logging is fully supported. Objects are stringified and logs are routed to the I
1269812706
console.log("Hello from the Satellite");console.info("Hello", { type: "info", msg: "Something happened" });
1269912707
```
1270012708

12709+
# Schema Types
12710+
12711+
Juno provides a type system built on top of [Zod](https://zod.dev/), extended with a few additional types you'll need when working with serverless functions.
12712+
12713+
All types are available through `j`.
12714+
12715+
```
12716+
import { j } from "@junobuild/schema";
12717+
```
12718+
12719+
---
12720+
12721+
## Juno Types
12722+
12723+
The following are specific types provided by Juno:
12724+
12725+
### j.principal()
12726+
12727+
Validates and represents an Internet Computer Principal.
12728+
12729+
```
12730+
j.principal();
12731+
```
12732+
12733+
### j.uint8array()
12734+
12735+
Validates and represents a `Uint8Array`.
12736+
12737+
```
12738+
j.uint8array();
12739+
```
12740+
12741+
---
12742+
12743+
## Zod Types
12744+
12745+
All Zod types are available through `j`. Refer to the [Zod documentation](https://zod.dev/) for the full API reference.
12746+
12747+
**Note:**
12748+
12749+
`union` is not supported. Use `discriminatedUnion` instead.
12750+
1270112751
# SDK
1270212752

1270312753
The following functions are provided to help you work with document and asset data inside your Satellite. They are part of the tools available when writing serverless functions in TypeScript and support common tasks such as interacting with the datastore, storage, and custom hook logic.

.llms-snapshots/llms.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Juno is your self-contained serverless platform for building full-stack web apps
218218
- [Canisters](https://juno.build/docs/reference/functions/typescript/canisters.md): The following functions can be used to interact with well-known Internet Computer canisters from your serverless functions.
219219
- [IC-CDK](https://juno.build/docs/reference/functions/typescript/ic-cdk.md): Juno exposes a growing set of these features for TypeScript, allowing you to build serverless functions that interact with the IC using a familiar developer experience.
220220
- [Node.js](https://juno.build/docs/reference/functions/typescript/node.md): The TypeScript runtime used in Juno does not provide full Node.js support. Polyfills are added iteratively to keep the environment stable and predictable.
221+
- [Schema Types](https://juno.build/docs/reference/functions/typescript/schema.md): Juno provides a type system built on top of Zod, extended with a few additional types you'll need when working with serverless functions.
221222
- [SDK](https://juno.build/docs/reference/functions/typescript/sdk.md): The SDK is provided by the @junobuild/functions library.
222223
- [Utils](https://juno.build/docs/reference/functions/typescript/utils.md): All utilities on this page are provided by the @junobuild/functions library.
223224

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Schema Types
2+
3+
Juno provides a type system built on top of [Zod](https://zod.dev/), extended with a few additional types you'll need when working with serverless functions.
4+
5+
All types are available through `j`.
6+
7+
```typescript
8+
import { j } from "@junobuild/schema";
9+
```
10+
11+
---
12+
13+
## Juno Types
14+
15+
The following are specific types provided by Juno:
16+
17+
### j.principal()
18+
19+
Validates and represents an Internet Computer Principal.
20+
21+
```typescript
22+
j.principal();
23+
```
24+
25+
### j.uint8array()
26+
27+
Validates and represents a `Uint8Array`.
28+
29+
```typescript
30+
j.uint8array();
31+
```
32+
33+
---
34+
35+
## Zod Types
36+
37+
All Zod types are available through `j`. Refer to the [Zod documentation](https://zod.dev/) for the full API reference.
38+
39+
:::note
40+
41+
`union` is not supported. Use `discriminatedUnion` instead.
42+
43+
:::

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ const sidebars: SidebarsConfig = {
407407
"API reference for writing serverless functions with TypeScript."
408408
},
409409
items: [
410+
"reference/functions/typescript/schema",
410411
"reference/functions/typescript/sdk",
411412
"reference/functions/typescript/utils",
412413
"reference/functions/typescript/ic-cdk",

0 commit comments

Comments
 (0)