feat(Data Table Node): Add bulk insert mode (no-changelog) (#19294)

This commit is contained in:
Charlie Kolb
2025-09-09 14:01:40 +02:00
committed by GitHub
parent a910604822
commit 897c69c70d
14 changed files with 383 additions and 109 deletions

View File

@@ -88,6 +88,16 @@ export type DataStoreRows = DataStoreRow[];
export type DataStoreRowReturn = DataStoreRow & DataStoreRowReturnBase;
export type DataStoreRowsReturn = DataStoreRowReturn[];
export type DataTableInsertRowsReturnType = 'all' | 'id' | 'count';
export type DataTableInsertRowsBulkResult = { success: true; insertedRows: number };
export type DataTableInsertRowsResult<
T extends DataTableInsertRowsReturnType = DataTableInsertRowsReturnType,
> = T extends 'all'
? DataStoreRowReturn[]
: T extends 'id'
? Array<Pick<DataStoreRowReturn, 'id'>>
: DataTableInsertRowsBulkResult;
// APIs for a data store service operating on a specific projectId
export interface IDataStoreProjectAggregateService {
getProjectId(): string;
@@ -116,7 +126,10 @@ export interface IDataStoreProjectService {
dto: Partial<ListDataStoreRowsOptions>,
): Promise<{ count: number; data: DataStoreRowsReturn }>;
insertRows(rows: DataStoreRows): Promise<DataStoreRowReturn[]>;
insertRows<T extends DataTableInsertRowsReturnType>(
rows: DataStoreRows,
returnType: T,
): Promise<DataTableInsertRowsResult<T>>;
updateRow(options: UpdateDataStoreRowOptions): Promise<DataStoreRowReturn[]>;