MCPcopy Create free account
hub / github.com/TanStack/db / getUniqueIncludesRoutingKey

Function getUniqueIncludesRoutingKey

packages/db/src/query/compiler/index.ts:1872–1890  ·  view source on GitHub ↗
(
  baseKey: string,
  entries: Array<{ key?: string; fieldName?: string }>,
)

Source from the content-addressed store, hash-verified

1870}
1871
1872function getUniqueIncludesRoutingKey(
1873 baseKey: string,
1874 entries: Array<{ key?: string; fieldName?: string }>,
1875): string {
1876 const hasKey = (key: string) =>
1877 entries.some((entry) => (entry.key ?? entry.fieldName) === key)
1878
1879 if (!hasKey(baseKey)) {
1880 return baseKey
1881 }
1882
1883 let suffix = entries.length
1884 let key = `${baseKey}#${suffix}`
1885 while (hasKey(key)) {
1886 suffix++
1887 key = `${baseKey}#${suffix}`
1888 }
1889 return key
1890}
1891
1892/** Check if a value is a nested plain object in a select (not an IR expression node) */
1893function isNestedSelectObject(value: any): value is Record<string, any> {

Callers 2

compileQueryFunction · 0.85
getIncludesRoutingKeyFunction · 0.85

Calls 1

hasKeyFunction · 0.85

Tested by

no test coverage detected