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

Function findSplitGroups

apps/sim/lib/table/workflow-columns.ts:1052–1076  ·  view source on GitHub ↗
(
  columnOrder: string[],
  groups: WorkflowGroup[]
)

Source from the content-addressed store, hash-verified

1050 * given columnOrder. Empty array means all groups are cohesive.
1051 */
1052export function findSplitGroups(
1053 columnOrder: string[],
1054 groups: WorkflowGroup[]
1055): SplitGroupReport[] {
1056 const positions = new Map<string, number>()
1057 columnOrder.forEach((name, idx) => positions.set(name, idx))
1058 const reports: SplitGroupReport[] = []
1059 for (const group of groups) {
1060 const indices = group.outputs
1061 .map((o) => positions.get(o.columnName))
1062 .filter((i): i is number => i !== undefined)
1063 .sort((a, b) => a - b)
1064 if (indices.length < 2) continue
1065 const min = indices[0]
1066 const max = indices[indices.length - 1]
1067 if (max - min + 1 !== indices.length) {
1068 reports.push({
1069 groupId: group.id,
1070 groupName: group.name ?? group.id,
1071 actual: indices,
1072 })
1073 }
1074 }
1075 return reports
1076}
1077
1078/** Throws if the schema has any invariant violations. Convenience for callers. */
1079export function assertValidSchema(schema: TableSchema, columnOrder: string[] | undefined): void {

Callers 1

validateSchemaFunction · 0.85

Calls 3

setMethod · 0.65
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected