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-4/

Document Management System

Build a document management system that tracks file metadata for uploaded documents. The system should allow users to upload documents with custom metadata (such as document type, author, tags) and retrieve this metadata later.

Requirements

File Upload with Metadata

Implement a function that uploads a document to storage with custom metadata including:

  • Document type (e.g., "invoice", "contract", "report")
  • Author name
  • Creation date
  • Tags (array of strings)

Metadata Retrieval

Implement a function that retrieves and returns the custom metadata for a specific document.

Test Cases

  • Uploading a PDF file with metadata (type: "invoice", author: "John Doe", tags: ["finance", "Q4"]) stores the file successfully @test
  • Retrieving metadata for an uploaded file returns the correct custom metadata object @test
  • Uploading a file without metadata stores the file with empty metadata @test

Implementation

@generates

API

/**
 * Uploads a document with custom metadata to the storage bucket
 *
 * @param {string} filePath - Local path to the file to upload
 * @param {string} fileName - Name to store the file as
 * @param {Object} metadata - Custom metadata object with document information
 * @returns {Promise<{success: boolean, error?: string}>}
 */
async function uploadDocument(filePath, fileName, metadata) {
  // IMPLEMENTATION HERE
}

/**
 * Retrieves the custom metadata for a specific document
 *
 * @param {string} fileName - Name of the file to get metadata for
 * @returns {Promise<{metadata: Object, error?: string}>}
 */
async function getDocumentMetadata(fileName) {
  // IMPLEMENTATION HERE
}

module.exports = {
  uploadDocument,
  getDocumentMetadata
};

Dependencies { .dependencies }

@supabase/supabase-js { .dependency }

Provides file storage with custom metadata support.

@satisfied-by

Install with Tessl CLI

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

tile.json