filterInterface (services/sqlInterface.ts)

langfuse · web/src/server/api/services/sqlInterface.ts · typescript · MIT
database, tag:embed-classified

Module exposing: filterInterface, sqlInterface

// Source: https://github.com/langfuse/langfuse | License: MIT | Copyright 2023-2026 ClickHouse, Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { singleFilterList } from "@langfuse/shared";
import { z } from "zod";

export type DatabaseRow = {
  [key: string]: string | number | Date | Record<string, unknown> | null;
};

const temporalUnit = z.enum(["month", "week", "day", "hour", "minute"]);

const aggregations = z
  .enum([
    "SUM",
    "AVG",
    "COUNT",
    "MAX",
    "MIN",
    "50thPercentile",
    "75thPercentile",
    "90thPercentile",
    "95thPercentile",
    "99thPercentile",
  ])
  .optional();

const groupByInterface = z.array(
  z.discriminatedUnion("type", [
    z.object({
      type: z.literal("datetime"),
      column: z.string(),
      tempo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key