Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

wip: Better contributor guide and shared utils/types

Richie McIlroy4e2a0172f8bd
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000000000..6c0cccd73
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,39 @@
+# Cap Contributor Guide: Work In Progress
+
+## Introduction
+
+### What is Cap?
+
+Cap is an open source and privacy focused alternative to Loom. It's a video messaging tool that allows you to record, edit and share videos in seconds.
+
+The development of Cap is still in its early stages, so please bare with us as we build out this guide.
+
+### What is this guide?
+
+This guide is for anyone who wants to contribute to Cap. It's a work in progress, and will be updated regularly.
+
+### How can I contribute?
+
+There are many ways to contribute to Cap. You can:
+
+- [Report a bug](https://github.com/cap-so/cap/issues/new)
+- [Suggest a feature (via Discord)](https://discord.com/invite/y8gdQ3WRN3)
+- Submit a PR
+
+### How do I get started with development on my local machine?
+
+This is a very top level guide right now, but the basics are:
+
+1. Clone the repository
+2. Install dependencies with `pnpm install`
+3. Clone .env.example and rename it to .env
+4. Add your own API keys to the .env file
+5. Run the app with `pnpm dev`
+6. Make sure the app can be built without any errors with `pnpm build`
+7. Submit a PR with your changes
+
+### How do I generate types?
+
+At the root of the folder, run `npx supabase gen types typescript --project-id 'your_id_here' --schema public > packages/utils/src/types/database.ts` with your own Supabase project ID.
+
+This will generate the latest types for the database, and save them to the utils package.
diff --git a/README.md b/README.md
index 094b75050..41afe5f9e 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
<p align="center">
Beautiful, shareable screen recordings. Open source and privacy-focused.
<br />
- <a href="https://cap.so"><strong>cap.so »</strong></a>
+ <a href="https://cap.so"><strong>Cap.so »</strong></a>
<br />
<br />
<b>Download for </b>
@@ -31,3 +31,7 @@ View what's currently in progress, and what's planned for the future: [Cap Roadm
# App Architecture
React, Vite, TypeScript, Tauri, TailwindCSS.
+
+# Contributing
+
+See [CONTRIBUTING.md](CONTRIBUTING.md) for more information. This is a work in progress, and will be updated regularly.
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 8d8bc2f98..b03e49430 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -21,7 +21,8 @@
"tailwindcss": "^3.3.4",
"tauri-plugin-context-menu": "^0.5.0",
"tauri-plugin-positioner-api": "^0.2.7",
- "vite-tsconfig-paths": "^4.2.1"
+ "vite-tsconfig-paths": "^4.2.1",
+ "@cap/utils": "workspace:*"
},
"devDependencies": {
"@supabase/supabase-js": "^2.39.0",
diff --git a/apps/desktop/src/components/windows/inner/Recorder.tsx b/apps/desktop/src/components/windows/inner/Recorder.tsx
index d4bb5b121..1b34dcf3b 100644
--- a/apps/desktop/src/components/windows/inner/Recorder.tsx
+++ b/apps/desktop/src/components/windows/inner/Recorder.tsx
@@ -12,6 +12,7 @@ import { Countdown } from "./Countdown";
import { appWindow, WebviewWindow } from "@tauri-apps/api/window";
import { AuthSession } from "@supabase/supabase-js";
import { supabase } from "@/utils/database/client";
+import type { Database } from "@cap/utils";
export const Recorder = ({ session }: { session: AuthSession | null }) => {
const {
@@ -77,18 +78,17 @@ export const Recorder = ({ session }: { session: AuthSession | null }) => {
useEffect(() => {
const startRecording = async () => {
if (isRecording) {
- const { data: videoData, error: videoError } = await supabase
+ const { data: videoData, error: videoError } = (await supabase
.from("videos")
- .insert([{ owner_id: session?.user?.id }]);
+ .insert([
+ { owner_id: session?.user?.id },
+ ])) as Database["public"]["Tables"]["videos"]["Insert"];
if (videoError) {
console.error("Error inserting video:", videoError);
return;
}
- console.log("videoData:");
- console.log(videoData);
-
if (videoData && videoData[0] && videoData[0].id) {
const videoId = videoData[0].id;
invoke("start_screen_recording", {
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx
index 7bab8d9a2..224e9ca29 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminDesktopNav.tsx
@@ -1,5 +1,5 @@
"use client";
-import { Logo } from "ui";
+import { Logo } from "@cap/ui";
import Link from "next/link";
import { AdminNavItems } from "./AdminNavItems";
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminMobileNav.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminMobileNav.tsx
index b5aab373d..f9575e968 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminMobileNav.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminMobileNav.tsx
@@ -1,7 +1,7 @@
"use client";
import { Fragment, useState } from "react";
import { X, Menu } from "lucide-react";
-import { Logo } from "ui";
+import { Logo } from "@cap/ui";
import Link from "next/link";
import { Dialog, Transition } from "@headlessui/react";
import { AdminNavItems } from "./AdminNavItems";
diff --git a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
index bd9510562..463cfc8ca 100644
--- a/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
+++ b/apps/web/app/dashboard/_components/AdminNavbar/AdminNavItems.tsx
@@ -18,8 +18,8 @@ import {
CommandGroup,
CommandInput,
CommandItem,
-} from "ui";
-import { Popover, PopoverContent, PopoverTrigger } from "ui";
+} from "@cap/ui";
+import { Popover, PopoverContent, PopoverTrigger } from "@cap/ui";
import { useState } from "react";
import {
Dialog,
@@ -28,7 +28,7 @@ import {
DialogHeader,
DialogTitle,
DialogTrigger,
-} from "ui";
+} from "@cap/ui";
import { NewSpace } from "@/components/forms/NewSpace";
import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
import { handleActiveSpace } from "@/utils/database/supabase/helpers";
diff --git a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
index e06d6f21d..1c9684534 100644
--- a/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
+++ b/apps/web/app/dashboard/_components/DynamicSharedLayout.tsx
@@ -2,7 +2,7 @@
import { createContext, useContext } from "react";
import AdminDesktopNav from "@/app/dashboard/_components/AdminNavbar/AdminDesktopNav";
import AdminMobileNav from "@/app/dashboard/_components/AdminNavbar/AdminMobileNav";
-import type { Database } from "@/utils/database/supabase/types";
+import type { Database } from "@cap/utils";
type SharedContext = {
spaceData: Database["public"]["Tables"]["spaces"]["Row"][] | null;
diff --git a/apps/web/app/dashboard/_components/WebsiteLayout.tsx b/apps/web/app/dashboard/_components/WebsiteLayout.tsx
deleted file mode 100644
index dd49ce870..000000000
--- a/apps/web/app/dashboard/_components/WebsiteLayout.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-"use client";
-import { createContext, useContext } from "react";
-import type { Database } from "@/utils/database/supabase/types";
-import { useSharedContext } from "@/app/dashboard/_components/DynamicSharedLayout";
-import { useParams } from "next/navigation";
-
-type WebsiteContext = {
- activeWebsite: Database["public"]["Tables"]["websites"]["Row"] | null;
-};
-
-const Context = createContext<WebsiteContext>({} as WebsiteContext);
-
-export function WebsiteLayout({ children }: { children: React.ReactNode }) {
- const params = useParams();
-
- const { websiteData } = useSharedContext();
-
- const activeWebsite = (websiteData?.find(
- (website) => website.active === true
- ) ?? null) as WebsiteContext["activeWebsite"];
-
- console.log("activeWebsite:");
- console.log(activeWebsite);
-
- return (
- <Context.Provider value={{ activeWebsite }}>{children}</Context.Provider>
- );
-}
-
-export const useWebsiteContext = () => useContext(Context);
diff --git a/apps/web/app/dashboard/caps/Caps.tsx b/apps/web/app/dashboard/caps/Caps.tsx
index 78d179fff..e9bc87125 100644
--- a/apps/web/app/dashboard/caps/Caps.tsx
+++ b/apps/web/app/dashboard/caps/Caps.tsx
@@ -1,7 +1,6 @@
"use client";
-import { Button } from "ui";
-import type { Database } from "@/utils/database/supabase/types";
-import { Eye, FileText, Lock } from "lucide-react";
+import { Button } from "@cap/ui";
+import type { Database } from "@cap/utils";
export const Caps = ({
data,
diff --git a/apps/web/app/dashboard/loading.tsx b/apps/web/app/dashboard/loading.tsx
index c6e178e4a..972527c43 100644
--- a/apps/web/app/dashboard/loading.tsx
+++ b/apps/web/app/dashboard/loading.tsx
@@ -1,6 +1,6 @@
"use client";
-import { SkeletonPage } from "ui";
+import { SkeletonPage } from "@cap/ui";
export default function Loading() {
return <SkeletonPage />;
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index e9df0f193..dc1adb093 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -3,7 +3,7 @@ import SupabaseListener from "@/utils/database/supabase/listener";
import SupabaseProvider from "@/utils/database/supabase/provider";
import "@/app/globals.css";
import { createServerClient } from "@/utils/database/supabase/server";
-import type { Database } from "@/utils/database/supabase/types";
+import type { Database } from "@cap/utils";
import type { SupabaseClient } from "@supabase/auth-helpers-nextjs";
import { Toaster } from "react-hot-toast";
import { Navbar } from "@/components/Navbar";
diff --git a/apps/web/app/login/page.tsx b/apps/web/app/login/page.tsx
index 3d4dfa63f..48d4dfca1 100644
--- a/apps/web/app/login/page.tsx
+++ b/apps/web/app/login/page.tsx
@@ -1,7 +1,7 @@
"use client";
import { useState, useRef, useEffect } from "react";
-import { Button } from "ui";
-import { LogoBadge } from "ui";
+import { Button } from "@cap/ui";
+import { LogoBadge } from "@cap/ui";
import { useSupabase } from "@/utils/database/supabase/provider";
export default function Login() {
diff --git a/apps/web/components/Navbar.tsx b/apps/web/components/Navbar.tsx
index f6173b847..1c1c4377a 100644
--- a/apps/web/components/Navbar.tsx
+++ b/apps/web/components/Navbar.tsx
@@ -1,7 +1,7 @@
"use client";
import { usePathname } from "next/navigation";
-import { Logo } from "ui";
+import { Logo } from "@cap/ui";
export const Navbar = () => {
const pathname = usePathname();
diff --git a/apps/web/components/forms/NewSpace.tsx b/apps/web/components/forms/NewSpace.tsx
index 8e248d81e..8540f5858 100644
--- a/apps/web/components/forms/NewSpace.tsx
+++ b/apps/web/components/forms/NewSpace.tsx
@@ -3,7 +3,7 @@ import { useRouter } from "next/navigation";
import { zodResolver } from "@hookform/resolvers/zod";
import * as z from "zod";
-import { Button } from "ui";
+import { Button } from "@cap/ui";
import {
Form,
FormControl,
@@ -11,8 +11,8 @@ import {
FormItem,
FormLabel,
FormMessage,
-} from "ui";
-import { Input } from "ui";
+} from "@cap/ui";
+import { Input } from "@cap/ui";
import { useForm } from "react-hook-form";
import { useSupabase } from "@/utils/database/supabase/provider";
import { useState } from "react";
diff --git a/apps/web/components/pages/HomePage.tsx b/apps/web/components/pages/HomePage.tsx
index 014ca42e6..b8ec6ec67 100644
--- a/apps/web/components/pages/HomePage.tsx
+++ b/apps/web/components/pages/HomePage.tsx
@@ -1,7 +1,7 @@
"use client";
import { useState, useRef } from "react";
-import { LogoBadge } from "ui";
+import { LogoBadge } from "@cap/ui";
import { Parallax } from "react-scroll-parallax";
import toast from "react-hot-toast";
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 553134c7c..c01ea1eed 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -17,7 +17,7 @@ if (!process.env.NEXT_PUBLIC_ENVIRONMENT || !process.env.NEXT_PUBLIC_URL) {
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
- transpilePackages: ["ui", "utils"],
+ transpilePackages: ["@cap/ui", "@cap/utils"],
eslint: {
ignoreDuringBuilds: true,
},
@@ -25,7 +25,7 @@ const nextConfig = {
ignoreBuildErrors: true,
},
experimental: {
- optimizePackageImports: ["ui", "utils"],
+ optimizePackageImports: ["@cap/ui", "@cap/utils"],
},
};
diff --git a/apps/web/package.json b/apps/web/package.json
index d83e142f4..af6794627 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -24,8 +24,8 @@
"react-scroll-parallax": "^3.4.5",
"server-only": "^0.0.1",
"tailwind-merge": "^2.1.0",
- "ui": "workspace:*",
- "utils": "workspace:*",
+ "@cap/ui": "workspace:*",
+ "@cap/utils": "workspace:*",
"zod": "^3.22.4"
},
"devDependencies": {
diff --git a/apps/web/postcss.config.js b/apps/web/postcss.config.js
index 19da3c66d..a1d89157e 100644
--- a/apps/web/postcss.config.js
+++ b/apps/web/postcss.config.js
@@ -1 +1 @@
-module.exports = require("ui/postcss");
+module.exports = require("@cap/ui/postcss");
diff --git a/apps/web/tailwind.config.js b/apps/web/tailwind.config.js
index 411487c80..cbe4f4a2e 100644
--- a/apps/web/tailwind.config.js
+++ b/apps/web/tailwind.config.js
@@ -1 +1 @@
-module.exports = require("ui/tailwind")("web");
+module.exports = require("@cap/ui/tailwind")("web");
diff --git a/package.json b/package.json
index a54994d02..6aa63b106 100644
--- a/package.json
+++ b/package.json
@@ -3,10 +3,7 @@
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint",
- "format": "prettier --write \"**/*.{ts,tsx,md}\"",
- "web": "pnpm --filter web --",
- "workshop": "pnpm --filter workshop --",
- "types": "npx supabase gen types typescript --project-id 'rvaxxiofrpjbeacyuwaf' --schema public > apps/web/utils/database/supabase/types.ts"
+ "format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"@turbo/gen": "^1.9.7",
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 5271a087f..977a6b798 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -1,5 +1,5 @@
{
- "name": "ui",
+ "name": "@cap/ui",
"version": "0.0.0",
"main": "./src/index.tsx",
"types": "./src/index.tsx",
diff --git a/packages/utils/README.md b/packages/utils/README.md
index e69de29bb..6496888c0 100644
--- a/packages/utils/README.md
+++ b/packages/utils/README.md
@@ -0,0 +1,3 @@
+## WIP: Utils Package
+
+# Common, shared utils for both web and desktop apps
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 39e2adb41..505f46b5f 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,10 +1,10 @@
{
- "name": "utils",
+ "name": "@cap/utils",
"version": "0.0.0",
- "main": "./src/index.tsx",
- "types": "./src/index.tsx",
+ "main": "./src/index.ts",
+ "types": "./src/index.ts",
"exports": {
- ".": "./src/index.tsx"
+ ".": "./src/index.ts"
},
"scripts": {
"lint": "eslint src --cache",
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
new file mode 100644
index 000000000..70222e74f
--- /dev/null
+++ b/packages/utils/src/index.ts
@@ -0,0 +1 @@
+export * from "./types/database";
diff --git a/packages/utils/src/types/database.ts b/packages/utils/src/types/database.ts
new file mode 100644
index 000000000..054b12c06
--- /dev/null
+++ b/packages/utils/src/types/database.ts
@@ -0,0 +1,377 @@
+export type Json =
+ | string
+ | number
+ | boolean
+ | null
+ | { [key: string]: Json | undefined }
+ | Json[]
+
+export interface Database {
+ public: {
+ Tables: {
+ shared_videos: {
+ Row: {
+ shared_at: string
+ shared_by_user_id: string | null
+ space_id: string
+ video_id: string
+ }
+ Insert: {
+ shared_at?: string
+ shared_by_user_id?: string | null
+ space_id: string
+ video_id: string
+ }
+ Update: {
+ shared_at?: string
+ shared_by_user_id?: string | null
+ space_id?: string
+ video_id?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "shared_videos_shared_by_user_id_fkey"
+ columns: ["shared_by_user_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "shared_videos_space_id_fkey"
+ columns: ["space_id"]
+ isOneToOne: false
+ referencedRelation: "spaces"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "shared_videos_video_id_fkey"
+ columns: ["video_id"]
+ isOneToOne: false
+ referencedRelation: "videos"
+ referencedColumns: ["id"]
+ }
+ ]
+ }
+ space_members: {
+ Row: {
+ role: Database["public"]["Enums"]["user_role"]
+ space_id: string
+ user_id: string
+ }
+ Insert: {
+ role: Database["public"]["Enums"]["user_role"]
+ space_id: string
+ user_id: string
+ }
+ Update: {
+ role?: Database["public"]["Enums"]["user_role"]
+ space_id?: string
+ user_id?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "space_members_space_id_fkey"
+ columns: ["space_id"]
+ isOneToOne: false
+ referencedRelation: "spaces"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "space_members_user_id_fkey"
+ columns: ["user_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
+ }
+ ]
+ }
+ spaces: {
+ Row: {
+ created_at: string
+ id: string
+ metadata: Json | null
+ name: string
+ owner_id: string | null
+ updated_at: string
+ }
+ Insert: {
+ created_at?: string
+ id?: string
+ metadata?: Json | null
+ name: string
+ owner_id?: string | null
+ updated_at?: string
+ }
+ Update: {
+ created_at?: string
+ id?: string
+ metadata?: Json | null
+ name?: string
+ owner_id?: string | null
+ updated_at?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "spaces_owner_id_fkey"
+ columns: ["owner_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
+ }
+ ]
+ }
+ users: {
+ Row: {
+ active_space_id: string | null
+ avatar_url: string | null
+ created_at: string
+ email: string
+ full_name: string | null
+ id: string
+ onboarding_questions: Json | null
+ stripe_customer_id: string | null
+ stripe_subscription_id: string | null
+ stripe_subscription_price_id: string | null
+ stripe_subscription_status: string | null
+ updated_at: string
+ video_quota: number
+ videos_created: number
+ }
+ Insert: {
+ active_space_id?: string | null
+ avatar_url?: string | null
+ created_at?: string
+ email: string
+ full_name?: string | null
+ id?: string
+ onboarding_questions?: Json | null
+ stripe_customer_id?: string | null
+ stripe_subscription_id?: string | null
+ stripe_subscription_price_id?: string | null
+ stripe_subscription_status?: string | null
+ updated_at?: string
+ video_quota?: number
+ videos_created?: number
+ }
+ Update: {
+ active_space_id?: string | null
+ avatar_url?: string | null
+ created_at?: string
+ email?: string
+ full_name?: string | null
+ id?: string
+ onboarding_questions?: Json | null
+ stripe_customer_id?: string | null
+ stripe_subscription_id?: string | null
+ stripe_subscription_price_id?: string | null
+ stripe_subscription_status?: string | null
+ updated_at?: string
+ video_quota?: number
+ videos_created?: number
+ }
+ Relationships: [
+ {
+ foreignKeyName: "users_active_space_id_fkey"
+ columns: ["active_space_id"]
+ isOneToOne: false
+ referencedRelation: "spaces"
+ referencedColumns: ["id"]
+ }
+ ]
+ }
+ videos: {
+ Row: {
+ complete: boolean
+ created_at: string
+ duration: number | null
+ id: string
+ is_public: boolean
+ metadata: Json | null
+ name: string
+ owner_id: string | null
+ s3_url: string | null
+ thumbnail_url: string | null
+ unique_cap_id: string | null
+ updated_at: string
+ }
+ Insert: {
+ complete?: boolean
+ created_at?: string
+ duration?: number | null
+ id?: string
+ is_public?: boolean
+ metadata?: Json | null
+ name?: string
+ owner_id?: string | null
+ s3_url?: string | null
+ thumbnail_url?: string | null
+ unique_cap_id?: string | null
+ updated_at?: string
+ }
+ Update: {
+ complete?: boolean
+ created_at?: string
+ duration?: number | null
+ id?: string
+ is_public?: boolean
+ metadata?: Json | null
+ name?: string
+ owner_id?: string | null
+ s3_url?: string | null
+ thumbnail_url?: string | null
+ unique_cap_id?: string | null
+ updated_at?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "videos_owner_id_fkey"
+ columns: ["owner_id"]
+ isOneToOne: false
+ referencedRelation: "users"
+ referencedColumns: ["id"]
+ }
+ ]
+ }
+ }
+ Views: {
+ [_ in never]: never
+ }
+ Functions: {
+ citext:
+ | {
+ Args: {
+ "": boolean
+ }
+ Returns: string
+ }
+ | {
+ Args: {
+ "": string
+ }
+ Returns: string
+ }
+ | {
+ Args: {
+ "": unknown
+ }
+ Returns: string
+ }
+ citext_hash: {
+ Args: {
+ "": string
+ }
+ Returns: number
+ }
+ citextin: {
+ Args: {
+ "": unknown
+ }
+ Returns: string
+ }
+ citextout: {
+ Args: {
+ "": string
+ }
+ Returns: unknown
+ }
+ citextrecv: {
+ Args: {
+ "": unknown
+ }
+ Returns: string
+ }
+ citextsend: {
+ Args: {
+ "": string
+ }
+ Returns: string
+ }
+ }
+ Enums: {
+ user_role: "owner" | "admin" | "member"
+ }
+ CompositeTypes: {
+ [_ in never]: never
+ }
+ }
+}
+
+export type Tables<
+ PublicTableNameOrOptions extends
+ | keyof (Database["public"]["Tables"] & Database["public"]["Views"])
+ | { schema: keyof Database },
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
+ ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
+ Database[PublicTableNameOrOptions["schema"]]["Views"])
+ : never = never
+> = PublicTableNameOrOptions extends { schema: keyof Database }
+ ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
+ Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
+ Row: infer R
+ }
+ ? R
+ : never
+ : PublicTableNameOrOptions extends keyof (Database["public"]["Tables"] &
+ Database["public"]["Views"])
+ ? (Database["public"]["Tables"] &
+ Database["public"]["Views"])[PublicTableNameOrOptions] extends {
+ Row: infer R
+ }
+ ? R
+ : never
+ : never
+
+export type TablesInsert<
+ PublicTableNameOrOptions extends
+ | keyof Database["public"]["Tables"]
+ | { schema: keyof Database },
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
+ : never = never
+> = PublicTableNameOrOptions extends { schema: keyof Database }
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
+ Insert: infer I
+ }
+ ? I
+ : never
+ : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
+ ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
+ Insert: infer I
+ }
+ ? I
+ : never
+ : never
+
+export type TablesUpdate<
+ PublicTableNameOrOptions extends
+ | keyof Database["public"]["Tables"]
+ | { schema: keyof Database },
+ TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
+ ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
+ : never = never
+> = PublicTableNameOrOptions extends { schema: keyof Database }
+ ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
+ Update: infer U
+ }
+ ? U
+ : never
+ : PublicTableNameOrOptions extends keyof Database["public"]["Tables"]
+ ? Database["public"]["Tables"][PublicTableNameOrOptions] extends {
+ Update: infer U
+ }
+ ? U
+ : never
+ : never
+
+export type Enums<
+ PublicEnumNameOrOptions extends
+ | keyof Database["public"]["Enums"]
+ | { schema: keyof Database },
+ EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
+ ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
+ : never = never
+> = PublicEnumNameOrOptions extends { schema: keyof Database }
+ ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
+ : PublicEnumNameOrOptions extends keyof Database["public"]["Enums"]
+ ? Database["public"]["Enums"][PublicEnumNameOrOptions]
+ : never
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index f9a8a68bc..c70bdfbc8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -26,6 +26,9 @@ importers:
apps/desktop:
dependencies:
+ '@cap/utils':
+ specifier: workspace:*
+ version: link:../../packages/utils
'@tauri-apps/api':
specifier: ^1.5.0
version: 1.5.1
@@ -87,6 +90,12 @@ importers:
apps/web:
dependencies:
+ '@cap/ui':
+ specifier: workspace:*
+ version: link:../../packages/ui
+ '@cap/utils':
+ specifier: workspace:*
+ version: link:../../packages/utils
'@headlessui/react':
specifier: ^1.7.17
@@ -132,12 +141,6 @@ importers:
tailwind-merge:
specifier: ^2.1.0
version: 2.1.0
- ui:
- specifier: workspace:*
- version: link:../../packages/ui
- utils:
- specifier: workspace:*
- version: link:../../packages/utils
zod:
specifier: ^3.22.4
version: 3.22.4