MCPcopy Index your code
hub / github.com/simstudioai/sim / selectExportRowPage

Function selectExportRowPage

apps/sim/lib/table/jobs/service.ts:217–239  ·  view source on GitHub ↗
(
  table: TableDefinition,
  after: { orderKey: string; id: string } | null,
  limit: number
)

Source from the content-addressed store, hash-verified

215 * applies, like every user-facing read.
216 */
217export async function selectExportRowPage(
218 table: TableDefinition,
219 after: { orderKey: string; id: string } | null,
220 limit: number
221): Promise<Array<{ id: string; data: RowData; orderKey: string }>> {
222 const deleteMask = await pendingDeleteMask(table)
223 const rows = await db
224 .select({ id: userTableRows.id, data: userTableRows.data, orderKey: userTableRows.orderKey })
225 .from(userTableRows)
226 .where(
227 and(
228 eq(userTableRows.tableId, table.id),
229 eq(userTableRows.workspaceId, table.workspaceId),
230 deleteMask,
231 after
232 ? sql`(${userTableRows.orderKey}, ${userTableRows.id}) > (${after.orderKey}, ${after.id})`
233 : undefined
234 )
235 )
236 .orderBy(asc(userTableRows.orderKey), asc(userTableRows.id))
237 .limit(limit)
238 return rows as Array<{ id: string; data: RowData; orderKey: string }>
239}
240
241/** How long a terminal export stays listable (and re-downloadable from the tray). */
242const EXPORT_JOB_VISIBILITY_MS = 10 * 60 * 1000

Callers 2

materializeFunction · 0.90
runTableExportFunction · 0.90

Calls 2

pendingDeleteMaskFunction · 0.90
eqFunction · 0.50

Tested by

no test coverage detected