Skip to content

Conversation

@koxudaxi
Copy link
Collaborator

@koxudaxi koxudaxi commented Dec 10, 2025

TL;DR

Added API endpoints for managing serverless functions with authentication, registration, retrieval, and listing capabilities.

What changed?

Created two new files to implement a Functions API:

  1. functions.schemas.ts - Defines the schema types and API endpoints:

    • Schema definitions for function registration, responses, and dependencies
    • API endpoints for registering, retrieving, and listing functions
    • Error handling for unauthorized access, not found resources, and database errors
  2. functions.handlers.ts - Implements the handler logic:

    • registerFunctionHandler - Registers or retrieves a function with code, hash, signature, etc.
    • getFunctionByHashHandler - Retrieves a function by its hash
    • getFunctionHandler - Retrieves a function by its ID
    • listFunctionsHandler - Lists functions with optional filtering by name and tags

All handlers include API key authentication and proper error handling.

How to test?

  1. Test function registration:

    POST /functions
    

    with a valid API key and function payload

  2. Test retrieving a function by hash:

    GET /functions/by-hash/:hash
    
  3. Test retrieving a function by ID:

    GET /functions/:id
    
  4. Test listing functions with optional filters:

    GET /functions?name=example&tags=tag1,tag2&limit=10&offset=0
    

Ensure all requests include a valid API key in the X-API-Key header or as a Bearer token.

Why make this change?

This implementation provides a complete API for managing serverless functions, allowing clients to register, retrieve, and list functions with proper authentication and error handling. The API supports versioning, tagging, and metadata for functions, enabling a robust serverless function ecosystem.

This was referenced Dec 10, 2025
@koxudaxi koxudaxi force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch from b8d82c0 to b2aca9e Compare January 5, 2026 14:32
@koxudaxi koxudaxi force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from fa6d716 to 5db2b9b Compare January 5, 2026 14:32
@willbakst willbakst changed the base branch from 12-10-feat_db_add_functionservice_for_function_versioning to graphite-base/1625 January 6, 2026 00:04
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from 5db2b9b to b2d02a9 Compare January 6, 2026 00:18
@willbakst willbakst changed the base branch from graphite-base/1625 to 12-10-feat_db_add_functionservice_for_function_versioning January 6, 2026 00:18
@willbakst willbakst force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch from 85c86f3 to 0e3d42a Compare January 6, 2026 00:23
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from b2d02a9 to f359a06 Compare January 6, 2026 00:23
@koxudaxi koxudaxi force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch from 0e3d42a to 76bc724 Compare January 6, 2026 00:30
@koxudaxi koxudaxi force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from f359a06 to ff17581 Compare January 6, 2026 00:31
@willbakst willbakst force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch from 76bc724 to b41aa73 Compare January 6, 2026 02:16
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from ff17581 to 3278d72 Compare January 6, 2026 02:16
@willbakst willbakst force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch from b41aa73 to 6127227 Compare January 6, 2026 02:26
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch 2 times, most recently from 2436928 to 34b23f8 Compare January 6, 2026 02:46
@willbakst willbakst force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch 3 times, most recently from 98dc5cc to 76402ed Compare January 6, 2026 02:52
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch 2 times, most recently from 74533de to 510e73a Compare January 6, 2026 02:52
@willbakst willbakst force-pushed the 12-10-feat_db_add_functionservice_for_function_versioning branch from 76402ed to 445c6d1 Compare January 6, 2026 02:52
@willbakst willbakst changed the base branch from 12-10-feat_db_add_functionservice_for_function_versioning to graphite-base/1625 January 6, 2026 02:57
@willbakst willbakst changed the base branch from graphite-base/1625 to v2 January 6, 2026 02:58
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from 510e73a to 053104a Compare January 6, 2026 02:58
- Use Authentication.requireApiKey like traces.handlers.ts
- Remove explicit return type annotation like api-keys.handlers.ts
- Import PublicFunction from db/schema
@willbakst willbakst force-pushed the 12-10-feat_api_add_functions_api_endpoints branch from 053104a to 51fbdc1 Compare January 6, 2026 02:58
@willbakst willbakst merged commit b6f7743 into v2 Jan 6, 2026
10 checks passed
Copy link
Collaborator

Merge activity

@willbakst willbakst deleted the 12-10-feat_api_add_functions_api_endpoints branch January 6, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants