latticesql 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/cli.js +1899 -135
- package/dist/index.cjs +1948 -153
- package/dist/index.d.cts +360 -1
- package/dist/index.d.ts +360 -1
- package/dist/index.js +1908 -127
- package/docs/api-reference.md +60 -4
- package/docs/architecture.md +24 -0
- package/docs/assistant.md +23 -0
- package/docs/examples/dashboard.html +284 -0
- package/docs/importing.md +118 -0
- package/docs/retrieval.md +31 -0
- package/package.json +7 -3
package/dist/index.d.cts
CHANGED
|
@@ -1468,6 +1468,16 @@ interface EmbeddingsConfig {
|
|
|
1468
1468
|
* Lattice never calls a model itself.
|
|
1469
1469
|
*/
|
|
1470
1470
|
modelId?: string;
|
|
1471
|
+
/**
|
|
1472
|
+
* Optional opt-in cap on the no-index fallback scan. When the in-process cosine
|
|
1473
|
+
* scan (used only when no native vector index exists for a table) would read
|
|
1474
|
+
* more than this many stored chunk vectors, `searchByEmbedding` throws
|
|
1475
|
+
* `EmbeddingScanTooLargeError` instead of loading them all into memory. OFF by
|
|
1476
|
+
* default (unbounded scan — historical behavior). Lattice never silently
|
|
1477
|
+
* truncates the scan: a partial cosine scan returns incomplete, wrong results,
|
|
1478
|
+
* so it fails loudly and tells you to add a pgvector index or raise the cap.
|
|
1479
|
+
*/
|
|
1480
|
+
maxScanChunks?: number;
|
|
1471
1481
|
}
|
|
1472
1482
|
/**
|
|
1473
1483
|
* Options for `Lattice.search()`.
|
|
@@ -2519,6 +2529,18 @@ declare class EmbeddingDimensionMismatchError extends Error {
|
|
|
2519
2529
|
readonly found: number;
|
|
2520
2530
|
constructor(table: string, expected: number, found: number);
|
|
2521
2531
|
}
|
|
2532
|
+
/**
|
|
2533
|
+
* Thrown by `searchByEmbedding` when the no-index fallback cosine scan would read
|
|
2534
|
+
* more stored chunk vectors than the configured `maxScanChunks`. The scan is
|
|
2535
|
+
* never silently truncated (that would return incomplete, wrong results) — it
|
|
2536
|
+
* fails loudly so the caller adds a native vector index or raises the cap.
|
|
2537
|
+
*/
|
|
2538
|
+
declare class EmbeddingScanTooLargeError extends Error {
|
|
2539
|
+
readonly table: string;
|
|
2540
|
+
readonly found: number;
|
|
2541
|
+
readonly limit: number;
|
|
2542
|
+
constructor(table: string, found: number, limit: number);
|
|
2543
|
+
}
|
|
2522
2544
|
/**
|
|
2523
2545
|
* Search rows by semantic similarity. Uses a native vector index (pgvector) when
|
|
2524
2546
|
* one exists for the table; otherwise an in-process cosine scan over the stored
|
|
@@ -6691,6 +6713,16 @@ interface GuiServerHandle {
|
|
|
6691
6713
|
port: number;
|
|
6692
6714
|
url: string;
|
|
6693
6715
|
close: () => Promise<void>;
|
|
6716
|
+
/**
|
|
6717
|
+
* Resolves when the active workspace's background owner-side convergence (cloud
|
|
6718
|
+
* RLS / member grants, incl. the `_lattice_gui_meta` read-grant) has settled.
|
|
6719
|
+
* Opening a cloud workspace returns immediately and convergence runs unawaited
|
|
6720
|
+
* (see {@link ActiveDb.converged}); a test that acts AS A MEMBER right after the
|
|
6721
|
+
* owner opens MUST await this, or the member render can race the grant and fail
|
|
6722
|
+
* with "permission denied for table _lattice_gui_meta". The GUI never needs it;
|
|
6723
|
+
* resolves immediately for a non-cloud / virgin workspace.
|
|
6724
|
+
*/
|
|
6725
|
+
whenConverged: () => Promise<void>;
|
|
6694
6726
|
}
|
|
6695
6727
|
declare function startGuiServer(options: StartGuiServerOptions): Promise<GuiServerHandle>;
|
|
6696
6728
|
|
|
@@ -6758,4 +6790,331 @@ declare class FileSourceKeyStore implements SourceKeyStore {
|
|
|
6758
6790
|
private encodeFile;
|
|
6759
6791
|
}
|
|
6760
6792
|
|
|
6761
|
-
|
|
6793
|
+
/**
|
|
6794
|
+
* Types for the structured-source importer: turning a parsed JSON source into a
|
|
6795
|
+
* proposed Lattice schema (entities, dimensions, linkages) that the user reviews
|
|
6796
|
+
* before anything is written. The inference step ({@link inferSchema}) returns a
|
|
6797
|
+
* {@link ProposedSchema}; the user approves (optionally trims) it; the
|
|
6798
|
+
* materialize step creates the tables, rows, and junctions from it.
|
|
6799
|
+
*
|
|
6800
|
+
* Derived / computed values are intentionally NOT modeled here — they belong to a
|
|
6801
|
+
* later dashboard→Lattice write-back feature, not source ingestion.
|
|
6802
|
+
*/
|
|
6803
|
+
/** Canonical column types we infer from JSON values. Maps onto Lattice field types. */
|
|
6804
|
+
type InferredType = 'integer' | 'real' | 'boolean' | 'date' | 'datetime' | 'text';
|
|
6805
|
+
interface InferredColumn {
|
|
6806
|
+
/** Normalized snake_case column name. */
|
|
6807
|
+
name: string;
|
|
6808
|
+
/** Original JSON key (may differ from {@link name}). */
|
|
6809
|
+
sourceKey: string;
|
|
6810
|
+
type: InferredType;
|
|
6811
|
+
}
|
|
6812
|
+
/**
|
|
6813
|
+
* A relationship inferred between two entities (or an entity and a normalized
|
|
6814
|
+
* dimension). Reported with match counts + a confidence so the user can judge it
|
|
6815
|
+
* before approving — links are never applied silently.
|
|
6816
|
+
*/
|
|
6817
|
+
interface InferredLinkage {
|
|
6818
|
+
kind: 'many-to-many' | 'many-to-one' | 'dimension';
|
|
6819
|
+
/** Entity table the reference lives on (normalized name). */
|
|
6820
|
+
fromEntity: string;
|
|
6821
|
+
/** Source JSON key on the entity holding the reference value(s). */
|
|
6822
|
+
fromField: string;
|
|
6823
|
+
/** Target entity/dimension table (normalized name). */
|
|
6824
|
+
toEntity: string;
|
|
6825
|
+
/** Natural-key column on the target used to resolve a reference value. */
|
|
6826
|
+
toKey: string;
|
|
6827
|
+
/** Junction table name (many-to-many + dimension links). */
|
|
6828
|
+
junction?: string;
|
|
6829
|
+
/** Distinct reference values that resolve to a target row. */
|
|
6830
|
+
matched: number;
|
|
6831
|
+
/** Distinct reference values that do NOT resolve (reported, never fatal). */
|
|
6832
|
+
unresolved: number;
|
|
6833
|
+
/** 0..1 — share of distinct reference values that resolved. */
|
|
6834
|
+
confidence: number;
|
|
6835
|
+
}
|
|
6836
|
+
interface InferredEntity {
|
|
6837
|
+
/** Normalized snake_case table name. */
|
|
6838
|
+
name: string;
|
|
6839
|
+
/** Original top-level JSON key. */
|
|
6840
|
+
sourceKey: string;
|
|
6841
|
+
/** Scalar columns only — array/linkage fields and dimension-extracted columns are excluded. */
|
|
6842
|
+
columns: InferredColumn[];
|
|
6843
|
+
/** Natural-key column name (normalized), or null = keyless (surrogate id + content-hash dedup). */
|
|
6844
|
+
naturalKey: string | null;
|
|
6845
|
+
/** Original JSON key for the natural key (un-normalized), or null. Used to read source records. */
|
|
6846
|
+
naturalKeySource: string | null;
|
|
6847
|
+
rowCount: number;
|
|
6848
|
+
/** True when reconstructed from `<key>` (array of arrays) + `<key>Cols` (column dictionary). */
|
|
6849
|
+
columnar: boolean;
|
|
6850
|
+
}
|
|
6851
|
+
interface InferredDimension {
|
|
6852
|
+
/** Dimension table name (e.g. `industry`). */
|
|
6853
|
+
name: string;
|
|
6854
|
+
/** Source column key the values come from. */
|
|
6855
|
+
sourceField: string;
|
|
6856
|
+
/** Entities that contribute values to this dimension. */
|
|
6857
|
+
fromEntities: string[];
|
|
6858
|
+
distinctValues: number;
|
|
6859
|
+
}
|
|
6860
|
+
interface ProposedSchema {
|
|
6861
|
+
entities: InferredEntity[];
|
|
6862
|
+
dimensions: InferredDimension[];
|
|
6863
|
+
linkages: InferredLinkage[];
|
|
6864
|
+
/** Top-level keys not imported (derived rollups, meta, scalars, column dictionaries). */
|
|
6865
|
+
skipped: {
|
|
6866
|
+
key: string;
|
|
6867
|
+
reason: string;
|
|
6868
|
+
}[];
|
|
6869
|
+
}
|
|
6870
|
+
/**
|
|
6871
|
+
* An entity recognized as a reconstructable projection of another (a "master")
|
|
6872
|
+
* table — its rows are contained in the master, filtered by one column. It is
|
|
6873
|
+
* materialized as a read-only DB VIEW (`master WHERE filterColumn = filterValue`)
|
|
6874
|
+
* rather than a duplicate table.
|
|
6875
|
+
*/
|
|
6876
|
+
interface DetectedView {
|
|
6877
|
+
/** The view's name (normalized) — the original tab/entity. */
|
|
6878
|
+
name: string;
|
|
6879
|
+
/** The master entity (normalized) this view projects from. */
|
|
6880
|
+
master: string;
|
|
6881
|
+
/** Master column the view filters on (normalized). */
|
|
6882
|
+
filterColumn: string;
|
|
6883
|
+
/** The value `filterColumn` equals for this view. */
|
|
6884
|
+
filterValue: string;
|
|
6885
|
+
/** Number of master rows that matched (the view's row count). */
|
|
6886
|
+
matchedRows: number;
|
|
6887
|
+
}
|
|
6888
|
+
|
|
6889
|
+
/**
|
|
6890
|
+
* Re-extract the raw source records for an entity from the parsed JSON — handling
|
|
6891
|
+
* the columnar case (`<key>` array-of-arrays + `<key>Cols` dictionary). Shared by
|
|
6892
|
+
* the inference step and the materialize step so both read records identically.
|
|
6893
|
+
*/
|
|
6894
|
+
declare function sourceRecords(data: Record<string, unknown>, entity: {
|
|
6895
|
+
sourceKey: string;
|
|
6896
|
+
columnar: boolean;
|
|
6897
|
+
}): Record<string, unknown>[];
|
|
6898
|
+
/** Lower-snake-case a JSON key into a safe SQL identifier. */
|
|
6899
|
+
declare function normalizeName(key: string): string;
|
|
6900
|
+
/** Infer a column type from a set of values (nulls ignored). Defaults to text. */
|
|
6901
|
+
declare function inferFieldType(values: unknown[]): InferredType;
|
|
6902
|
+
interface InferOptions {
|
|
6903
|
+
/** Override the inferred entity → table name (sourceKey → name). */
|
|
6904
|
+
rename?: Record<string, string>;
|
|
6905
|
+
}
|
|
6906
|
+
declare function inferSchema(data: Record<string, unknown>, opts?: InferOptions): ProposedSchema;
|
|
6907
|
+
|
|
6908
|
+
/**
|
|
6909
|
+
* Materialize an approved {@link ProposedSchema} into a Lattice workspace: create
|
|
6910
|
+
* the entity + dimension tables and the junctions, then load the rows (deduped)
|
|
6911
|
+
* and the links. Lattice becomes the system of record — the schema is persisted
|
|
6912
|
+
* to the workspace config so it survives a restart.
|
|
6913
|
+
*
|
|
6914
|
+
* Rows go through {@link Lattice.seed} (upsert by natural/content key → dedup +
|
|
6915
|
+
* idempotent re-apply). Junctions are written directly so the link column names
|
|
6916
|
+
* are fully controlled (`<entity>_id`).
|
|
6917
|
+
*/
|
|
6918
|
+
interface MaterializeCtx {
|
|
6919
|
+
db: Lattice;
|
|
6920
|
+
/** Workspace config path. When set, the schema is persisted here (canonical). */
|
|
6921
|
+
configPath?: string | null;
|
|
6922
|
+
}
|
|
6923
|
+
/**
|
|
6924
|
+
* What to materialize:
|
|
6925
|
+
* - `schema` — table structures + the deduped dimension values (the taxonomy /
|
|
6926
|
+
* "dictionary") + views. No entity rows, no links.
|
|
6927
|
+
* - `contents` — the entity rows + their links, into tables that already exist
|
|
6928
|
+
* (created idempotently if missing). No dimension values, no views.
|
|
6929
|
+
* - `both` — schema + contents (the default).
|
|
6930
|
+
*/
|
|
6931
|
+
type ImportMode = 'schema' | 'contents' | 'both';
|
|
6932
|
+
/** A live step in the import pipeline, for streaming progress to the UI. */
|
|
6933
|
+
interface ImportProgress {
|
|
6934
|
+
phase: 'parse' | 'infer' | 'detect' | 'entities' | 'dimensions' | 'links' | 'views' | 'done';
|
|
6935
|
+
message: string;
|
|
6936
|
+
table?: string;
|
|
6937
|
+
count?: number;
|
|
6938
|
+
}
|
|
6939
|
+
interface MaterializeOptions {
|
|
6940
|
+
/** Which parts to materialize (default `both`). */
|
|
6941
|
+
mode?: ImportMode;
|
|
6942
|
+
/**
|
|
6943
|
+
* Called as each step completes — drives the live pipeline view. May return a
|
|
6944
|
+
* promise; it is awaited, so a streaming caller can yield to the event loop
|
|
6945
|
+
* (flushing the socket) between steps. Without that yield, a synchronous DB
|
|
6946
|
+
* (SQLite) runs the whole import in one tick and the progress batches.
|
|
6947
|
+
*/
|
|
6948
|
+
onProgress?: (p: ImportProgress) => void | Promise<void>;
|
|
6949
|
+
/**
|
|
6950
|
+
* Point-in-time snapshot date (ISO `YYYY-MM-DD`). When set, every entity + link
|
|
6951
|
+
* row is stamped with `as_of` and the row identity includes it, so re-importing
|
|
6952
|
+
* the same model at a new date APPENDS a dated snapshot (the prior one is kept)
|
|
6953
|
+
* and links resolve within each snapshot. Dimensions (the shared taxonomy) are
|
|
6954
|
+
* not dated. Omitted ⇒ the import is undated (re-import upserts in place).
|
|
6955
|
+
*/
|
|
6956
|
+
asOf?: string | null;
|
|
6957
|
+
/**
|
|
6958
|
+
* Per-row snapshot date: the (normalized) name of a column whose value dates
|
|
6959
|
+
* each row individually, so one file can carry many periods. When set, each
|
|
6960
|
+
* row's `as_of` is read from this column (parsed per row), falling back to
|
|
6961
|
+
* {@link asOf} when a row's value isn't a date; applied to every entity that
|
|
6962
|
+
* has a column of this name. Identity + link resolution fold in the per-row
|
|
6963
|
+
* date exactly as the file-level {@link asOf} does.
|
|
6964
|
+
*/
|
|
6965
|
+
asOfColumn?: string | null;
|
|
6966
|
+
}
|
|
6967
|
+
interface MaterializeResult {
|
|
6968
|
+
mode: ImportMode;
|
|
6969
|
+
/** The file-level snapshot date stamped on the rows, or null. */
|
|
6970
|
+
asOf: string | null;
|
|
6971
|
+
/** The per-row date column used (each row dated from it), or null. */
|
|
6972
|
+
asOfColumn: string | null;
|
|
6973
|
+
tablesCreated: string[];
|
|
6974
|
+
rowsByTable: Record<string, number>;
|
|
6975
|
+
links: {
|
|
6976
|
+
junction: string;
|
|
6977
|
+
created: number;
|
|
6978
|
+
unresolved: number;
|
|
6979
|
+
}[];
|
|
6980
|
+
/** Read-only views created for detected projections (master filtered by a column). */
|
|
6981
|
+
views: {
|
|
6982
|
+
name: string;
|
|
6983
|
+
master: string;
|
|
6984
|
+
rows: number;
|
|
6985
|
+
}[];
|
|
6986
|
+
}
|
|
6987
|
+
declare function materializeImport(ctx: MaterializeCtx, data: Record<string, unknown>, plan: ProposedSchema, views?: DetectedView[], opts?: MaterializeOptions): Promise<MaterializeResult>;
|
|
6988
|
+
|
|
6989
|
+
/**
|
|
6990
|
+
* "As of" (snapshot date) detection for an import. The date drives how dated
|
|
6991
|
+
* snapshots are kept, so detection is deliberately a *suggestion* layer: many
|
|
6992
|
+
* signals each produce a ranked {@link AsOfCandidate} with evidence, the best is
|
|
6993
|
+
* prefilled, and the user confirms or overrides. Worst case (no signal) is a
|
|
6994
|
+
* blank field — never a silent wrong guess.
|
|
6995
|
+
*
|
|
6996
|
+
* Signals, strongest first:
|
|
6997
|
+
* - in-content phrase ("as of <date>", "period ended <date>") — the document says it
|
|
6998
|
+
* - in-content bare date (a date in the title/preamble or extracted text)
|
|
6999
|
+
* - file name date ("… 3.31.26.xlsx")
|
|
7000
|
+
* Each is file-type-agnostic: a caller feeds text snippets (Excel preamble, JSON
|
|
7001
|
+
* meta, extracted PDF text, …) + the file name, and the scanner does the rest.
|
|
7002
|
+
*/
|
|
7003
|
+
interface AsOfCandidate {
|
|
7004
|
+
/** ISO `YYYY-MM-DD`. */
|
|
7005
|
+
date: string;
|
|
7006
|
+
/** Where it came from (for the UI + ranking). */
|
|
7007
|
+
source: 'content' | 'filename' | 'column' | 'metadata' | 'llm';
|
|
7008
|
+
/** 0..1 — higher wins. */
|
|
7009
|
+
confidence: number;
|
|
7010
|
+
/** Human-readable justification, shown next to the prefilled field. */
|
|
7011
|
+
evidence: string;
|
|
7012
|
+
}
|
|
7013
|
+
/**
|
|
7014
|
+
* Parse a single cell/field value into an ISO date, or null. Handles a `Date`
|
|
7015
|
+
* (exceljs hands back `Date` objects for date-typed cells) and date-bearing
|
|
7016
|
+
* strings ("2026-03-31", "3/31/26", "March 31, 2026"). Used to read a per-row
|
|
7017
|
+
* "as of" column. A bare number is ignored — an Excel serial is already a `Date`
|
|
7018
|
+
* by the time we see it, and a loose number is far more likely an amount.
|
|
7019
|
+
*/
|
|
7020
|
+
declare function parseCellDate(value: unknown): string | null;
|
|
7021
|
+
interface AsOfInputs {
|
|
7022
|
+
fileName?: string;
|
|
7023
|
+
/** Text snippets to scan, each with a label (e.g. "title", "extracted text"). */
|
|
7024
|
+
texts?: {
|
|
7025
|
+
label: string;
|
|
7026
|
+
text: string;
|
|
7027
|
+
}[];
|
|
7028
|
+
}
|
|
7029
|
+
/** Gather + rank as-of candidates from all inputs (best first, deduped by date). */
|
|
7030
|
+
declare function detectAsOfCandidates(inputs: AsOfInputs): AsOfCandidate[];
|
|
7031
|
+
/** Convenience: the single best-guess date from a file name, or null. */
|
|
7032
|
+
declare function detectAsOf(fileName: string): string | null;
|
|
7033
|
+
|
|
7034
|
+
/**
|
|
7035
|
+
* Detect a per-row "as of" DATE COLUMN — so one file can carry many periods
|
|
7036
|
+
* (each row dated by its own column value) instead of a single file-level
|
|
7037
|
+
* snapshot date. Like {@link detectAsOfCandidates}, this is a *suggestion* layer:
|
|
7038
|
+
* ranked candidates with evidence; the user confirms or declines. Picking one
|
|
7039
|
+
* makes the import stamp each row's `as_of` from that column (see
|
|
7040
|
+
* `materializeImport`'s `asOfColumn` option) rather than one date for the file.
|
|
7041
|
+
*/
|
|
7042
|
+
|
|
7043
|
+
interface AsOfColumnCandidate {
|
|
7044
|
+
/** Entity (table) the column lives on. */
|
|
7045
|
+
entity: string;
|
|
7046
|
+
/** Normalized column name (matches an entity's {@link InferredColumn} `name`). */
|
|
7047
|
+
column: string;
|
|
7048
|
+
/** 0..1 — higher wins. */
|
|
7049
|
+
confidence: number;
|
|
7050
|
+
/** Distinct dates seen (>1 ⇒ genuinely multiple periods in one file). */
|
|
7051
|
+
distinctDates: number;
|
|
7052
|
+
/** Human-readable justification, shown next to the option. */
|
|
7053
|
+
evidence: string;
|
|
7054
|
+
}
|
|
7055
|
+
declare function detectAsOfColumns(data: Record<string, unknown>, plan: ProposedSchema): AsOfColumnCandidate[];
|
|
7056
|
+
|
|
7057
|
+
/**
|
|
7058
|
+
* Match an inferred import schema against the tables already in a workspace, so
|
|
7059
|
+
* a re-uploaded file is recognized as a NEW PERIOD of a document already
|
|
7060
|
+
* imported — not a brand-new set of tables. Each inferred entity is fingerprinted
|
|
7061
|
+
* by its column-name set and matched to the best existing table by containment
|
|
7062
|
+
* (robust to added columns + renames of a few columns). When enough of the upload
|
|
7063
|
+
* maps onto existing tables, it's a "known document": the importer can stamp it
|
|
7064
|
+
* as a dated snapshot into those tables instead of creating duplicates.
|
|
7065
|
+
*
|
|
7066
|
+
* Pure + dependency-free (takes a plain list of existing tables, not a `Lattice`)
|
|
7067
|
+
* so it's unit-testable and reusable from any door (import panel + assistant).
|
|
7068
|
+
*/
|
|
7069
|
+
|
|
7070
|
+
interface ExistingTable {
|
|
7071
|
+
name: string;
|
|
7072
|
+
columns: string[];
|
|
7073
|
+
}
|
|
7074
|
+
interface EntityMatch {
|
|
7075
|
+
/** Inferred entity name (from the new upload). */
|
|
7076
|
+
from: string;
|
|
7077
|
+
/** Existing table it matches. */
|
|
7078
|
+
to: string;
|
|
7079
|
+
/** 0..1 — share of the inferred entity's columns present in the existing table. */
|
|
7080
|
+
overlap: number;
|
|
7081
|
+
}
|
|
7082
|
+
interface SchemaMatch {
|
|
7083
|
+
/** Per-entity matches above the threshold (best existing table for each). */
|
|
7084
|
+
matches: EntityMatch[];
|
|
7085
|
+
/** Rename map (inferred name → existing table name) for names that differ. */
|
|
7086
|
+
rename: Record<string, string>;
|
|
7087
|
+
matchedCount: number;
|
|
7088
|
+
totalEntities: number;
|
|
7089
|
+
/**
|
|
7090
|
+
* True when enough of the upload maps onto existing tables to treat it as a
|
|
7091
|
+
* re-import of a document already in the workspace (i.e. a new dated snapshot).
|
|
7092
|
+
*/
|
|
7093
|
+
isKnownDocument: boolean;
|
|
7094
|
+
}
|
|
7095
|
+
/**
|
|
7096
|
+
* Match the inferred {@link ProposedSchema} against the workspace's existing
|
|
7097
|
+
* tables. `existing` should already exclude native/system tables (the caller has
|
|
7098
|
+
* the registry); junctions/dimensions are harmless — their tiny signatures won't
|
|
7099
|
+
* reach the threshold against a real data entity.
|
|
7100
|
+
*/
|
|
7101
|
+
declare function matchSchemaToExisting(existing: ExistingTable[], plan: ProposedSchema): SchemaMatch;
|
|
7102
|
+
/**
|
|
7103
|
+
* Apply a {@link SchemaMatch} rename map to a plan + its views, so materialize
|
|
7104
|
+
* writes into the matched existing tables. Names absent from the map pass through
|
|
7105
|
+
* unchanged (dimensions, unmatched entities). Linkage `toEntity` may be a
|
|
7106
|
+
* dimension; renaming only hits names in the map, so dimensions are untouched.
|
|
7107
|
+
*/
|
|
7108
|
+
declare function renameEntities(plan: ProposedSchema, views: DetectedView[], rename: Record<string, string>): {
|
|
7109
|
+
plan: ProposedSchema;
|
|
7110
|
+
views: DetectedView[];
|
|
7111
|
+
};
|
|
7112
|
+
|
|
7113
|
+
declare function excelToRecords(absPath: string): Promise<Record<string, unknown[]>>;
|
|
7114
|
+
|
|
7115
|
+
declare function dedupeAndDetectViews(plan: ProposedSchema, data: Record<string, unknown>): {
|
|
7116
|
+
plan: ProposedSchema;
|
|
7117
|
+
views: DetectedView[];
|
|
7118
|
+
};
|
|
7119
|
+
|
|
7120
|
+
export { ALL_PROVENANCE_FIELDS, type AddWorkspaceOptions, type AdoptNativeOptions, type AdoptResult, type AggregateFunction, type AggregateHaving, type AggregateOptions, type AggregateResult, type AggregateSpec, type ApplyWriteResult, type AsOfCandidate, type AsOfColumnCandidate, type AsOfInputs, type AudienceRowCtx, type AuditEvent, type AutoUpdateResult, type BacklinkSignal, type BelongsToRelation, type BelongsToSource, type BenchmarkOptions, type BenchmarkReport, type BenchmarkScale, type BlobMetadata, BoundedReadError, type BuiltinTemplateName, CLOUD_SETTING_SYSTEM_PROMPT, CLOUD_SETTING_WORKSPACE_LOGO, CLOUD_SETTING_WORKSPACE_LOGO_ETAG, CONFIG_SUBDIR, type CatalogEntity, type CatalogRecord, type ChangeEntry, type ChangelogOptions, type ChunkedMigrationOptions, type ChunkedMigrationResult, type ChunkerFn, type ClassifyMatch, type CleanupOptions, type CleanupResult, type CloudProbeResult, type CloudS3Secret, ComputedColumnCycleError, type ComputedColumnSpec, type CountOptions, type CrawlOptions, type CrawlResult, type CustomSignal, type CustomSource, DEFAULT_ENTRY_TYPES, DEFAULT_MAX_NODES, DEFAULT_TYPE_ALIASES, type DetectedView, type DiagnoseOptions, type DiscoveredTable, EMBEDDINGS_TABLE, EmbeddingDimensionMismatchError, type EmbeddingRefreshResult, EmbeddingScanTooLargeError, type EmbeddingsConfig, type EnrichOptions, type EnrichResult, type EnrichedSource, type EnrichmentLookup, type EntityContextDefinition, type EntityContextManifestEntry, type EntityFileManifestInfo, type EntityFileSource, type EntityFileSpec, type EntityMatch, type EntityProfileField, type EntityProfileSection, type EntityProfileTemplate, type EntityRenderSpec, type EntityRenderTemplate, type EntitySectionPerRow, type EntitySectionsTemplate, type EntityTableColumn, type EntityTableTemplate, type EvalQuery, type EvalRegression, type ExistingTable, type ExtensionAvailability, type ExtractEdgesSpec, type ExtractedObject, FileSourceKeyStore, type FileSourceKeyStoreOptions, type FilesRow, type Filter, type FilterAnd, type FilterExpr, type FilterOp, type FilterOr, FoldCache, type FtsConfig, type FtsGroup, type FtsHit, type FtsOptions, type FtsResult, type GraphBoostOptions, type GraphBoostResult, type GraphEdge, type GraphNode, type GraphTraversalResult, type GuiServerHandle, type HasManyRelation, type HasManySource, type HealthIssueKind, type HealthSeverity, type HybridScoreBreakdown, type HybridSearchOptions, type HybridSearchResult, type ImportMode, type ImportProgress, InMemorySourceKeyStore, InMemoryStateStore, type InferredColumn, type InferredDimension, type InferredEntity, type InferredLinkage, type InferredType, type InitOptions, LEGACY_MEMBER_GROUP, LOCAL_DB_RELPATH, type LatencyStats, Lattice, type LatticeConfig, type LatticeConfigInput, type LatticeEntityDef, type LatticeEntityRenderSpec, type LatticeFieldDef, type LatticeFieldType, type LatticeManifest, type LatticeOptions, type LinkOptions, type LlmClient, type LlmMessage, MAX_TRAVERSAL_DEPTH, type ManyToManySource, type MarkdownTableColumn, type MaterializeCtx, type MaterializeOptions, type MaterializeResult, type MaterializedRollupSpec, type MigrateResult, type Migration, type MigrationCheckpoint, type MigrationOptions, type MigrationProgress, type MigrationResult, type MigrationStatus, type MultiTableDefinition, NATIVE_ENTITY_DEFS, NATIVE_ENTITY_NAMES, NATIVE_REGISTRY_TABLE, type Observation, type OrderBySpec, type OrganizeOptions, type OrganizeResult, type OrganizedCreation, type OrganizedLink, type ParseError, type ParseResult, type ParsedConfig, type PdfOptions, type PdfSenderInput, type PerQueryEval, type PkLookup, PostgresAdapter, type PostgresAdapterOptions, type PreparedStatement, type PrimaryKey, ProgressThrottle, type ProposedSchema, type ProvenanceConfig, type ProvenanceField, ProvenanceImmutableError, type QueryOptions, type QueryPageOptions, type QueryPageResult, type QueryProjection, READ_ONLY_HEADER, ROOT_DIRNAME, type RankingOptions, type ReadOnlyHeaderOptions, type RecencySignal, type ReconcileOptions, type ReconcileResult, type RefKind, type RefProvider, type ReferenceMetadata, ReferenceUnavailableError, type RefreshEmbeddingsOptions, type Relation, type RelevanceLabel, type RemoteBlobStore, type RenderHooks, type RenderOptions, type RenderProgress, type RenderProgressCallback, type RenderProgressKind, type RenderResult, type RenderSpec, type ReportConfig, type ReportResult, type ReportSection, type ReportSectionResult, type RerankCandidate, type RerankScore, type RerankerFn, type ResolveOptions, type RetrievalEvalOptions, type RetrievalEvalSummary, type RetrievalHealthIssue, type RetrievalHealthReport, type RetrievalHealthSpec, type RetrievalSlo, type Retriever, type RetryOptions, type ReverseSeedDetection, type ReverseSeedResult, type ReverseSeedTableResult, type ReverseSyncError, type ReverseSyncResult, type ReverseSyncUpdate, type RewardScores, type RewardSignal, type RollupFunction, type Row, type RowVisibilityDefault, type S3Config, type S3StoreConfig, S3UnavailableError, S3_SECRET_TABLE, SQLiteAdapter, type SchemaEntity, type SchemaMatch, type SearchOptions, type SearchResult, type SecurityOptions, type SeedConfig, type SeedLinkSpec, SeedReconciliationError, type SeedResult, type SelfSource, type SemanticChunkerOptions, type SessionEntry, type SessionParseOptions, type SessionWriteEntry, type SessionWriteOp, type SessionWriteParseResult, type SloViolation, type SourceHandle, type SourceKeyStore, type SourceMetadata, type SourceQueryOptions, SourceShreddedError, type StartGuiServerOptions, type StopFn, type StorageAdapter, type SyncResult, TRUST_COLUMNS, type TableDefinition, type TableHealth, type TablePolicy, type TemplateRenderSpec, type TextChunk, type TraversalDirection, type TraversalNode, type TraversalOptions, type TrustConfig, type TrustState, type TurnParams, type TurnResult, type UnresolvedLink, type UpsertByNaturalKeyOptions, type UserIdentity, type UserPreferences, type VectorHit, type Viewer, type VisionOptions, type VisionSenderInput, WORKSPACES_SUBDIR, type WatchOptions, type WorkspacePaths, type WorkspaceRecord, type WorkspaceRegistry, type WriteHook, type WriteHookContext, type WritebackDefinition, type WritebackStateStore, type WritebackValidationResult, activeWorkspaceLabel, addEdge, addEdges, addWorkspace, adoptNativeEntities, allComputedDeps, analyticsEnabled, applyChunkedMigration, applyReranker, applyTokenBudget, applyWriteEntry, archiveLocalSqlite, assertSafeUrl, attachBlob, audiencePredicate, audienceViewSql, autoFtsColumns, autoUpdate, backfillOwnership, backlinkBoost, benchmarkRetrieval, buildVectorIndex, canManageRoles, checkSlos, chunkText, classifyLinks, cloudRlsInstalled, computeColumns, computedColumnDdl, computedColumnOrder, concatRowText, configDir, contentHash, cosineSimilarity, crawlUrl, createReadOnlyHeader, createS3Store, createSQLiteStateStore, decrypt, dedupeAndDetectViews, defaultWorkspaceYaml, deleteDbCredential, deleteToken, deriveCanonicalContexts, deriveKey, describeImage, describePdf, detectAsOf, detectAsOfCandidates, detectAsOfColumns, detectRetrievalRegressions, diagnoseRetrieval, discoverCloudTables, dropVectorIndex, enableAudienceView, enableChangelogRls, enableRlsForTable, encrypt, enrichKnowledge, ensureCheckpointTable, ensureEdgesTable, ensureEmbeddingsTable, ensureFtsIndex, ensureLatticeRoot, entityFileNames, estimateTokens, evaluateRetrieval, excelToRecords, extractEdgesFromColumn, extractObjects, filePresignSql, findLatticeRoot, fixSchemaConflicts, foldEntity, formatHealthReport, frontmatter, ftsTableName, fullTextSearch, generateEntryId, generateMemberPassword, generateWriteEntryId, getActiveWorkspace, getCloudSetting, getDbCredential, getMigrationCheckpoint, getOrCreateMasterKey, getTablePolicy, getWorkspace, grantPresignerToMemberGroup, graphAdjacencyBoost, hasFilePresigner, hasFtsIndex, hasVectorIndex, hashFile, hybridSearch, importLegacyUserConfig, inferFieldType, inferSchema, installCloudRls, installCloudSettings, installFilePresigner, isEncrypted, isNativeEntity, isPostgresUrl, isPrivateIp, isRetryableDbError, isRowAudience, latencyStats, listDbCredentials, listMigrationCheckpoints, listNativeBindings, listTokens, listWorkspaces, loadColumnPolicy, manifestPath, markdownTable, matchSchemaToExisting, materializeImport, memberGroupFor, memberRoleName, migrateLatticeData, neighbors, normalizeName, observationVisible, observationsFromChange, openTargetLatticeForMigration, openUnderSource, organizeSource, parseCellDate, parseConfigFile, parseConfigString, parseMarkdownEntries, parseMatches, parseObjects, parseSessionMD, parseSessionWrites, percentile, probeCloud, provenanceColumns, providerForUrl, provisionMemberRole, rankingBoost, readIdentity, readManifest, readPreferences, readRegistry, readToken, recencyBoost, referenceLocalFile, referenceUrl, refreshEmbeddings, regenerateAudienceViewFromDb, registerNativeEntities, registryPath, removeEdge, removeEmbedding, renameEntities, resolveActiveS3Config, resolveLatticeRoot, resolveProvenanceFields, resolveSource, resolveTrustDefault, resolveWorkspacePaths, resumeMigration, revertMigration, revokeMemberRole, rewardBoost, rollupColumnDdl, rootConfigDir, s3Key, saveDbCredential, saveDbCredentialForTeam, sealUnderSource, searchByEmbedding, searchVectorIndex, secureCloud, seedColumnPolicyFromYaml, semanticChunker, setActiveWorkspace, setCloudS3Secret, setCloudSetting, setColumnAudience, setRowVisibility, setTableDefaultVisibility, setTableNeverShare, shredSource, slugify, sourceRecords, startGuiServer, storeEmbedding, summarizeText, tableNeedsAudienceView, toSafeDirName, traverse, truncate, validateEntryId, vectorIndexAvailable, vectorIndexName, withRetry, workspaceBlobsDir, workspaceConfigPath, workspaceContextDir, workspaceDataDir, workspaceDbPath, workspaceDir, workspacesDir, writeIdentity, writeManifest, writePreferences, writeRegistry, writeToken };
|