fix: Overhaul DataTableRowWithId type and include createdAt, insertedAt in getMany return (no-changelog) (#18787)

This commit is contained in:
Charlie Kolb
2025-08-26 16:16:12 +02:00
committed by GitHub
parent 46432da41b
commit af2157f384
9 changed files with 180 additions and 48 deletions

View File

@@ -72,9 +72,17 @@ export type AddDataStoreColumnOptions = Pick<DataStoreColumn, 'name' | 'type'> &
export type DataStoreColumnJsType = string | number | boolean | Date | null;
export const DATA_TABLE_SYSTEM_COLUMNS = ['id', 'createdAt', 'updatedAt'] as const;
export type DataStoreRowReturnBase = {
id: number;
createdAt: Date;
updatedAt: Date;
};
export type DataStoreRow = Record<string, DataStoreColumnJsType>;
export type DataStoreRows = DataStoreRow[];
export type DataStoreRowWithId = DataStoreRow & { id: number };
export type DataStoreRowReturn = DataStoreRow & DataStoreRowReturnBase;
export type DataStoreRowsReturn = DataStoreRowReturn[];
// APIs for a data store service operating on a specific projectId
export interface IDataStoreProjectAggregateService {
@@ -100,9 +108,11 @@ export interface IDataStoreProjectService {
getManyRowsAndCount(
dto: Partial<ListDataStoreRowsOptions>,
): Promise<{ count: number; data: DataStoreRows }>;
): Promise<{ count: number; data: DataStoreRowsReturn }>;
insertRows(rows: DataStoreRows): Promise<Array<{ id: number }>>;
insertRows(rows: DataStoreRows): Promise<DataStoreRowReturn[]>;
upsertRows(options: UpsertDataStoreRowsOptions): Promise<boolean | DataStoreRowWithId[]>;
upsertRows(options: UpsertDataStoreRowsOptions): Promise<DataStoreRowReturn[]>;
deleteRows(ids: number[]): Promise<boolean>;
}