Defining schemas: CoValues

CoValues ("Collaborative Values") are the core abstraction of Jazz. They're your bread-and-butter datastructures that you use to represent everything in your app.

As their name suggests, CoValues are inherently collaborative, meaning multiple users and devices can edit them at the same time.

Think of CoValues as "super-fast Git for lots of tiny data."

  • CoValues keep their full edit histories, from which they derive their "current state".
  • The fact that this happens in an eventually-consistent way makes them CRDTs.
  • Having the full history also means that you often don't need explicit timestamps and author info - you get this for free as part of a CoValue's edit metadata.

CoValues model JSON with CoMaps and CoLists, but also offer CoFeeds for simple per-user value feeds, and let you represent binary data with FileStreams.

Start your app with a schema

Fundamentally, CoValues are as dynamic and flexible as JSON, but in Jazz you use them by defining fixed schemas to describe the shape of data in your app.

This helps correctness and development speed, but is particularly important...

  • when you evolve your app and need migrations
  • when different clients and server workers collaborate on CoValues and need to make compatible changes

Thinking about the shape of your data is also a great first step to model your app.

Even before you know the details of how your app will work, you'll probably know which kinds of objects it will deal with, and how they relate to each other.

In Jazz, you define schemas using co for CoValues and z (from Zod) for their primitive fields.

// schema.ts
import { import coco, import zz } from "jazz-tools";

const const ListOfTasks: CoListSchema<z.z.ZodString>ListOfTasks = import coco.
list<z.z.ZodString>(element: z.z.ZodString): CoListSchema<z.z.ZodString>
export list
list
(import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
());
export const
const TodoProject: CoMapSchema<{
    title: z.z.ZodString;
    tasks: CoListSchema<z.z.ZodString>;
}>
TodoProject
= import coco.
map<{
    title: z.z.ZodString;
    tasks: CoListSchema<z.z.ZodString>;
}>(shape: {
    title: z.z.ZodString;
    tasks: CoListSchema<z.z.ZodString>;
}): CoMapSchema<{
    title: z.z.ZodString;
    tasks: CoListSchema<z.z.ZodString>;
}>
export map
map
({
title: z.z.ZodStringtitle: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
tasks: CoListSchema<z.z.ZodString>tasks: const ListOfTasks: CoListSchema<z.z.ZodString>ListOfTasks, });

This gives us schema info that is available for type inference and at runtime.

Check out the inferred type of project in the example below, as well as the input .create() expects.

// app.ts
import { class Group
@categoryIdentity & Permissions
Group
} from "jazz-tools";
import {
const TodoProject: CoMapSchema<{
    title: ZodString;
    tasks: CoListSchema<ZodString>;
}>
TodoProject
, const ListOfTasks: CoListSchema<ZodString>ListOfTasks } from "./schema";
const
const project: {
    title: string;
    tasks: CoList<string>;
} & CoMap
project
=
const TodoProject: CoMapSchema<{
    title: ZodString;
    tasks: CoListSchema<ZodString>;
}>
TodoProject
.
create: (init: {
    title: string;
    tasks: CoList<string>;
}, options?: Group | Account | {
    owner: Group | Account;
    unique?: CoValueUniqueness["uniqueness"];
} | undefined) => {
    ...;
} & CoMap
create
(
{ title: stringtitle: "New Project", tasks: CoList<string>tasks: const ListOfTasks: CoListSchema<ZodString>ListOfTasks.
create: (items: CoListInit<ZodString>, options?: {
    owner: Account | Group;
} | Account | Group) => CoList<string>
create
([], class Group
@categoryIdentity & Permissions
Group
.
Group.create<Group>(this: CoValueClass<Group>, options?: {
    owner: Account;
} | Account): Group
create
()),
}, class Group
@categoryIdentity & Permissions
Group
.
Group.create<Group>(this: CoValueClass<Group>, options?: {
    owner: Account;
} | Account): Group
create
()
);

Types of CoValues

CoMap (declaration)

CoMaps are the most commonly used type of CoValue. They are the equivalent of JSON objects (Collaborative editing follows a last-write-wins strategy per-key).

You can either declare struct-like CoMaps:

const 
const Task: CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>
Task
= import coco.
map<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>(shape: {
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}): CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>
export map
map
({
title: z.z.ZodStringtitle: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
completed: z.z.ZodBooleancompleted: import zz.
function boolean(params?: string | z.z.core.$ZodBooleanParams): z.z.ZodBoolean
export boolean
boolean
(),
});

Or record-like CoMaps (key-value pairs, where keys are always string):

const const ColorToHex: CoRecordSchema<z.z.ZodString, z.z.ZodString>ColorToHex = import coco.
record<z.z.ZodString, z.z.ZodString>(_keyType: z.z.ZodString, valueType: z.z.ZodString): CoRecordSchema<z.z.ZodString, z.z.ZodString>
export record
record
(import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(), import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
());
const
const ColorToFruit: CoRecordSchema<z.z.ZodString, CoMapSchema<{
    name: z.z.ZodString;
    color: z.z.ZodString;
}>>
ColorToFruit
= import coco.
record<z.z.ZodString, CoMapSchema<{
    name: z.z.ZodString;
    color: z.z.ZodString;
}>>(_keyType: z.z.ZodString, valueType: CoMapSchema<{
    name: z.z.ZodString;
    color: z.z.ZodString;
}>): CoRecordSchema<...>
export record
record
(import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
const Fruit: CoMapSchema<{
    name: z.z.ZodString;
    color: z.z.ZodString;
}>
Fruit
);

See the corresponding sections for creating, subscribing/loading, reading from and updating CoMaps.

CoList (declaration)

CoLists are ordered lists and are the equivalent of JSON arrays. (They support concurrent insertions and deletions, maintaining a consistent order.)

You define them by specifying the type of the items they contain:

const const ListOfColors: CoListSchema<z.z.ZodString>ListOfColors = import coco.
list<z.z.ZodString>(element: z.z.ZodString): CoListSchema<z.z.ZodString>
export list
list
(import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
());
const
const ListOfTasks: CoListSchema<CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>>
ListOfTasks
= import coco.
list<CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>>(element: CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>): CoListSchema<...>
export list
list
(
const Task: CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>
Task
);

See the corresponding sections for creating, subscribing/loading, reading from and updating CoLists.

CoFeed (declaration)

CoFeeds are a special CoValue type that represent a feed of values for a set of users/sessions (Each session of a user gets its own append-only feed).

They allow easy access of the latest or all items belonging to a user or their sessions. This makes them particularly useful for user presence, reactions, notifications, etc.

You define them by specifying the type of feed item:

const 
const FeedOfTasks: CoFeedSchema<CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>>
FeedOfTasks
= import coco.
feed<CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>>(element: CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>): CoFeedSchema<...>
export feed
feed
(
const Task: CoMapSchema<{
    title: z.z.ZodString;
    completed: z.z.ZodBoolean;
}>
Task
);

See the corresponding sections for creating, subscribing/loading, reading from and writing to CoFeeds.

FileStream (declaration)

FileStreams are a special type of CoValue that represent binary data. (They are created by a single user and offer no internal collaboration.)

They allow you to upload and reference files.

You typically don't need to declare or extend them yourself, you simply refer to the built-in co.fileStream() from another CoValue:

const 
const Document: CoMapSchema<{
    title: z.z.ZodString;
    file: FileStreamSchema;
}>
Document
= import coco.
map<{
    title: z.z.ZodString;
    file: FileStreamSchema;
}>(shape: {
    title: z.z.ZodString;
    file: FileStreamSchema;
}): CoMapSchema<{
    title: z.z.ZodString;
    file: FileStreamSchema;
}>
export map
map
({
title: z.z.ZodStringtitle: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
file: FileStreamSchemafile: import coco.
function fileStream(): FileStreamSchema
export fileStream
fileStream
(),
});

See the corresponding sections for creating, subscribing/loading, reading from and writing to FileStreams.

Note: For images, we have a special, higher-level co.image() helper, see ImageDefinition.

Unions of CoMaps (declaration)

You can declare unions of CoMaps that have discriminating fields, using z.discriminatedUnion().

import { co, z } from "jazz-tools";
// ---cut---

const ButtonWidget = co.map({
  type: z.literal("button"),
  label: z.string(),
});

const SliderWidget = co.map({
  type: z.literal("slider"),
  min: z.number(),
  max: z.number(),
});

const WidgetUnion = z.discriminatedUnion([ButtonWidget, SliderWidget]);

See the corresponding sections for creating, subscribing/loading and narrowing SchemaUnions.

CoValue field/item types

Now that we've seen the different types of CoValues, let's see more precisely how we declare the fields or items they contain.

Primitive fields

You can declare primitive field types using z (re-exported in jazz-tools from Zod):

import { import coco, import zz } from "jazz-tools";

const 
const Person: CoMapSchema<{
    title: z.z.ZodString;
}>
Person
= import coco.
map<{
    title: z.z.ZodString;
}>(shape: {
    title: z.z.ZodString;
}): CoMapSchema<{
    title: z.z.ZodString;
}>
export map
map
({
title: z.z.ZodStringtitle: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
}) export const const ListOfColors: CoListSchema<z.z.ZodString>ListOfColors = import coco.
list<z.z.ZodString>(element: z.z.ZodString): CoListSchema<z.z.ZodString>
export list
list
(import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
());

Here's a quick overview of the primitive types you can use:

import { z } from "jazz-tools";
// ---cut---
z.string();  // For simple strings
z.number();  // For numbers
z.boolean(); // For booleans
z.null();    // For null
z.date();    // For dates
z.literal(["waiting", "ready"]); // For enums

Finally, for more complex JSON data, that you don't want to be collaborative internally (but only ever update as a whole), you can use more complex Zod types.

For example, you can use z.object() to represent an internally immutable position:

const 
const Sprite: CoMapSchema<{
    position: z.z.ZodObject<{
        x: z.z.ZodNumber;
        y: z.z.ZodNumber;
    }, z.z.core.$strip>;
}>
Sprite
= import coco.
map<{
    position: z.z.ZodObject<{
        x: z.z.ZodNumber;
        y: z.z.ZodNumber;
    }, z.z.core.$strip>;
}>(shape: {
    position: z.z.ZodObject<{
        x: z.z.ZodNumber;
        y: z.z.ZodNumber;
    }, z.z.core.$strip>;
}): CoMapSchema<...>
export map
map
({
// assigned as a whole
position: z.z.ZodObject<{
    x: z.z.ZodNumber;
    y: z.z.ZodNumber;
}, z.z.core.$strip>
position
: import zz.
object<{
    x: z.z.ZodNumber;
    y: z.z.ZodNumber;
}>(shape?: {
    x: z.z.ZodNumber;
    y: z.z.ZodNumber;
} | undefined, params?: string | {
    error?: string | z.z.core.$ZodErrorMap<NonNullable<z.z.core.$ZodIssueInvalidType<unknown> | z.z.core.$ZodIssueUnrecognizedKeys>> | undefined;
    message?: string | undefined | undefined;
} | undefined): z.z.ZodObject<...>
export object
object
({ x: z.z.ZodNumberx: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(), y: z.z.ZodNumbery: import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
() }),
});

Or you could use a z.tuple():

const 
const Sprite: CoMapSchema<{
    position: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
}>
Sprite
= import coco.
map<{
    position: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
}>(shape: {
    position: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
}): CoMapSchema<{
    position: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>;
}>
export map
map
({
// assigned as a whole position: z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null>position: import zz.
tuple<[z.z.ZodNumber, z.z.ZodNumber]>(items: [z.z.ZodNumber, z.z.ZodNumber], params?: string | z.z.core.$ZodTupleParams): z.z.ZodTuple<[z.z.ZodNumber, z.z.ZodNumber], null> (+2 overloads)
export tuple
tuple
([import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
(), import zz.
function number(params?: string | z.z.core.$ZodNumberParams): z.z.ZodNumber
export number
number
()]),
});

References to other CoValues

To represent complex structured data with Jazz, you form trees or graphs of CoValues that reference each other.

Internally, this is represented by storing the IDs of the referenced CoValues in the corresponding fields, but Jazz abstracts this away, making it look like nested CoValues you can get or assign/insert.

The important caveat here is that a referenced CoValue might or might not be loaded yet, but we'll see what exactly that means in Subscribing and Deep Loading.

In Schemas, you declare references by just using the schema of the referenced CoValue:

// schema.ts
const 
const Person: CoMapSchema<{
    name: z.z.ZodString;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
}>(shape: {
    name: z.z.ZodString;
}): CoMapSchema<{
    name: z.z.ZodString;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
}); const
const ListOfPeople: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
}>>
ListOfPeople
= import coco.
list<CoMapSchema<{
    name: z.z.ZodString;
}>>(element: CoMapSchema<{
    name: z.z.ZodString;
}>): CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
}>>
export list
list
(
const Person: CoMapSchema<{
    name: z.z.ZodString;
}>
Person
);
const
const Company: CoMapSchema<{
    members: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}>
Company
= import coco.
map<{
    members: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}>(shape: {
    members: CoListSchema<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}): CoMapSchema<...>
export map
map
({
members: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
}>>
members
:
const ListOfPeople: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
}>>
ListOfPeople
,
});

Optional References

You can make references optional with z.optional():

const 
const Person: CoMapSchema<{
    pet: z.ZodOptional<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}>
Person
= import coco.
map<{
    pet: z.ZodOptional<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}>(shape: {
    pet: z.ZodOptional<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}): CoMapSchema<{
    pet: z.ZodOptional<CoMapSchema<{
        name: z.z.ZodString;
    }>>;
}>
export map
map
({
pet: z.ZodOptional<CoMapSchema<{
    name: z.z.ZodString;
}>>
pet
: import zz.
optional<CoMapSchema<{
    name: z.z.ZodString;
}>>(innerType: CoMapSchema<{
    name: z.z.ZodString;
}>): z.ZodOptional<CoMapSchema<{
    name: z.z.ZodString;
}>>
export optional
optional
(
const Pet: CoMapSchema<{
    name: z.z.ZodString;
}>
Pet
),
});

Recursive References

You can refer to the same schema from within itself using getters:

const 
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: CoMapSchema<...>;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
    readonly bestFriend: CoMapSchema<...>;
}>(shape: {
    name: z.z.ZodString;
    readonly bestFriend: CoMapSchema<...>;
}): CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: CoMapSchema<...>;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
get
bestFriend: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: CoMapSchema<...>;
}>
bestFriend
() {
return
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: CoMapSchema<...>;
}>
Person
;
} });

You can use the same technique for mutually recursive references, but you'll need to help TypeScript along:

import { import coco, import zz, 
type CoListSchema<T extends z.core.$ZodType> = z.z.core.$ZodArray<T> & {
    collaborative: true;
    create: (items: CoListInit<T>, options?: {
        owner: Account | Group;
    } | Account | Group) => CoList<InstanceOrPrimitiveOfSchema<T>>;
    load<const R extends RefsToResolve<CoListInstanceCoValuesNullable<T>> = true>(id: string, options?: {
        resolve?: RefsToResolveStrict<CoListInstanceCoValuesNullable<T>, R>;
        loadAs?: Account | AnonymousJazzAgent;
    }): Promise<Resolved<CoListInstanceCoValuesNullable<T>, R> | null>;
    subscribe<const R extends RefsToResolve<CoListInstanceCoValuesNullable<T>> = true>(id: string, options: SubscribeListenerOptions<CoListInstanceCoValuesNullable<T>, R>, listener: (value: Resolved<CoListInstanceCoValuesNullable<T>, R>, unsubscribe: () => void) => void): () => void;
    withHelpers<S extends z.z.core.$ZodType, T extends object>(this: S, helpers: (Self: S) => T): WithHelpers<S, T>;
}
CoListSchema
} from "jazz-tools";
const
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>(shape: {
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}): CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
get
friends: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>>
friends
():
type CoListSchema<T extends z.core.$ZodType> = z.z.core.$ZodArray<T> & {
    collaborative: true;
    create: (items: CoListInit<T>, options?: {
        owner: Account | Group;
    } | Account | Group) => CoList<InstanceOrPrimitiveOfSchema<T>>;
    load<const R extends RefsToResolve<CoListInstanceCoValuesNullable<T>> = true>(id: string, options?: {
        resolve?: RefsToResolveStrict<CoListInstanceCoValuesNullable<T>, R>;
        loadAs?: Account | AnonymousJazzAgent;
    }): Promise<Resolved<CoListInstanceCoValuesNullable<T>, R> | null>;
    subscribe<const R extends RefsToResolve<CoListInstanceCoValuesNullable<T>> = true>(id: string, options: SubscribeListenerOptions<CoListInstanceCoValuesNullable<T>, R>, listener: (value: Resolved<CoListInstanceCoValuesNullable<T>, R>, unsubscribe: () => void) => void): () => void;
    withHelpers<S extends z.z.core.$ZodType, T extends object>(this: S, helpers: (Self: S) => T): WithHelpers<S, T>;
}
CoListSchema
<typeof
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>
Person
> {
return
const ListOfPeople: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>>
ListOfPeople
;
} }); const
const ListOfPeople: CoListSchema<CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>>
ListOfPeople
= import coco.
list<CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>>(element: CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>): CoListSchema<...>
export list
list
(
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly friends: CoListSchema<typeof Person>;
}>
Person
);

Note: similarly, if you use modifiers like z.optional() you'll need to help TypeScript along:

const 
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>
Person
= import coco.
map<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>(shape: {
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}): CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
get
bestFriend: z.ZodOptional<CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>>
bestFriend
(): import zz.
interface ZodOptional<T extends core.$ZodType = core.$ZodType<unknown, unknown>>
export ZodOptional
ZodOptional
<typeof
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>
Person
> {
return import zz.
optional<CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>>(innerType: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>): z.ZodOptional<...>
export optional
optional
(
const Person: CoMapSchema<{
    name: z.z.ZodString;
    readonly bestFriend: z.ZodOptional<typeof Person>;
}>
Person
);
} });

Helper methods

You should define helper methods of CoValue schemas separately, in standalone functions.

const 
const Person: CoMapSchema<{
    firstName: z.z.ZodString;
    lastName: z.z.ZodString;
    dateOfBirth: z.z.ZodDate;
}>
Person
= import coco.
map<{
    firstName: z.z.ZodString;
    lastName: z.z.ZodString;
    dateOfBirth: z.z.ZodDate;
}>(shape: {
    firstName: z.z.ZodString;
    lastName: z.z.ZodString;
    dateOfBirth: z.z.ZodDate;
}): CoMapSchema<...>
export map
map
({
firstName: z.z.ZodStringfirstName: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
lastName: z.z.ZodStringlastName: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString
export string
string
(),
dateOfBirth: z.z.ZodDatedateOfBirth: import zz.
function date(params?: string | z.z.core.$ZodDateParams): z.z.ZodDate
export date
date
(),
}) type
type Person = {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
Person
= import coco.
type loaded<T extends CoValueClass | AnyCoSchema, R extends ResolveQuery<T> = true> = R extends boolean | undefined ? NonNullable<InstanceOfSchemaCoValuesNullable<T>> : [NonNullable<InstanceOfSchemaCoValuesNullable<T>>] extends [...] ? Exclude<...> extends CoValue ? R extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...> extends CoValue ? ItemDepth extends {
    ...;
} ? ((CoValue & ... 1 more ... & (ItemDepth extends boolean | undefined ? CoValue & Exclude<...> : [...] extends [...] ? Exclude<...
export loaded
loaded
<typeof
const Person: CoMapSchema<{
    firstName: z.z.ZodString;
    lastName: z.z.ZodString;
    dateOfBirth: z.z.ZodDate;
}>
Person
>;
export function function getPersonFullName(person: Person): stringgetPersonFullName(
person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
:
type Person = {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
Person
) {
return `${
person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
.firstName: stringfirstName} ${
person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
.lastName: stringlastName}`;
} export function function getPersonAgeAsOf(person: Person, date: Date): numbergetPersonAgeAsOf(
person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
:
type Person = {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
Person
, date: Datedate: Date) {
return function differenceInYears(date1: Date, date2: Date): numberdifferenceInYears(date: Datedate,
person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
.dateOfBirth: DatedateOfBirth);
} const
const person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
=
const Person: CoMapSchema<{
    firstName: z.z.ZodString;
    lastName: z.z.ZodString;
    dateOfBirth: z.z.ZodDate;
}>
Person
.
create: (init: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
}, options?: Account | Group | {
    owner: Account | Group;
    unique?: CoValueUniqueness["uniqueness"];
} | undefined) => {
    ...;
} & CoMap
create
({
firstName: stringfirstName: "John", lastName: stringlastName: "Doe", dateOfBirth: DatedateOfBirth: new
var Date: DateConstructor
new (value: number | string | Date) => Date (+4 overloads)
Date
("1990-01-01"),
}); const const fullName: stringfullName = function getPersonFullName(person: Person): stringgetPersonFullName(
const person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
);
const const age: numberage = function getPersonAgeAsOf(person: Person, date: Date): numbergetPersonAgeAsOf(
const person: {
    firstName: string;
    lastName: string;
    dateOfBirth: Date;
} & CoMap
person
, new
var Date: DateConstructor
new () => Date (+4 overloads)
Date
());