Implementa o MVP do Adaptador de Planilhas no Elo Pro.
O módulo usa a identidade Supabase, isola cada workspace e registra storage, TTL, runner e biblioteca XLSX como decisões ainda abertas. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
6e23f1533b
144 files changed
+19060
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { PREVIEW_ROWS } from "./limits";
|
||||
import { transformRows } from "./transform";
|
||||
import type { ColumnSchema, MappingInput } from "./types";
|
||||
|
||||
export type PreviewContract = {
|
||||
preview: true;
|
||||
columns: { name: string; required: boolean }[];
|
||||
rows: string[][];
|
||||
rowCount: number;
|
||||
truncated: boolean;
|
||||
};
|
||||
|
||||
export function buildPreview(
|
||||
modelColumns: ColumnSchema[],
|
||||
sourceHeaders: string[],
|
||||
dataRows: string[][],
|
||||
mappings: MappingInput[],
|
||||
): PreviewContract {
|
||||
const ordered = modelColumns.map((column) => column.name);
|
||||
const all = transformRows(ordered, sourceHeaders, dataRows, mappings);
|
||||
return {
|
||||
preview: true,
|
||||
columns: modelColumns.map((column) => ({ name: column.name, required: column.required })),
|
||||
rows: all.slice(0, PREVIEW_ROWS),
|
||||
rowCount: all.length,
|
||||
truncated: all.length > PREVIEW_ROWS,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user