/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited * * The dialect-independent column manifest for the EAV store tables. * * Every adapter's UNION ALL over its `store_*` tables projects into the same * unified row shape (see `UnifiedFieldValue`). Instead of each adapter * hand-maintaining its own list of columns, adapters generate their SELECT * lists from this single manifest — adding a column or a new store table is * a one-line change here rather than N hand-synchronized SQL fragments. * * This module is pure data: no SQL, no drizzle-orm, no pg. Each adapter owns * its own SQL generation (e.g. `@byline/db-postgres`'s `storeSelectList()` + * `pgNullCast()`) consuming this manifest. */ import type { StoreType } from './field-store-map.js'; /** * Each entry describes one column in the unified UNION ALL output. * * - `name`: The output column alias (matches UnifiedFieldValue / FlattenedFieldValue). * - `nullCast`: The abstract SQL type name used when a store table does NOT * provide this column (e.g. `'boolean'`, `'uuid'`, `'text'`). * Only the first SELECT in a UNION ALL strictly needs casts, * but including them everywhere is harmless and makes each * fragment self-describing. Each adapter maps this abstract * name to its own dialect cast — the Postgres adapter's * `pgNullCast()` renders it as `NULL::`. * - `sources`: A map from store type key → the source column name that * produces this column's value from that table. If a store * type is absent, the column is emitted as a typed NULL. */ export interface ColumnDef { name: string; nullCast: string; sources?: Partial>; } /** Store table names, keyed by StoreType. Shared naming convention across adapters. */ export declare const storeTableNames: Record; /** * Canonical column order for the unified UNION ALL output. * * The first 7 columns are shared across all store tables (base columns). * The remaining columns are type-specific — each one declares which store * table(s) provide it and what source column to read. */ export declare const storeColumnManifest: ColumnDef[];