CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-supabase--supabase-js

Isomorphic JavaScript client for Supabase providing authentication, database, real-time, storage, and edge functions capabilities.

89

0.95x
Overview
Eval results
Files

task.mdevals/scenario-10/

Task Management API

Build a simple task management system that allows users to perform basic operations on tasks stored in a Supabase database.

Requirements

Implement a task management module that provides functions to create, read, update, and delete tasks from a database table. The system should handle tasks with the following structure: id (number), title (string), description (string), completed (boolean), and priority (number).

The module should support:

  • Retrieving all tasks from the database
  • Retrieving specific tasks by ID
  • Finding tasks by completion status
  • Creating new tasks
  • Updating existing tasks
  • Deleting tasks by ID

The database connection should use environment variables SUPABASE_URL and SUPABASE_KEY for configuration.

Capabilities

Retrieve all tasks

  • The getAllTasks function returns all tasks from the tasks table @test
  • The returned data includes id, title, description, completed, and priority fields @test

Retrieve task by ID

  • The getTaskById function returns a single task matching the provided ID @test
  • The function returns null when no task matches the ID @test

Find tasks by status

  • The getCompletedTasks function returns only tasks where completed is true @test
  • The getIncompleteTasks function returns only tasks where completed is false @test

Create new tasks

  • The createTask function inserts a new task with title, description, and priority @test
  • New tasks default to completed: false @test
  • The function returns the created task with its generated ID @test

Update existing tasks

  • The updateTask function updates a task's fields by ID @test
  • The function can update title, description, completed status, and priority @test
  • The function returns the updated task data @test

Delete tasks

  • The deleteTask function removes a task from the database by ID @test
  • The function confirms successful deletion @test

Implementation

@generates

API

/**
 * Initialize and return a Supabase client instance.
 */
export function getClient(): any;

/**
 * Retrieve all tasks from the database.
 * @returns Array of all tasks
 */
export async function getAllTasks(): Promise<any[]>;

/**
 * Retrieve a single task by ID.
 * @param id - The task ID
 * @returns The task object or null if not found
 */
export async function getTaskById(id: number): Promise<any | null>;

/**
 * Retrieve all completed tasks.
 * @returns Array of completed tasks
 */
export async function getCompletedTasks(): Promise<any[]>;

/**
 * Retrieve all incomplete tasks.
 * @returns Array of incomplete tasks
 */
export async function getIncompleteTasks(): Promise<any[]>;

/**
 * Create a new task.
 * @param title - Task title
 * @param description - Task description
 * @param priority - Task priority (1-5)
 * @returns The created task with ID
 */
export async function createTask(
  title: string,
  description: string,
  priority: number
): Promise<any>;

/**
 * Update an existing task.
 * @param id - The task ID
 * @param updates - Object containing fields to update
 * @returns The updated task
 */
export async function updateTask(id: number, updates: any): Promise<any>;

/**
 * Delete a task by ID.
 * @param id - The task ID
 * @returns Success confirmation
 */
export async function deleteTask(id: number): Promise<void>;

Dependencies { .dependencies }

@supabase/supabase-js { .dependency }

Provides database client for performing CRUD operations on the tasks table.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-supabase--supabase-js

tile.json