How to share data between users through Organizations

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.

See the full example here.

Defining the schema for an Organization

Create a CoMap shared by the users of the same organization to act as a root (or "main database") for the shared data within an organization.

For this example, users within an Organization will be sharing Projects.

// schema.ts
export const 
const Project: co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>
Project
= import coco.
map<{
    name: z.z.ZodString;
}>(shape: {
    name: z.z.ZodString;
}): co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString (+1 overload)
export string
string
(),
}); export const
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
= import coco.
map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}>(shape: {
    name: z.z.ZodString;
    projects: co.List<...>;
}): co.Map<...>
export map
map
({
name: z.z.ZodStringname: import zz.
function string(params?: string | z.z.core.$ZodStringParams): z.z.ZodString (+1 overload)
export string
string
(),
// shared data between users of each organization
projects: co.List<co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>, true>
projects
: import coco.
list<co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>>(element: co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>): co.List<...>
export list
list
(
const Project: co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>
Project
),
}); export const
const ListOfOrganizations: co.List<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>, true>
ListOfOrganizations
= import coco.
list<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>>(element: co.Map<...>): co.List<...>
export list
list
(
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
);

Learn more about defining schemas.

Adding a list of Organizations to the user's Account

Let's add the list of Organizations to the user's Account root so they can access them.

// schema.ts
export const 
const JazzAccountRoot: co.Map<{
    organizations: co.List<co.Map<{
        name: z.z.ZodString;
        projects: co.List<co.Map<{
            name: z.z.ZodString;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
JazzAccountRoot
= import coco.
map<{
    organizations: co.List<co.Map<{
        name: z.z.ZodString;
        projects: co.List<co.Map<{
            name: z.z.ZodString;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>, true>;
}>(shape: {
    ...;
}): co.Map<...>
export map
map
({
organizations: co.List<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>, true>
organizations
: import coco.
list<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>>(element: co.Map<...>): co.List<...>
export list
list
(
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
),
}); export const
const JazzAccount: co.Account<{
    root: co.Map<{
        organizations: co.List<co.Map<{
            name: z.z.ZodString;
            projects: co.List<co.Map<{
                name: z.z.ZodString;
            }, unknown, Account | Group, true>, true>;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>;
    profile: co.Profile<...>;
}, true>
JazzAccount
= import coco
.
account<{
    root: co.Map<{
        organizations: co.List<co.Map<{
            name: z.z.ZodString;
            projects: co.List<co.Map<{
                name: z.z.ZodString;
            }, unknown, Account | Group, true>, true>;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>;
    profile: co.Profile<...>;
}>(shape?: {
    ...;
} | undefined): co.Account<...>
export account
Defines a collaborative account schema for Jazz applications. Creates an account schema that represents a user account with profile and root data. Accounts are the primary way to identify and manage users in Jazz applications.
@templateShape - The shape of the account schema extending BaseAccountShape@paramshape - The account schema shape. Defaults to a basic profile with name, inbox, and inboxInvite fields, plus an empty root object.@example```typescript // Basic account with default profile const BasicAccount = co.account(); // Custom account with specific profile and root structure const JazzAccount = co.account({ profile: co.profile({ name: z.string(), avatar: z.optional(z.string()), }), root: co.map({ organizations: co.list(Organization), draftOrganization: DraftOrganization, }), }).withMigration(async (account) => { // Migration logic for existing accounts if (!account.$jazz.has("profile")) { const group = Group.create(); account.$jazz.set("profile", co.profile().create( { name: getRandomUsername() }, group )); group.addMember("everyone", "reader"); } }); ```
account
({
root: co.Map<{
    organizations: co.List<co.Map<{
        name: z.z.ZodString;
        projects: co.List<co.Map<{
            name: z.z.ZodString;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
root
:
const JazzAccountRoot: co.Map<{
    organizations: co.List<co.Map<{
        name: z.z.ZodString;
        projects: co.List<co.Map<{
            name: z.z.ZodString;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
JazzAccountRoot
,
profile: co.Profile<BaseProfileShape>profile: import coco.
profile<BaseProfileShape>(shape?: (BaseProfileShape & Partial<DefaultProfileShape>) | undefined): co.Profile<BaseProfileShape>
export profile
profile
(),
}) .
AccountSchema<{ root: CoMapSchema<{ organizations: CoListSchema<CoMapSchema<{ name: ZodString; projects: CoListSchema<CoMapSchema<{ name: ZodString; }, unknown, Account | Group, true>, true>; }, unknown, Account | Group, true>, true>; }, unknown, Account | Group, true>; profile: CoProfileSchema<...>; }, true>.withMigration(migration: (account: {
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account, creationProps?: {
    name: string;
}) => void): co.Account<...>
withMigration
((
account: {
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account
account
) => {
if (!
account: {
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account
account
.
Account.$jazz: AccountJazzApi<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account>
Jazz methods for Accounts are inside this property. This allows Accounts to be used as plain objects while still having access to Jazz methods.
$jazz
.AccountJazzApi<{ readonly root: MaybeLoaded<{ readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; readonly projects: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; } & CoMap>>>; } & CoMap>>>; } & CoMap>; readonly profile: MaybeLoaded<...>; } & Account>.has(key: "root" | "profile"): booleanhas("root")) {
// Using a Group as an owner allows you to give access to other users const const organizationGroup: GrouporganizationGroup = class Group
@categoryIdentity & Permissions
Group
.
Group.create<Group>(this: CoValueClass<Group>, options?: {
    owner: Account;
} | Account): Group
create
();
const
const organizations: CoListInstance<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>>
organizations
= import coco.
list<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>>(element: co.Map<...>): co.List<...>
export list
list
(
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
).
CoListSchema<CoMapSchema<{ name: ZodString; projects: CoListSchema<CoMapSchema<{ name: ZodString; }, unknown, Account | Group, true>, true>; }, unknown, Account | Group, true>, true>.create(items: readonly (({
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap) | {
    ...;
})[], options?: {
    owner: Group;
    unique?: CoValueUniqueness["uniqueness"];
} | Group): CoListInstance<...> (+1 overload)
create
([
// Create the first Organization so users can start right away
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
.
CoMapSchema<{ name: ZodString; projects: CoListSchema<CoMapSchema<{ name: ZodString; }, unknown, Account | Group, true>, true>; }, unknown, Account | Group, true>.create(init: {
    name: string;
    projects: CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>> | readonly (({
        readonly name: string;
    } & CoMap) | {
        name: string;
    })[];
}, options?: {
    owner?: Group;
    unique?: CoValueUniqueness["uniqueness"];
} | Group): {
    ...;
} & CoMap (+1 overload)
create
(
{ name: stringname: "My organization",
projects: CoList<MaybeLoaded<{
    readonly name: string;
} & CoMap>> | readonly (({
    readonly name: string;
} & CoMap) | {
    name: string;
})[]
projects
: import coco.
list<co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>>(element: co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>): co.List<...>
export list
list
(
const Project: co.Map<{
    name: z.z.ZodString;
}, unknown, Account | Group, true>
Project
).
CoListSchema<CoMapSchema<{ name: ZodString; }, unknown, Account | Group, true>, true>.create(items: readonly (({
    readonly name: string;
} & CoMap) | {
    name: string;
})[], options?: {
    owner: Group;
    unique?: CoValueUniqueness["uniqueness"];
} | Group): CoListInstance<...> (+1 overload)
create
([], const organizationGroup: GrouporganizationGroup),
}, const organizationGroup: GrouporganizationGroup, ), ]);
account: {
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account
account
.
Account.$jazz: AccountJazzApi<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account>
Jazz methods for Accounts are inside this property. This allows Accounts to be used as plain objects while still having access to Jazz methods.
$jazz
.
AccountJazzApi<{ readonly root: MaybeLoaded<{ readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; readonly projects: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; } & CoMap>>>; } & CoMap>>>; } & CoMap>; readonly profile: MaybeLoaded<...>; } & Account>.set<"root">(key: "root", value: ({
    readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap>>>;
} & CoMap) | CoMapInit<...>): void
Set the value of a key in the account.
@paramkey The key to set.@paramvalue The value to set.@categoryContent
set
("root", {
organizations: CoListInstance<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>>
organizations
});
} });

This schema now allows users to create Organizations and add Projects to them.

See the schema for the example app here.

Adding members to an Organization

Here are different ways to add members to an Organization.

This guide and the example app show you the first method.

Here's how you can generate an invite link.

When the user accepts the invite, add the Organization to the user's organizations list.

export function function AcceptInvitePage(): React.JSX.ElementAcceptInvitePage() {
  const 
const me: MaybeLoaded<CoMapLikeLoaded<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account, {
    ...;
}, 10, []>>
me
=
useAccount<co.Account<{
    root: co.Map<{
        organizations: co.List<co.Map<{
            name: z.z.ZodString;
            projects: co.List<co.Map<{
                name: z.z.ZodString;
            }, unknown, Account | Group, true>, true>;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>;
    profile: co.Profile<...>;
}, true>, {
    ...;
}, MaybeLoaded<...>>(AccountSchema?: co.Account<...> | undefined, options?: {
    ...;
} | undefined): MaybeLoaded<...>
React hook for accessing the current user's account. This hook provides access to the current user's account profile and root data. It automatically handles the subscription lifecycle and supports deep loading of nested CoValues through resolve queries. The {@param options.select} function allows returning only specific parts of the account data, which helps reduce unnecessary re-renders by narrowing down the returned data. Additionally, you can provide a custom {@param options.equalityFn} to further optimize performance by controlling when the component should re-render based on the selected data.
@returnsThe account data, or an {@link NotLoaded } value. Use `$isLoaded` to check whether the CoValue is loaded, or use {@link MaybeLoaded.$jazz.loadingState } to get the detailed loading state. If a selector function is provided, returns the result of the selector function.@example```tsx // Select only specific fields to reduce re-renders const MyAppAccount = co.account({ profile: co.profile(), root: co.map({ name: z.string(), email: z.string(), lastLogin: z.date(), }), }); function UserProfile({ accountId }: { accountId: string }) { // Only re-render when the profile name changes, not other fields const profileName = useAccount( MyAppAccount, { resolve: { profile: true, root: true, }, select: (account) => account.$isLoaded ? account.profile.name : "Loading...", } ); return <h1>{profileName}</h1>; } ```@example```tsx // Deep loading with resolve queries function ProjectListWithDetails() { const me = useAccount(MyAppAccount, { resolve: { profile: true, root: { myProjects: { $each: { tasks: true, }, }, }, }, }); if (!me.$isLoaded) { switch (me.$jazz.loadingState) { case "unauthorized": return "Account not accessible"; case "unavailable": return "Account not found"; case "loading": return "Loading account..."; } } return ( <div> <h1>{me.profile.name}'s projects</h1> <ul> {me.root.myProjects.map((project) => ( <li key={project.id}> {project.name} ({project.tasks.length} tasks) </li> ))} </ul> </div> ); } ```
useAccount
(
const JazzAccount: co.Account<{
    root: co.Map<{
        organizations: co.List<co.Map<{
            name: z.z.ZodString;
            projects: co.List<co.Map<{
                name: z.z.ZodString;
            }, unknown, Account | Group, true>, true>;
        }, unknown, Account | Group, true>, true>;
    }, unknown, Account | Group, true>;
    profile: co.Profile<...>;
}, true>
JazzAccount
, {
resolve?: RefsToResolve<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account, 10, []> | undefined
Resolve query to specify which nested CoValues to load from the account
resolve
: {
root?: RefsToResolve<{
    readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap>>>;
} & CoMap, 10, [...]> | undefined
root
: {
organizations?: RefsToResolve<CoList<MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>>, 10, [...]> | undefined
organizations
: {
$each?: RefsToResolve<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap, 10, [...]> | undefined
$each
: { $onError?: "catch" | undefined$onError: 'catch' } } } },
}); const const onAccept: (organizationId: string) => voidonAccept = (organizationId: stringorganizationId: string) => { if (
const me: MaybeLoaded<CoMapLikeLoaded<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account, {
    ...;
}, 10, []>>
me
.$isLoaded: boolean
Whether the CoValue is loaded. Can be used to distinguish between loaded and {@link NotLoaded } CoValues. For more information about the CoValue's loading state, use {@link $jazz.loadingState } .
$isLoaded
) {
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
.
CoMapSchema<{ name: ZodString; projects: CoListSchema<CoMapSchema<{ name: ZodString; }, unknown, Account | Group, true>, true>; }, unknown, Account | Group, true>.load<true>(id: string, options?: {
    resolve?: RefsToResolve<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap, 10, []> | undefined;
    loadAs?: Account | AnonymousJazzAgent;
    skipRetry?: boolean;
    unstable_branch?: BranchDefinition;
} | undefined): Promise<...>
load
(organizationId: stringorganizationId).
Promise<MaybeLoaded<{ readonly name: string; readonly projects: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; } & CoMap>>>; } & CoMap>>.then<void, never>(onfulfilled?: ((value: MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>) => void | PromiseLike<...>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<...>) | ... 1 more ... | undefined): Promise<...>
Attaches callbacks for the resolution and/or rejection of the Promise.
@paramonfulfilled The callback to execute when the Promise is resolved.@paramonrejected The callback to execute when the Promise is rejected.@returnsA Promise for the completion of which ever callback is executed.
then
((
organization: MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>
organization
) => {
if (
organization: MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>
organization
) {
// avoid duplicates const const ids: string[]ids =
const me: CoMapLikeLoaded<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account, {
    ...;
}, 10, []>
me
.
Account.root: {
    readonly organizations: readonly (NotLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap> | CoMapLikeLoaded<...>)[] & CoList<MaybeLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap>>;
} & {
    readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap>>>;
} & CoMap
root
.
organizations: readonly (NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | CoMapLikeLoaded<...>)[] & CoList<MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>>
organizations
.
map<string>(callbackfn: (value: NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | CoMapLikeLoaded<...>, index: number, array: readonly (NotLoaded<...> | CoMapLikeLoaded<...>)[]) => string, thisArg?: any): string[] (+1 overload)
Calls a defined callback function on each element of an array, and returns an array that contains the results.
@paramcallbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.@paramthisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
map
(
(
organization: NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | CoMapLikeLoaded<...>
organization
) =>
organization: NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | CoMapLikeLoaded<...>
organization
?.
$jazz: {
    id: ID<T>;
    loadingState: "loading" | "unavailable" | "unauthorized";
} | CoMapJazzApi<...>
Jazz methods for CoMaps are inside this property. This allows CoMaps to be used as plain objects while still having access to Jazz methods, and also doesn't limit which key names can be used inside CoMaps.
$jazz
.id: stringid,
); if (const ids: string[]ids.Array<string>.includes(searchElement: string, fromIndex?: number): boolean
Determines whether an array includes a certain element, returning true or false as appropriate.
@paramsearchElement The element to search for.@paramfromIndex The position in this array at which to begin searching for searchElement.
includes
(organizationId: stringorganizationId)) return;
const me: CoMapLikeLoaded<{
    readonly root: MaybeLoaded<{
        readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
            readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
                readonly name: string;
            } & CoMap>>>;
        } & CoMap>>>;
    } & CoMap>;
    readonly profile: MaybeLoaded<...>;
} & Account, {
    ...;
}, 10, []>
me
.
Account.root: {
    readonly organizations: readonly (NotLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap> | CoMapLikeLoaded<...>)[] & CoList<MaybeLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap>>;
} & {
    readonly organizations: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
        readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
            readonly name: string;
        } & CoMap>>>;
    } & CoMap>>>;
} & CoMap
root
.
organizations: readonly (NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | CoMapLikeLoaded<...>)[] & CoList<MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>>
organizations
.
CoList<MaybeLoaded<{ readonly name: string; readonly projects: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; } & CoMap>>>; } & CoMap>>.$jazz: CoListJazzApi<readonly (NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | CoMapLikeLoaded<...>)[] & CoList<MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>>>
$jazz
.
CoListJazzApi<readonly (NotLoaded<{ readonly name: string; readonly projects: MaybeLoaded<CoList<MaybeLoaded<{ readonly name: string; } & CoMap>>>; } & CoMap> | CoMapLikeLoaded<...>)[] & CoList<...>>.push(...items: (NotLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap> | ({} & ... 1 more ... & CoMap) | CoMapInit<...>)[]): number
Appends new elements to the end of an array, and returns the new length of the array.
@paramitems New elements to add to the array.@categoryContent
push
(
organization: MaybeLoaded<{
    readonly name: string;
    readonly projects: MaybeLoaded<CoList<MaybeLoaded<{
        readonly name: string;
    } & CoMap>>>;
} & CoMap>
organization
);
} }); } };
useAcceptInvite<co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>>({ invitedObjectSchema, onAccept, forValueHint, }: {
    ...;
}): void
useAcceptInvite
({
invitedObjectSchema: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
invitedObjectSchema
:
const Organization: co.Map<{
    name: z.z.ZodString;
    projects: co.List<co.Map<{
        name: z.z.ZodString;
    }, unknown, Account | Group, true>, true>;
}, unknown, Account | Group, true>
Organization
,
onAccept: (valueID: string) => voidonAccept, }); return <React.JSX.IntrinsicElements.p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>p>Accepting invite...</React.JSX.IntrinsicElements.p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>p>; }

Further reading