Compare commits

...

20 Commits

Author SHA1 Message Date
Guido D'Orsi
83986c6699 Merge pull request #2270 from garden-co/changeset-release/main
Version Packages
2025-05-19 21:39:10 +02:00
github-actions[bot]
59a4e2cee3 Version Packages 2025-05-19 19:32:13 +00:00
Trisha Lim
d2a971c86c fix: update plaintext init to zod (#2283) 2025-05-19 20:29:15 +01:00
Trisha Lim
aae9ef49da improvement: org design pattern docs (#2253) 2025-05-19 19:38:05 +01:00
Trisha Lim
58c5ee5c73 form design pattern docs: emphasize not having a save button (#2241)
* form design pattern docs: emphasize not having a save button

* rewording to follow diataxis

* fix: instructions field shows undefined
2025-05-19 19:37:40 +01:00
Trisha Lim
f1d6097ee6 fix: twoslash breaks page scroll (#2267) 2025-05-19 17:37:35 +01:00
Anselm
3172a61543 Explain Loaded 2025-05-19 16:47:40 +01:00
Anselm
25324c28d9 Mention RN issue 2025-05-19 16:26:28 +01:00
Anselm
f74cb4885a Upgrade guide progress 2025-05-19 15:59:53 +01:00
Guido D'Orsi
4130213d82 Merge pull request #2271 from garden-co/fix/account-profile
fix: force sync of the group after acceptInvite
2025-05-19 15:35:04 +02:00
Guido D'Orsi
c36a26e669 test: update sync snapshots 2025-05-19 15:22:45 +02:00
Guido D'Orsi
c8b33ad7f1 fix: force sync of the group after acceptInvite 2025-05-19 15:14:41 +02:00
Benjamin S. Leveritt
a79489683e Merge pull request #2246 from joeinnes/2245-svelte-provider
add Svelte provider documentation and metadata
2025-05-19 14:09:08 +01:00
Guido D'Orsi
1251fb89b1 Merge pull request #2269 from garden-co/fix/account-profile
fix: make the profile access on Group members trigger updates correctly
2025-05-19 15:07:13 +02:00
Guido D'Orsi
cdfc10557a fix: make the profile access on Group members trigger updates correctly 2025-05-19 15:01:30 +02:00
Anselm
6e0481114c Fix homepage type errors 2025-05-19 13:50:40 +01:00
Anselm
f7e157d2f5 Make docNavigationItems js again 2025-05-19 13:35:10 +01:00
Anselm
ce83f101c7 More skeleton for the upgrade guide 2025-05-19 13:01:24 +01:00
Joe Innes
6efdfef386 Merge remote-tracking branch 'upstream/main' into 2245-svelte-provider 2025-05-15 17:03:55 +02:00
Joe Innes
6528d350ec add Svelte provider documentation and metadata 2025-05-15 17:02:40 +02:00
130 changed files with 1112 additions and 187 deletions

View File

@@ -1,5 +1,17 @@
# betterauth
## 0.1.6
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-betterauth-server-plugin@0.14.1
- jazz-inspector@0.14.1
- jazz-react@0.14.1
- jazz-react-auth-betterauth@0.14.1
- jazz-betterauth-client-plugin@0.14.1
## 0.1.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "betterauth",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,14 @@
# chat-rn-expo-clerk
## 1.0.125
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-expo@0.14.1
- jazz-react-native-media-images@0.14.1
## 1.0.124
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "chat-rn-expo-clerk",
"main": "index.js",
"version": "1.0.124",
"version": "1.0.125",
"scripts": {
"build": "expo export -p ios",
"start": "expo start",

View File

@@ -1,5 +1,13 @@
# chat-rn-expo
## 1.0.112
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-expo@0.14.1
## 1.0.111
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-rn-expo",
"version": "1.0.111",
"version": "1.0.112",
"main": "index.js",
"scripts": {
"build": "tsc --noEmit && expo export -p ios",

View File

@@ -1,5 +1,16 @@
# chat-rn
## 1.0.120
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- cojson-transport-ws@0.14.1
- jazz-react-native@0.14.1
## 1.0.119
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-rn",
"version": "1.0.119",
"version": "1.0.120",
"main": "index.js",
"scripts": {
"android": "react-native run-android",

View File

@@ -1,5 +1,14 @@
# chat-vue
## 0.0.103
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-browser@0.14.1
- jazz-vue@0.14.1
## 0.0.102
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-vue",
"version": "0.0.102",
"version": "0.0.103",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,14 @@
# jazz-example-chat
## 0.0.201
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-inspector@0.14.1
- jazz-react@0.14.1
## 0.0.200
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-chat",
"private": true,
"version": "0.0.200",
"version": "0.0.201",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# minimal-auth-clerk
## 0.0.100
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
- jazz-react-auth-clerk@0.14.1
## 0.0.99
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "clerk",
"private": true,
"version": "0.0.99",
"version": "0.0.100",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# file-share-svelte
## 0.0.84
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-svelte@0.14.1
- jazz-inspector-element@0.14.1
## 0.0.83
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "file-share-svelte",
"version": "0.0.83",
"version": "0.0.84",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,14 @@
# jazz-tailwind-demo-auth-starter
## 0.0.40
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-inspector@0.14.1
- jazz-react@0.14.1
## 0.0.39
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "filestream",
"private": true,
"version": "0.0.39",
"version": "0.0.40",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# form
## 0.1.41
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.1.40
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "form",
"private": true,
"version": "0.1.40",
"version": "0.1.41",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -80,6 +80,7 @@ export const JazzAccount = co
const draft = DraftBubbleTeaOrder.create(
{
addOns: ListOfBubbleTeaAddOns.create([], account),
instructions: co.plainText().create("", account),
},
account,
);

View File

@@ -1,5 +1,13 @@
# image-upload
## 0.0.97
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.96
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "image-upload",
"private": true,
"version": "0.0.96",
"version": "0.0.97",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# jazz-example-inspector
## 0.0.150
### Patch Changes
- Updated dependencies [c8b33ad]
- cojson@0.14.1
- cojson-transport-ws@0.14.1
- jazz-inspector@0.14.1
## 0.0.149
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-inspector-app",
"private": true,
"version": "0.0.149",
"version": "0.0.150",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# multi-cursors
## 0.0.93
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.92
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "multi-cursors",
"private": true,
"version": "0.0.92",
"version": "0.0.93",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# multiauth
## 0.0.41
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
- jazz-react-auth-clerk@0.14.1
## 0.0.40
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "multiauth",
"private": true,
"version": "0.0.40",
"version": "0.0.41",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# jazz-example-musicplayer
## 0.0.122
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-inspector@0.14.1
- jazz-react@0.14.1
## 0.0.121
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-music-player",
"private": true,
"version": "0.0.121",
"version": "0.0.122",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# organization
## 0.0.93
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.92
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "organization",
"private": true,
"version": "0.0.92",
"version": "0.0.93",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,5 @@
import { useAccount, useCoState } from "jazz-react";
import { Account, Group, ID, Loaded } from "jazz-tools";
import { useAccount } from "jazz-react";
import { Account, Group, Loaded } from "jazz-tools";
import { Organization } from "../schema.ts";
export function OrganizationMembers({
@@ -12,7 +12,7 @@ export function OrganizationMembers({
{group.members.map((member) => (
<MemberItem
key={member.id}
accountId={member.account.id}
account={member.account}
role={member.role}
group={group}
/>
@@ -22,18 +22,13 @@ export function OrganizationMembers({
}
function MemberItem({
accountId,
account,
role,
group,
}: { accountId: ID<Account>; role: string; group: Group }) {
const account = useCoState(Account, accountId, {
resolve: {
profile: true,
},
});
}: { account: Account; role: string; group: Group }) {
const { me } = useAccount();
const canRemoveMember = group.myRole() === "admin" && accountId !== me?.id;
const canRemoveMember = group.myRole() === "admin" && account.id !== me?.id;
function handleRemoveMember() {
if (canRemoveMember && account) {
@@ -44,7 +39,7 @@ function MemberItem({
return (
<div className="px-4 py-5 sm:px-6 flex justify-between items-center">
<div>
<strong className="font-medium">{account?.profile.name}</strong> ({role}
<strong className="font-medium">{account.profile?.name}</strong> ({role}
)
</div>
{canRemoveMember && (

View File

@@ -1,5 +1,13 @@
# passkey-svelte
## 0.0.88
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-svelte@0.14.1
## 0.0.87
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "passkey-svelte",
"version": "0.0.87",
"version": "0.0.88",
"type": "module",
"private": true,
"scripts": {

View File

@@ -1,5 +1,13 @@
# minimal-auth-passkey
## 0.0.98
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.97
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "passkey",
"private": true,
"version": "0.0.97",
"version": "0.0.98",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# passphrase
## 0.0.95
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.94
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "passphrase",
"private": true,
"version": "0.0.94",
"version": "0.0.95",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# jazz-password-manager
## 0.0.119
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.118
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-password-manager",
"private": true,
"version": "0.0.118",
"version": "0.0.119",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# jazz-example-pets
## 0.0.217
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.216
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-pets",
"private": true,
"version": "0.0.216",
"version": "0.0.217",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,13 @@
# reactions
## 0.0.97
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.96
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "reactions",
"private": true,
"version": "0.0.96",
"version": "0.0.97",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# richtext-tiptap
## 0.1.10
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
- jazz-richtext-tiptap@0.1.10
## 0.1.9
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "richtext-tiptap",
"private": true,
"version": "0.1.9",
"version": "0.1.10",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# richtext
## 0.0.87
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
- jazz-richtext-prosemirror@0.1.21
## 0.0.86
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "richtext",
"private": true,
"version": "0.0.86",
"version": "0.0.87",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# todo-vue
## 0.0.101
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-browser@0.14.1
- jazz-vue@0.14.1
## 0.0.100
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "todo-vue",
"version": "0.0.100",
"version": "0.0.101",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,13 @@
# jazz-example-todo
## 0.0.216
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-react@0.14.1
## 0.0.215
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-todo",
"private": true,
"version": "0.0.215",
"version": "0.0.216",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -1,5 +1,14 @@
# version-history
## 0.0.95
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-inspector@0.14.1
- jazz-react@0.14.1
## 0.0.94
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "version-history",
"private": true,
"version": "0.0.94",
"version": "0.0.95",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -87,3 +87,14 @@ html.dark {
}
@import "@shikijs/twoslash/style-rich.css";
/* fix for https://github.com/garden-co/jazz/issues/2257*/
.twoslash .twoslash-popup-container {
display: none;
}
.twoslash .twoslash-hover:hover .twoslash-popup-container,
.twoslash .twoslash-error-hover:hover .twoslash-popup-container,
.twoslash .twoslash-query-presisted .twoslash-popup-container,
.twoslash .twoslash-query-line .twoslash-popup-container {
display: inline-flex;
}

View File

@@ -4,12 +4,13 @@ import { SideNav, SideNavBody, SideNavHeader } from "@/components/SideNav";
import { SideNavSection } from "@/components/SideNavSection";
import { FrameworkSelect } from "@/components/docs/FrameworkSelect";
import { docNavigationItems } from "@/content/docs/docNavigationItems";
import { DocNavigationSection } from "@/content/docs/docNavigationItemsTypes";
import { useFramework } from "@/lib/use-framework";
import React from "react";
export function DocNav() {
const framework = useFramework();
const items = docNavigationItems.map((headerItem) => {
const items = (docNavigationItems as DocNavigationSection[]).map((headerItem) => {
return {
...headerItem,
items: headerItem.items

View File

@@ -2,6 +2,7 @@ import {
docNavigationItems,
flatItemsWithNavLinks,
} from "@/content/docs/docNavigationItems";
import { DocNavigationItem } from "@/content/docs/docNavigationItemsTypes";
import { Icon } from "@garden-co/design-system/src/components/atoms/Icon";
import { Separator } from "@garden-co/design-system/src/components/atoms/Separator";
import Link from "next/link";
@@ -18,7 +19,7 @@ export function PreviousNextLinks({ slug, framework }: PreviousNextLinksProps) {
? `/docs/${framework}/${slug.join("/")}`
: `/docs/${framework}`;
return currentPath === itemPath;
});
}) as DocNavigationItem;
if (
currentItem?.excludeFromNavigation ||

View File

@@ -4,22 +4,22 @@ export const metadata = {
import { CodeGroup } from "@/components/forMdx";
# Creating and updating CoValues in a form
# How to write autosaving forms to create and update CoValues
Normally, we implement forms using
[the onSubmit handler](https://react.dev/reference/react-dom/components/form#handle-form-submission-on-the-client),
or by making [a controlled form with useState](https://christinakozanian.medium.com/building-controlled-forms-with-usestate-in-react-f9053ad255a0),
or by using special libraries like [react-hook-form](https://www.react-hook-form.com).
This guide shows you a simple and powerful way to implement forms for creating and updating CoValues.
In Jazz, we can do something simpler and more powerful, because CoValues give us reactive,
persisted state which we can use to directly edit live objects, and represent auto-saved drafts.
We'll build:
1. An update form that saves changes as you make them, removing the need for a save button.
2. A create form that autosaves your changes into a draft, so you can come back to it later.
[See the full example here.](https://github.com/garden-co/jazz/tree/main/examples/form)
**Note**: If you do need a save button on your update form, this guide is not for you. Another option
is to use [react-hook-form](https://www.react-hook-form.com), which you can see in [this example](https://github.com/garden-co/jazz/tree/main/examples/password-manager).
## Updating a CoValue
To update a CoValue, we simply assign the new value directly as changes happen. These changes are synced to the server, so
we don't need to handle form submissions either.
To update a CoValue, we simply assign the new value directly as changes happen. These changes are synced to the server.
<CodeGroup>
```tsx
@@ -31,7 +31,7 @@ we don't need to handle form submissions either.
```
</CodeGroup>
This means we can write update forms in fewer lines of code.
It's that simple!
## Creating a CoValue

View File

@@ -4,10 +4,9 @@ export const metadata = {
import { CodeGroup } from "@/components/forMdx";
# Sharing data through Organizations
# How to share data between users through Organizations
Organizations are a way to share a set of data between users.
Different apps have different names for this concept, such as "teams" or "workspaces".
This guide shows you how to share a set of CoValues between users. Different apps have different names for this concept, such as "teams" or "workspaces".
We'll use the term Organization.
@@ -104,12 +103,16 @@ This schema now allows users to create `Organization`s and add `Project`s to the
[See the schema for the example app here.](https://github.com/garden-co/jazz/blob/main/examples/organization/src/schema.ts)
## Adding other users to an Organization
## Adding members to an Organization
To give users access to an `Organization`, you can either send them an invite link, or
add their `Account` manually.
Here are different ways to add members to an `Organization`.
### Adding users through invite links
- Send users an invite link.
- [The user requests to join.](/docs/groups/sharing#requesting-invites)
This guide and the example app show you the first method.
### Adding members through invite links
Here's how you can generate an [invite link](/docs/groups/sharing#invites).
@@ -180,6 +183,7 @@ export function AcceptInvitePage() {
```
</CodeGroup>
### Adding users through their Account ID
## Further reading
...more on this coming soon
- [Allowing users to request an invite to join a Group](/docs/groups/sharing#requesting-invites)
- [Groups as permission scopes](/docs/groups/intro#adding-group-members-by-id)

View File

@@ -1,27 +1,5 @@
import { Framework } from "../framework";
export type DoneStatus =
| number // represents percentage done
| Partial<Record<Framework, number>>;
export type DocNavigationItem = {
name: string;
href: string;
done: DoneStatus;
framework?: Framework;
next?: DocNavigationItem | null;
previous?: DocNavigationItem | null;
excludeFromNavigation?: boolean;
};
export type DocNavigationSection = {
name: string;
items: DocNavigationItem[];
collapse?: boolean;
prefix?: string;
};
export const docNavigationItems: DocNavigationSection[] = [
/** @satisfies {DocNavigationSection[]} */
export const docNavigationItems = [
{
// welcome to jazz
name: "Getting started",
@@ -81,6 +59,7 @@ export const docNavigationItems: DocNavigationSection[] = [
react: 100,
"react-native": 100,
"react-native-expo": 100,
svelte: 100,
},
},
],
@@ -159,7 +138,7 @@ export const docNavigationItems: DocNavigationSection[] = [
name: "0.9.2 - Local persistence on React Native Expo",
href: "/docs/upgrade/react-native-local-persistence",
done: 100,
framework: Framework.ReactNativeExpo,
framework: "react-native-expo",
excludeFromNavigation: true,
},
// {
@@ -308,7 +287,7 @@ export const docNavigationItems: DocNavigationSection[] = [
name: "Design patterns",
items: [
{
name: "Form",
name: "Autosaving forms",
href: "/docs/design-patterns/form",
done: 100,
},

View File

@@ -0,0 +1,22 @@
import { Framework } from "../framework";
export type DoneStatus =
| number // represents percentage done
| Partial<Record<Framework, number>>;
export type DocNavigationItem = {
name: string;
href: string;
done: DoneStatus;
framework?: Framework;
next?: DocNavigationItem | null;
previous?: DocNavigationItem | null;
excludeFromNavigation?: boolean;
};
export type DocNavigationSection = {
name: string;
items: DocNavigationItem[];
collapse?: boolean;
prefix?: string;
};

View File

@@ -0,0 +1,162 @@
export const metadata = {
description:
"Configure your JazzProvider - the core component that connects your app to Jazz, handling sync, storage, account schema, and auth.",
};
import { CodeGroup } from "@/components/forMdx";
# Providers
`<JazzProvider />` is the core component that connects your Svelte application to Jazz. It handles:
- **Data Synchronization**: Manages connections to peers and the Jazz cloud
- **Local Storage**: Persists data locally between app sessions
- **Schema Types**: Provides APIs for the [AccountSchema](/docs/schemas/accounts-and-migrations)
- **Authentication**: Connects your authentication system to Jazz
Our [File Share example app](https://github.com/garden-co/jazz/blob/main/examples/file-share-svelte/src/routes/%2Blayout.svelte) provides an implementation of JazzProvider with authentication and real-time data sync.
## Setting up the Provider
The `<JazzProvider />` accepts several configuration options:
<CodeGroup>
```svelte
<!-- src/routes/+layout.svelte -->
<script lang="ts" module>
// Register the Account schema so `useAccount` returns our custom `MyAppAccount`
declare module 'jazz-svelte' {
interface Register {
Account: MyAppAccount;
}
}
</script>
<script lang="ts">
import { JazzProvider } from "jazz-svelte";
import { MyAppAccount } from "$lib/schema";
let { children } = $props();
</script>
<JazzProvider
sync={{
peer: "wss://cloud.jazz.tools/?key=your-api-key",
when: "always" // When to sync: "always", "never", or "signedUp"
}}
AccountSchema={MyAppAccount}
>
{@render children()}
</JazzProvider>
```
</CodeGroup>
## Provider Options
### Sync Options
The `sync` property configures how your application connects to the Jazz network:
<CodeGroup>
```ts twoslash
// @filename: src/routes/layout.svelte
// ---cut---
import { type SyncConfig } from "jazz-tools";
const syncConfig: SyncConfig = {
// Connection to Jazz Cloud or your own sync server
peer: "wss://cloud.jazz.tools/?key=your-api-key",
// When to sync: "always" (default), "never", or "signedUp"
when: "always",
}
```
</CodeGroup>
See [Authentication States](/docs/authentication/authentication-states#controlling-sync-for-different-authentication-states) for more details on how the `when` property affects synchronization based on authentication state.
### Account Schema
The `AccountSchema` property defines your application's account structure:
<CodeGroup>
```svelte
<!-- src/routes/+layout.svelte -->>
<script lang="ts" module>
// Register the Account schema so `useAccount` returns our custom `MyAppAccount`
declare module 'jazz-svelte' {
interface Register {
Account: MyAppAccount;
}
}
</script>
<script lang="ts">
import { JazzProvider } from "jazz-svelte";
import { MyAppAccount } from "$lib/schema";
let { children } = $props();
</script>
<JazzProvider
sync={syncConfig}
AccountSchema={MyAppAccount}
>
{@render children()}
</JazzProvider>
```
</CodeGroup>
### Additional Options
The provider accepts these additional options:
<CodeGroup>
```svelte
<!-- src/routes/+layout.svelte -->
<script lang="ts">
import { JazzProvider } from "jazz-svelte";
import { syncConfig } from "$lib/syncConfig";
let { children } = $props();
// Enable guest mode for account-less access
const guestMode = false;
// Default name for new user profiles
const defaultProfileName = "New User";
// Handle user logout
const onLogOut = () => {
console.log("User logged out");
};
// Handle anonymous account data when user logs in to existing account
const onAnonymousAccountDiscarded = (account) => {
console.log("Anonymous account discarded", account.id);
// Migrate data here
return Promise.resolve();
};
</script>
<JazzProvider
sync={syncConfig}
{guestMode}
{defaultProfileName}
{onLogOut}
{onAnonymousAccountDiscarded}
>
{@render children}
</JazzProvider>
```
</CodeGroup>
See [Authentication States](/docs/authentication/authentication-states) for more information on authentication states, guest mode, and handling anonymous accounts.
## Authentication
`<JazzProvider />` works with various authentication methods to enable users to access their data across multiple devices. For a complete guide to authentication, see our [Authentication Overview](/docs/authentication/overview).
## Need Help?
If you have questions about configuring the Jazz Provider for your specific use case, [join our Discord community](https://discord.gg/utDMjHYg42) for help.

View File

@@ -1,19 +1,207 @@
import { ContentByFramework } from '@/components/forMdx'
import { ContentByFramework, CodeGroup } from '@/components/forMdx'
# Jazz 0.14.0 Introducing Zod-based schemas
**Note:** This is a huge release with many breaking changes.
We're excited to move from our own schema syntax to using Zod v4.
This is the first step in a series of releases to make Jazz more familiar and to make CoValues look more like regular data structures.
**Note: This is a huge release that we're still cleaning up and documenting.**
<small className="leading-tight">
We're still in the process of:
- updating all our docs
- double-checking all our framework bindings
- particularly React Native might still have issues
- completing all the details of this upgrade guide
</small>
Thanks for your patience!
**Note: React Native is currently broken based on an [underlying Zod v4 issue](https://github.com/colinhacks/zod/issues/4148).**
If you see something broken, please let us know on [Discord](https://discord.gg/utDMjHYg42) and check back in a couple hours.
Thanks for your patience!
## Overview:
TODO (check back in a couple minutes)
So far, Jazz has relied on our own idiosyncratic schema definition syntax where you had to extend classes and be careful to use `co.ref` for references.
<CodeGroup>
```ts
// BEFORE
import { co, CoMap, CoList, CoPlainText, ImageDefinition } from "jazz-tools";
export class Message extends CoMap {
text = co.ref(CoPlainText);
image = co.optional.ref(ImageDefinition);
important = co.boolean;
}
export class Chat extends CoList.Of(co.ref(Message)) {}
```
</CodeGroup>
While this had certain ergonomic benefits it relied on unclean hacks to work.
In addition, many of our adopters expressed a preference for avoiding class syntax, and LLMs consistently expected to be able to use Zod.
For this reason, we completely overhauled how you define and use CoValue schemas:
<CodeGroup>
```ts twoslash
// AFTER
import { co, z } from "jazz-tools";
export const Message = co.map({
text: co.plainText(),
image: z.optional(co.image()),
important: z.boolean(),
});
export const Chat = co.list(Message);
```
</CodeGroup>
## Major breaking changes
### Schema definitions
You now define CoValue schemas using two new exports from `jazz-tools`:
- a new `co` definer that mirrors Zod's object/record/array syntax to define CoValue types
- `co.map()`, `co.record()`, `co.list()`, `co.feed()`
- `co.account()`, `co.profile()`
- `co.plainText()`, `co.richText()`,
- `co.fileStream()`, `co.image()`
- see the updated [Defining CoValue Schemas](/docs/schemas/covalues)
- `z` re-exported from Zod v4
- primitives like `z.string()`, `z.number()`, `z.literal()`
- **note**: additional constraints like `z.min()` and `z.max()` are not yet enforced, we'll add validation in future releases
- complex types like `z.object()` and `z.array()` to define JSON-like fields without internal collaboration
- combinators like `z.optional()` and `z.discriminatedUnion()`
- these also work on CoValue types!
- see the updated [Docs on Primitive Fields](/docs/schemas/covalues#primitive-fields),
[Docs on Optional References](/docs/schemas/covalues#optional-references)
and [Docs on Unions of CoMaps](/docs/schemas/covalues#unions-of-comaps-declaration)
Similar to Zod v4's new object syntax, recursive and mutually recursive types are now [much easier to express](/docs/react/schemas/covalues#recursive-references).
### How to pass loaded CoValues
Calls to `useCoState()` work just the same, but they return a slightly different type than before.
And while you can still read from the type just as before...
<CodeGroup>
```tsx twoslash
import React from "react";
// ---cut---
import { z, co } from "jazz-tools";
import { useCoState } from "jazz-react";
const Pet = co.map({
name: z.string(),
age: z.number(),
});
const Person = co.map({
name: z.string(),
age: z.number(),
pets: co.list(Pet),
});
function MyComponent({ id }: { id: string }) {
const person = useCoState(Person, id);
return person && <div>{person.name}</div>;
}
```
</CodeGroup>
...you now need to specify the type differently **when passing CoValues as a parameter** or
**whenever you need to refer to the type of a loaded CoValue instance:**
<CodeGroup>
```tsx twoslash
import React from "react";
// ---cut---
import { z, co, Loaded } from "jazz-tools"; // [!code ++]
import { useCoState } from "jazz-react";
const Pet = co.map({
name: z.string(),
age: z.number(),
});
const Person = co.map({
name: z.string(),
age: z.number(),
pets: co.list(Pet),
});
function MyComponent({ id }: { id: string }) {
const person = useCoState(Person, id);
return person && <PersonName person={person} />;
}
function PersonName({ person }: { person: Loaded<typeof Person> }) { // [!code ++]
return <div>{person.name}</div>;
}
```
</CodeGroup>
`Loaded` can also take a second argument to specify the loading depth of the expected CoValue, mirroring the `resolve` options for `useCoState`, `load`, `subscribe`, etc.
<CodeGroup>
```tsx twoslash
import React from "react";
// ---cut---
import { z, co, Loaded } from "jazz-tools";
import { useCoState } from "jazz-react";
const Pet = co.map({
name: z.string(),
age: z.number(),
});
const Person = co.map({
name: z.string(),
age: z.number(),
pets: co.list(Pet),
});
function MyComponent({ id }: { id: string }) {
const personWithPets = useCoState(Person, id, {
resolve: { pets: { $each: true } } // [!code ++]
});
return personWithPets && <PersonAndFirstPetName person={personWithPets} />;
}
function PersonAndFirstPetName({ person }: {
person: Loaded<typeof Person, { pets: { $each: true } }> // [!code ++]
}) {
return <div>{person.name} & {person.pets[0].name}</div>;
}
```
</CodeGroup>
### Defining migrations
TODO
### Defining Schema helper methods
TODO
### Removing AccountSchema registration
TODO
## Minor breaking changes
### `_refs` and `_edits` are now potentially null
TODO
### `members` and `by` now return basic `Account`s

View File

@@ -1,4 +1,4 @@
import { docNavigationItems } from "../../content/docs/docNavigationItems.ts";
import { docNavigationItems } from "../../content/docs/docNavigationItems.js";
// Transform docNavigationItems into the format we need
function transformNavItems() {

View File

@@ -1,5 +1,13 @@
# cojson-storage-indexeddb
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- cojson@0.14.1
- cojson-storage@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "cojson-storage-indexeddb",
"version": "0.14.0",
"version": "0.14.1",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,13 @@
# cojson-storage-sqlite
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- cojson@0.14.1
- cojson-storage@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,13 +1,13 @@
{
"name": "cojson-storage-sqlite",
"type": "module",
"version": "0.14.0",
"version": "0.14.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"better-sqlite3": "^11.7.0",
"cojson": "workspace:0.14.0",
"cojson": "workspace:0.14.1",
"cojson-storage": "workspace:*"
},
"devDependencies": {

View File

@@ -1,5 +1,12 @@
# cojson-storage
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- cojson@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "cojson-storage",
"version": "0.14.0",
"version": "0.14.1",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,12 @@
# cojson-transport-nodejs-ws
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- cojson@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "cojson-transport-ws",
"type": "module",
"version": "0.14.0",
"version": "0.14.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",

View File

@@ -1,5 +1,11 @@
# cojson
## 0.14.1
### Patch Changes
- c8b33ad: Force sync of the group after acceptInvite
## 0.14.0
### Minor Changes

View File

@@ -25,7 +25,7 @@
},
"type": "module",
"license": "MIT",
"version": "0.14.0",
"version": "0.14.1",
"devDependencies": {
"@opentelemetry/sdk-metrics": "^2.0.0",
"typescript": "catalog:"

View File

@@ -548,6 +548,7 @@ export class LocalNode {
group.processNewTransactions();
group.core.notifyUpdate("immediate");
this.syncManager.requestCoValueSync(group.core);
}
/** @internal */

View File

@@ -323,6 +323,10 @@ describe("Group invites", () => {
expect(groupOnMemberNode.roleOf(member.accountID)).toEqual("reader");
await waitFor(() => {
expect(group.roleOf(member.accountID)).toEqual("reader");
});
// Verify read access is restored
const personOnMemberNode = await loadCoValueOrFail(member.node, person.id);
expect(personOnMemberNode.get("name")).toEqual("John Doe");

View File

@@ -56,6 +56,10 @@ describe("invitations sync", () => {
"invite-consumer -> server | KNOWN Group sessions: header/5",
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
"invite-consumer -> server | KNOWN Map sessions: header/1",
"invite-consumer -> server | CONTENT Group header: false new: After: 0 New: 2",
"server -> invite-consumer | KNOWN Group sessions: header/7",
"server -> invite-provider | CONTENT Group header: false new: After: 0 New: 2",
"invite-provider -> server | KNOWN Group sessions: header/7",
]
`);
});
@@ -104,6 +108,10 @@ describe("invitations sync", () => {
"invite-consumer -> server | KNOWN Group sessions: header/7",
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
"invite-consumer -> server | KNOWN Map sessions: header/1",
"invite-consumer -> server | CONTENT Group header: false new: After: 0 New: 2",
"server -> invite-consumer | KNOWN Group sessions: header/9",
"server -> invite-provider | CONTENT Group header: false new: After: 0 New: 2",
"invite-provider -> server | KNOWN Group sessions: header/9",
]
`);
});
@@ -148,15 +156,15 @@ describe("invitations sync", () => {
"invite-consumer -> server | LOAD ParentGroup sessions: empty",
"server -> invite-consumer | CONTENT ParentGroup header: true new: After: 0 New: 6",
"invite-consumer -> server | KNOWN ParentGroup sessions: header/6",
"invite-consumer -> server | LOAD Map sessions: empty",
"server -> invite-consumer | CONTENT Group header: true new: After: 0 New: 5",
"invite-consumer -> server | KNOWN Group sessions: header/5",
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
"invite-consumer -> server | CONTENT ParentGroup header: false new: After: 0 New: 2",
"server -> invite-consumer | KNOWN ParentGroup sessions: header/8",
"server -> invite-provider | CONTENT ParentGroup header: false new: After: 0 New: 2",
"invite-consumer -> server | KNOWN Map sessions: header/1",
"invite-consumer -> server | LOAD Map sessions: empty",
"invite-provider -> server | KNOWN ParentGroup sessions: header/8",
"server -> invite-consumer | CONTENT Group header: true new: After: 0 New: 5",
"invite-consumer -> server | KNOWN Group sessions: header/5",
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
"invite-consumer -> server | KNOWN Map sessions: header/1",
]
`);
});

View File

@@ -1,5 +1,16 @@
# jazz-auth-betterauth
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- jazz-browser@0.14.1
- jazz-betterauth-client-plugin@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-auth-betterauth",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,15 @@
# jazz-auth-clerk
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- jazz-browser@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,14 +1,14 @@
{
"name": "jazz-auth-clerk",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
"cojson": "workspace:0.14.0",
"jazz-browser": "workspace:0.14.0",
"jazz-tools": "workspace:0.14.0"
"cojson": "workspace:0.14.1",
"jazz-browser": "workspace:0.14.1",
"jazz-tools": "workspace:0.14.1"
},
"scripts": {
"format-and-lint": "biome check .",

View File

@@ -1,5 +1,11 @@
# jazz-betterauth-client-plugin
## 0.14.1
### Patch Changes
- jazz-betterauth-server-plugin@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-betterauth-client-plugin",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,15 @@
# jazz-betterauth-server-plugin
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- jazz-browser@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-betterauth-server-plugin",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "dist/index.js",
"types": "src/index.ts",

View File

@@ -1,5 +1,13 @@
# jazz-browser-media-images
## 0.14.1
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-browser@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-browser-media-images",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -8,8 +8,8 @@
"dependencies": {
"@types/image-blob-reduce": "^4.1.1",
"image-blob-reduce": "^4.1.0",
"jazz-browser": "workspace:0.14.0",
"jazz-tools": "workspace:0.14.0",
"jazz-browser": "workspace:0.14.1",
"jazz-tools": "workspace:0.14.1",
"pica": "^9.0.1"
},
"scripts": {

View File

@@ -1,5 +1,16 @@
# jazz-browser
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- cojson-storage-indexeddb@0.14.1
- cojson-transport-ws@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-browser",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,5 +1,18 @@
# jazz-browser
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- cojson-transport-ws@0.14.1
- jazz-auth-clerk@0.14.1
- jazz-react-core@0.14.1
- jazz-react-native-core@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-expo",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",

View File

@@ -1,5 +1,13 @@
# jazz-inspector-element
## 0.14.1
### Patch Changes
- Updated dependencies [cdfc105]
- jazz-tools@0.14.1
- jazz-inspector@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-inspector-element",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "./dist/main.js",
"types": "./dist/main.d.ts",

View File

@@ -1,5 +1,15 @@
# jazz-inspector
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- jazz-react-core@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-inspector",
"version": "0.14.0",
"version": "0.14.1",
"type": "module",
"main": "./dist/app.js",
"types": "./dist/app.d.ts",

View File

@@ -1,5 +1,15 @@
# jazz-autosub
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- cojson-transport-ws@0.14.1
## 0.14.0
### Patch Changes

View File

@@ -5,7 +5,7 @@
"types": "dist/index.d.ts",
"type": "module",
"license": "MIT",
"version": "0.14.0",
"version": "0.14.1",
"dependencies": {
"cojson": "workspace:*",
"cojson-transport-ws": "workspace:*",

View File

@@ -1,5 +1,18 @@
# jazz-react-auth-betterauth
## 0.14.1
### Patch Changes
- Updated dependencies [c8b33ad]
- Updated dependencies [cdfc105]
- cojson@0.14.1
- jazz-tools@0.14.1
- jazz-auth-betterauth@0.14.1
- jazz-browser@0.14.1
- jazz-react@0.14.1
- jazz-betterauth-client-plugin@0.14.1
## 0.14.0
### Patch Changes

Some files were not shown because too many files have changed in this diff Show More