mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
204 lines
9.6 KiB
TypeScript
Generated
204 lines
9.6 KiB
TypeScript
Generated
/**
|
|
* Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
|
|
* To modify these schemas, update the Django serializers or views, then run:
|
|
* insightscli build:openapi
|
|
* Questions or issues? #team-devex on Slack
|
|
*
|
|
* Insights API - generated
|
|
* OpenAPI spec version: 1.0.0
|
|
*/
|
|
import * as zod from 'zod'
|
|
|
|
/**
|
|
* Create a new endpoint.
|
|
*/
|
|
export const EndpointsCreateBody = /* @__PURE__ */ zod
|
|
.object({
|
|
name: zod
|
|
.string()
|
|
.nullish()
|
|
.describe(
|
|
'Unique URL-safe name. Must start with a letter, only letters\/numbers\/hyphens\/underscores, max 128 chars.'
|
|
),
|
|
query: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('InsightsQL or insight query this endpoint executes. Changing this auto-creates a new version.'),
|
|
description: zod.string().nullish().describe('Human-readable description of what this endpoint returns.'),
|
|
data_freshness_seconds: zod
|
|
.number()
|
|
.nullish()
|
|
.describe(
|
|
'How fresh the data should be, in seconds. Must be one of: 900 (15 min), 1800 (30 min), 3600 (1 h), 21600 (6 h), 43200 (12 h), 86400 (24 h, default), 604800 (7 d). Controls cache TTL and materialization sync frequency.'
|
|
),
|
|
is_active: zod.boolean().nullish().describe('Whether this endpoint is available for execution via the API.'),
|
|
is_materialized: zod.boolean().nullish().describe('Whether query results are materialized to S3.'),
|
|
derived_from_insight: zod
|
|
.string()
|
|
.nullish()
|
|
.describe('Short ID of the insight this endpoint was derived from.'),
|
|
version: zod
|
|
.number()
|
|
.nullish()
|
|
.describe('Target a specific version for updates (defaults to current version).'),
|
|
bucket_overrides: zod
|
|
.record(zod.string(), zod.unknown())
|
|
.nullish()
|
|
.describe(
|
|
'Per-column bucket overrides for range variable materialization. Keys are column names, values are bucket keys.'
|
|
),
|
|
deleted: zod.boolean().nullish().describe('Set to true to soft-delete this endpoint.'),
|
|
tags: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe('List of tag names to associate with this endpoint. Replaces any existing tags.'),
|
|
optional_breakdown_properties: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe(
|
|
'Breakdown property names that may be omitted on \/run. Omitted ones return data aggregated across all values of that breakdown. Defaults to [] — every breakdown variable is required.'
|
|
),
|
|
})
|
|
.describe('Schema for creating\/updating endpoints. OpenAPI docs only — validation uses Pydantic.')
|
|
|
|
/**
|
|
* Update an existing endpoint. Parameters are optional. Pass version in body or ?version=N query param to target a specific version.
|
|
*/
|
|
export const EndpointsUpdateBody = /* @__PURE__ */ zod
|
|
.object({
|
|
name: zod
|
|
.string()
|
|
.nullish()
|
|
.describe(
|
|
'Unique URL-safe name. Must start with a letter, only letters\/numbers\/hyphens\/underscores, max 128 chars.'
|
|
),
|
|
query: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('InsightsQL or insight query this endpoint executes. Changing this auto-creates a new version.'),
|
|
description: zod.string().nullish().describe('Human-readable description of what this endpoint returns.'),
|
|
data_freshness_seconds: zod
|
|
.number()
|
|
.nullish()
|
|
.describe(
|
|
'How fresh the data should be, in seconds. Must be one of: 900 (15 min), 1800 (30 min), 3600 (1 h), 21600 (6 h), 43200 (12 h), 86400 (24 h, default), 604800 (7 d). Controls cache TTL and materialization sync frequency.'
|
|
),
|
|
is_active: zod.boolean().nullish().describe('Whether this endpoint is available for execution via the API.'),
|
|
is_materialized: zod.boolean().nullish().describe('Whether query results are materialized to S3.'),
|
|
derived_from_insight: zod
|
|
.string()
|
|
.nullish()
|
|
.describe('Short ID of the insight this endpoint was derived from.'),
|
|
version: zod
|
|
.number()
|
|
.nullish()
|
|
.describe('Target a specific version for updates (defaults to current version).'),
|
|
bucket_overrides: zod
|
|
.record(zod.string(), zod.unknown())
|
|
.nullish()
|
|
.describe(
|
|
'Per-column bucket overrides for range variable materialization. Keys are column names, values are bucket keys.'
|
|
),
|
|
deleted: zod.boolean().nullish().describe('Set to true to soft-delete this endpoint.'),
|
|
tags: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe('List of tag names to associate with this endpoint. Replaces any existing tags.'),
|
|
optional_breakdown_properties: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe(
|
|
'Breakdown property names that may be omitted on \/run. Omitted ones return data aggregated across all values of that breakdown. Defaults to [] — every breakdown variable is required.'
|
|
),
|
|
})
|
|
.describe('Schema for creating\/updating endpoints. OpenAPI docs only — validation uses Pydantic.')
|
|
|
|
/**
|
|
* Update an existing endpoint.
|
|
*/
|
|
export const EndpointsPartialUpdateBody = /* @__PURE__ */ zod
|
|
.object({
|
|
name: zod
|
|
.string()
|
|
.nullish()
|
|
.describe(
|
|
'Unique URL-safe name. Must start with a letter, only letters\/numbers\/hyphens\/underscores, max 128 chars.'
|
|
),
|
|
query: zod
|
|
.unknown()
|
|
.optional()
|
|
.describe('InsightsQL or insight query this endpoint executes. Changing this auto-creates a new version.'),
|
|
description: zod.string().nullish().describe('Human-readable description of what this endpoint returns.'),
|
|
data_freshness_seconds: zod
|
|
.number()
|
|
.nullish()
|
|
.describe(
|
|
'How fresh the data should be, in seconds. Must be one of: 900 (15 min), 1800 (30 min), 3600 (1 h), 21600 (6 h), 43200 (12 h), 86400 (24 h, default), 604800 (7 d). Controls cache TTL and materialization sync frequency.'
|
|
),
|
|
is_active: zod.boolean().nullish().describe('Whether this endpoint is available for execution via the API.'),
|
|
is_materialized: zod.boolean().nullish().describe('Whether query results are materialized to S3.'),
|
|
derived_from_insight: zod
|
|
.string()
|
|
.nullish()
|
|
.describe('Short ID of the insight this endpoint was derived from.'),
|
|
version: zod
|
|
.number()
|
|
.nullish()
|
|
.describe('Target a specific version for updates (defaults to current version).'),
|
|
bucket_overrides: zod
|
|
.record(zod.string(), zod.unknown())
|
|
.nullish()
|
|
.describe(
|
|
'Per-column bucket overrides for range variable materialization. Keys are column names, values are bucket keys.'
|
|
),
|
|
deleted: zod.boolean().nullish().describe('Set to true to soft-delete this endpoint.'),
|
|
tags: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe('List of tag names to associate with this endpoint. Replaces any existing tags.'),
|
|
optional_breakdown_properties: zod
|
|
.array(zod.string())
|
|
.nullish()
|
|
.describe(
|
|
'Breakdown property names that may be omitted on \/run. Omitted ones return data aggregated across all values of that breakdown. Defaults to [] — every breakdown variable is required.'
|
|
),
|
|
})
|
|
.describe('Schema for creating\/updating endpoints. OpenAPI docs only — validation uses Pydantic.')
|
|
|
|
/**
|
|
* Preview the materialization transform for an endpoint. Shows what the query will look like after materialization, including range pair detection and bucket functions.
|
|
*/
|
|
export const EndpointsMaterializationPreviewCreateBody = /* @__PURE__ */ zod.object({
|
|
version: zod.number().optional(),
|
|
bucket_overrides: zod
|
|
.record(zod.string(), zod.string())
|
|
.nullish()
|
|
.describe('Per-column bucket function overrides, e.g. {\"timestamp\": \"hour\"}'),
|
|
})
|
|
|
|
/**
|
|
* Ask AI to rewrite the endpoint's query into a semantically equivalent form that can be materialized. Only applicable to SQL (InsightsQL) endpoints that currently fail the materialization checks. The suggestion is validated against the live checks before being returned; nothing is saved. Requires the organization's AI data processing approval.
|
|
*/
|
|
export const EndpointsMaterializationSuggestionCreateBody = /* @__PURE__ */ zod
|
|
.object({
|
|
version: zod
|
|
.number()
|
|
.nullish()
|
|
.describe('Endpoint version to suggest a fix for. Defaults to the latest version.'),
|
|
})
|
|
.describe('Request body for the AI materialization-fix suggestion action.')
|
|
|
|
/**
|
|
* Execute endpoint with optional materialization. Supports version parameter, runs latest version if not set.
|
|
*/
|
|
export const EndpointsRunCreateBody = /* @__PURE__ */ zod
|
|
.record(zod.string(), zod.unknown())
|
|
.describe('Deep\/recursive schema (opaque in Zod — use TypeScript types for full shape)')
|
|
|
|
/**
|
|
* Get the most recent execution time per endpoint (endpoint-level). Timestamps are recorded by the run path for personal-API-key calls. For per-version usage, query the query_log table directly.
|
|
*/
|
|
export const EndpointsLastExecutionTimesCreateBody = /* @__PURE__ */ zod.object({
|
|
names: zod.array(zod.string()),
|
|
})
|