export type Attribute = PrimitiveAttribute | ArrayAttribute | ObjectAttribute; export type ShallowAttribute = Omit; export type ParticipantsAll = { type: "all"; }; export type ParticipantsNone = { type: "none"; }; export type ParticipantsInclusion = { type: "inclusion"; companies: number[]; }; export type Participants = ParticipantsAll | ParticipantsNone | ParticipantsInclusion; export interface AttributeCollaborators { view: Participants; map: Participants; } export interface BaseAttribute { id: number; name: string; display_name: string; description?: string; type: string; validations?: string[]; metadata?: AttributeMetadata; /** Present only when the requesting company owns the attribute. */ company_id?: number; /** Present only when the requesting company owns the attribute. */ collaborators?: AttributeCollaborators; } export interface PrimitiveAttribute extends BaseAttribute { type: "string" | "boolean" | "double" | "long" | "timestamptz"; enum?: string[] | number[] | boolean[]; is_join_key?: boolean; } export type SubAttribute = Partial> & { type: string; enum?: string[] | number[] | boolean[]; is_join_key?: boolean; }; export interface RefAttribute { $ref: number; } export interface ArrayAttribute extends BaseAttribute { type: "array"; items: SubAttribute; } export interface ObjectAttribute extends BaseAttribute { type: "object"; properties: Record; required?: string[]; } export interface AttributeMetadata { attribute_cooccurrence: AttributeCooccurrence[]; } export interface AttributeCooccurrence { attribute: Attribute; cooccurrence_pct: number; } /** * Options accepted by `GET /attributes` in addition to pagination and keyword search. */ export interface AttributeSearchOptions { /** Resolve `$ref` attribute references. Defaults to `true` server-side. */ resolve?: boolean; /** * Minimum relevance score in `(0, 1]`, restricting results to matches at or * above this threshold. Only meaningful together with `searchParams.q`; * supplying it without `q` is a 400 server-side. */ min_score?: number; }