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

Function resolveBatchInsertOrderKeys

apps/sim/lib/table/rows/ordering.ts:311–329  ·  view source on GitHub ↗
(
  trx: DbTransaction,
  tableId: string,
  count: number,
  positions?: number[]
)

Source from the content-addressed store, hash-verified

309 * `orderKeys` (handled before this function); here we just append a run.
310 */
311export async function resolveBatchInsertOrderKeys(
312 trx: DbTransaction,
313 tableId: string,
314 count: number,
315 positions?: number[]
316): Promise<string[]> {
317 if (
318 !positions ||
319 positions.length === 0 ||
320 (await isFeatureEnabled('tables-fractional-ordering'))
321 ) {
322 return nKeysBetween(await maxOrderKey(trx, tableId), null, count)
323 }
324 const keys: string[] = []
325 for (const pos of positions) {
326 keys.push(await resolveInsertOrderKey(trx, tableId, pos))
327 }
328 return keys
329}
330
331/**
332 * Inserts a single row in its own transaction. Always assigns a fractional

Callers 1

batchInsertRowsWithTxFunction · 0.90

Calls 5

isFeatureEnabledFunction · 0.90
nKeysBetweenFunction · 0.90
maxOrderKeyFunction · 0.85
resolveInsertOrderKeyFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected