API Specifications

Runtime Reference

Technical reference for compiler configurations, global runtime variables, and standard APIs supported by the DataVec AST-to-C compilation layer.

Global Worker Interfaces

Name / BindingTypeDescriptionReturns
fetch(request, env)
async function
Core entrypoint for Web Worker requests. Receives incoming request and bound environments.Promise<Response>
env.POSTGRES_DB
binding
PostgreSQL wire connection binding isolated inside custom unveil process spaces for network security.PostgresClient
env.S3_STORE
binding
R2-compatible S3 object storage web worker binding deployed on leased Digital Ocean droplets.ObjectStorage

Request Object Properties

PropertyTypeDescription
request.urlstringThe full incoming HTTP request URL string.
request.methodstringHTTP request verb (GET, POST, PUT, DELETE, etc.).
request.headersHeadersMap of HTTP request headers.
request.websocketWebSocketIncoming WebSocket stream connection instance for real-time bi-directional messaging.

Sample WebSocket & Postgres Endpoint

Example endpoint showing WebSocket streams and secure Postgres database query bindings inside unveil spaces:

export default {
  async fetch(request, env) {
    if (request.headers.get('Upgrade') === 'websocket') {
      const [client, server] = new WebSocketPair();
      server.accept();
      server.addEventListener('message', async (event) => {
        // Query Postgres safely inside isolated unveil space
        const users = await env.POSTGRES_DB.query(
          "SELECT * FROM users WHERE status = $1", 
          [event.data]
        );
        server.send(JSON.stringify(users.rows));
      });
      return new Response(null, { status: 101, webSocket: client });
    }
    return new Response("Not a WebSocket connection", { status: 400 });
  }
};