Sporades SDK API
    Preparing search index...

    Type Alias TableDefinition<Fields>

    A Capsule table definition.

    Table definitions are declared in capsule({ schema }); Sporades adds managed id, createdAt, and updatedAt fields to every stored row.

    const notes = table({
    body: String(),
    ownerId: String(),
    }).acl({
    read: ({ row, ctx }) => row?.ownerId === ctx.auth.userId,
    write: ({ next, previous, ctx }) =>
    (next?.ownerId ?? previous?.ownerId) === ctx.auth.userId,
    });
    type TableDefinition<
        Fields extends
            Record<string, AnyFieldDefinition> = Record<string, AnyFieldDefinition>,
    > = {
        aclRules?: TableAclRules;
        fields: Fields;
        kind: "table";
        acl(rules: TableAclRules<RowFromFields<Fields>>): TableDefinition<Fields>;
    }

    Type Parameters

    Index
    aclRules?: TableAclRules
    fields: Fields
    kind: "table"