@tanstack/db
Version:
A reactive client store for building super fast apps on sync
1 lines • 20.7 kB
Source Map (JSON)
{"version":3,"file":"ref-proxy.cjs","names":["REF_PROXY_BRAND","PropRef","Value","readRefProxyBrand","getWrapperExpressionName","codedMessage","isBasicOrAggregateExpression"],"sources":["../../../../src/query/builder/ref-proxy.ts"],"sourcesContent":["import { PropRef, Value, isBasicOrAggregateExpression } from '../ir.js'\nimport { codedMessage, devBuild } from '../../error-message.js'\nimport { REF_PROXY_BRAND, readRefProxyBrand } from './ref-proxy-identity.js'\nimport { getWrapperExpressionName } from './wrapper-identity.js'\nimport type { BasicExpression } from '../ir.js'\nimport type { IsPlainObject, RefLeaf } from './types.js'\nimport type { VirtualRowProps } from '../../virtual-props.js'\n\nexport { isRefProxy } from './ref-proxy-identity.js'\n\n// A captured proxy and a local proxy can be spread into the same select\n// object. Their temporary keys must stay distinct until buildNestedSelect\n// gives them deterministic per-object positions.\nlet nextSpreadSentinelId = 0\n\nexport interface RefProxy<T = any> {\n /** @internal */\n readonly __refProxy: true\n /** @internal */\n readonly __path: Array<string>\n /** @internal */\n readonly __sourceAlias?: string\n /** @internal */\n readonly __bindingId?: string\n /** @internal */\n readonly __type: T\n}\n\n/**\n * Virtual properties available on all row ref proxies.\n * These allow querying on sync status, origin, key, and collection ID.\n */\nexport type VirtualPropsRefProxy<\n TKey extends string | number = string | number,\n> = {\n readonly [K in keyof VirtualRowProps<TKey>]: RefLeaf<VirtualRowProps<TKey>[K]>\n}\n\n// Strip nullish members before deciding whether a schema field is traversable,\n// then restore them outside the proxy so the schema still requires a guard.\n// The tuple guard keeps exact null/undefined fields as leaves: `never` would\n// otherwise satisfy the plain-object check.\ntype SingleRowField<V, TKey extends string | number> = [\n NonNullable<V>,\n] extends [never]\n ? RefLeaf<V>\n : IsPlainObject<NonNullable<V>> extends true\n ? | SingleRowRefProxy<NonNullable<V>, TKey, false>\n | Extract<V, null | undefined>\n : RefLeaf<V>\n\n/**\n * Type for creating a RefProxy for a single row/type without namespacing\n * Used in collection indexes and where clauses\n *\n * Inferred row roots include virtual properties ($hasPendingWrites, $origin,\n * $key, $collectionId). The default exported shape is suitable for reusable helpers\n * that can accept either roots or recursively traversed user objects. Use the\n * third parameter as `true` when a helper specifically requires a row root.\n */\nexport type SingleRowRefProxy<\n T,\n TKey extends string | number = string | number,\n IncludeVirtualProps extends boolean = false,\n> =\n T extends Record<string, any>\n ? {\n [K in keyof T]: SingleRowField<T[K], TKey>\n } & RefProxy<T> &\n (IncludeVirtualProps extends true ? VirtualPropsRefProxy<TKey> : {})\n : RefProxy<T> &\n (IncludeVirtualProps extends true ? VirtualPropsRefProxy<TKey> : {})\n\n/**\n * Creates a proxy object that records property access paths for a single row\n * Used in collection indexes and where clauses\n */\nexport function createSingleRowRefProxy<\n T extends Record<string, any>,\n TKey extends string | number = string | number,\n>(): SingleRowRefProxy<T, TKey, true> {\n const cache = new Map<string, any>()\n\n function createProxy(path: Array<string>): any {\n const pathKey = JSON.stringify(path)\n if (cache.has(pathKey)) {\n return cache.get(pathKey)\n }\n\n const proxy = new Proxy({} as any, {\n get(target, prop, receiver) {\n if (prop === `__refProxy`) return true\n if (prop === `__path`) return path\n if (prop === `__sourceAlias`) return undefined\n if (prop === `__bindingId`) return undefined\n if (prop === `__type`) return undefined // Type is only for TypeScript inference\n if (prop === REF_PROXY_BRAND) return true\n if (typeof prop === `symbol`) return Reflect.get(target, prop, receiver)\n\n const newPath = [...path, String(prop)]\n return createProxy(newPath)\n },\n\n has(target, prop) {\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n )\n return true\n return Reflect.has(target, prop)\n },\n\n ownKeys(target) {\n return Reflect.ownKeys(target)\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n ) {\n return { enumerable: false, configurable: true }\n }\n return Reflect.getOwnPropertyDescriptor(target, prop)\n },\n })\n cache.set(pathKey, proxy)\n return proxy\n }\n\n // Return the root proxy that starts with an empty path\n return createProxy([]) as SingleRowRefProxy<T, TKey, true>\n}\n\n/**\n * Creates a proxy object that records property access paths\n * Used in callbacks like where, select, etc. to create type-safe references\n */\nexport function createRefProxy<T extends Record<string, any>>(\n aliases: Array<string>,\n bindings?: ReadonlyMap<string, string>,\n): RefProxy<T> & T {\n // Each path has one proxy, cached by its parent under the property name.\n const aliasProxies = new Map<string, any>()\n\n function createProxy(path: Array<string>): any {\n let children: Map<string, any> | undefined\n let spreadSentinel: { key: string; ref: PropRef } | undefined\n const proxy = new Proxy({} as any, {\n get(target, prop, receiver) {\n if (prop === `__refProxy`) return true\n if (prop === `__path`) return path\n if (prop === `__sourceAlias`) return path[0]\n if (prop === `__bindingId`) return bindings?.get(path[0] ?? ``)\n if (prop === `__type`) return undefined // Type is only for TypeScript inference\n // Answers with the path so toExpression reads it in one trap.\n if (prop === REF_PROXY_BRAND) return path\n if (typeof prop === `symbol`) return Reflect.get(target, prop, receiver)\n if (prop === spreadSentinel?.key) return spreadSentinel.ref\n if (Object.prototype.hasOwnProperty.call(target, prop)) {\n return Reflect.get(target, prop, receiver)\n }\n\n children ??= new Map()\n let child = children.get(prop)\n if (child === undefined) {\n child = createProxy([...path, prop])\n children.set(prop, child)\n }\n return child\n },\n\n has(target, prop) {\n if (prop === spreadSentinel?.key) return true\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n )\n return true\n return Reflect.has(target, prop)\n },\n\n ownKeys(target) {\n const id = ++nextSpreadSentinelId\n const sentinelKey = `__SPREAD_SENTINEL__${path.join(`.`)}__${id}`\n // One enumeration contributes one marker. Retaining older markers on\n // the proxy would make later spreads depend on earlier discarded ones.\n spreadSentinel = {\n key: sentinelKey,\n ref: new PropRef(path, path[0], bindings?.get(path[0] ?? ``)),\n }\n return [...Reflect.ownKeys(target), sentinelKey]\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (prop === spreadSentinel?.key) {\n return {\n enumerable: true,\n configurable: true,\n value: spreadSentinel.ref,\n }\n }\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n ) {\n return { enumerable: false, configurable: true }\n }\n return Reflect.getOwnPropertyDescriptor(target, prop)\n },\n })\n return proxy\n }\n\n // Create the root proxy with all aliases as top-level properties\n const rootProxy = new Proxy({} as any, {\n get(target, prop, receiver) {\n if (prop === `__refProxy`) return true\n if (prop === `__path`) return []\n if (prop === `__sourceAlias`) return undefined\n if (prop === `__bindingId`) return undefined\n if (prop === `__type`) return undefined // Type is only for TypeScript inference\n if (prop === REF_PROXY_BRAND) return true\n if (typeof prop === `symbol`) return Reflect.get(target, prop, receiver)\n\n const propStr = String(prop)\n if (aliases.includes(propStr) || aliases.includes(`*`)) {\n let proxy = aliasProxies.get(propStr)\n if (proxy === undefined) {\n proxy = createProxy([propStr])\n aliasProxies.set(propStr, proxy)\n }\n return proxy\n }\n\n return undefined\n },\n\n has(target, prop) {\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n )\n return true\n if (typeof prop === `string` && aliases.includes(prop)) return true\n return Reflect.has(target, prop)\n },\n\n ownKeys(_target) {\n return [\n ...aliases,\n `__refProxy`,\n `__path`,\n `__sourceAlias`,\n `__bindingId`,\n `__type`,\n ]\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n ) {\n return { enumerable: false, configurable: true }\n }\n if (typeof prop === `string` && aliases.includes(prop)) {\n return { enumerable: true, configurable: true }\n }\n return undefined\n },\n })\n return rootProxy\n}\n\n/**\n * Creates a ref proxy with $selected namespace for SELECT fields\n *\n * Adds a $selected property that allows accessing SELECT fields via $selected.fieldName syntax.\n * The $selected proxy creates paths like ['$selected', 'fieldName'] which directly reference\n * the $selected property on the namespaced row.\n *\n * @param aliases - Array of table aliases to create proxies for\n * @returns A ref proxy with table aliases and $selected namespace\n */\nexport function createRefProxyWithSelected<T extends Record<string, any>>(\n aliases: Array<string>,\n bindings?: ReadonlyMap<string, string>,\n): RefProxy<T> &\n T & { $selected: SingleRowRefProxy<any, string | number, true> } {\n const baseProxy = createRefProxy(aliases, bindings)\n\n // Create a proxy for $selected that prefixes all paths with '$selected'\n const cache = new Map<string, any>()\n\n function createSelectedProxy(path: Array<string>): any {\n const pathKey = JSON.stringify(path)\n if (cache.has(pathKey)) {\n return cache.get(pathKey)\n }\n\n const proxy = new Proxy({} as any, {\n get(target, prop, receiver) {\n if (prop === `__refProxy`) return true\n if (prop === `__path`) return [`$selected`, ...path]\n if (prop === `__sourceAlias`) return `$selected`\n if (prop === `__bindingId`) return undefined\n if (prop === `__type`) return undefined\n if (prop === REF_PROXY_BRAND) return true\n if (typeof prop === `symbol`) return Reflect.get(target, prop, receiver)\n\n const newPath = [...path, String(prop)]\n return createSelectedProxy(newPath)\n },\n\n has(target, prop) {\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n )\n return true\n return Reflect.has(target, prop)\n },\n\n ownKeys(target) {\n return Reflect.ownKeys(target)\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (\n prop === `__refProxy` ||\n prop === `__path` ||\n prop === `__sourceAlias` ||\n prop === `__bindingId` ||\n prop === `__type`\n ) {\n return { enumerable: false, configurable: true }\n }\n return Reflect.getOwnPropertyDescriptor(target, prop)\n },\n })\n cache.set(pathKey, proxy)\n return proxy\n }\n\n const wrappedSelectedProxy = createSelectedProxy([])\n\n // Wrap the base proxy to also handle $selected access\n const selectedRootProxy = new Proxy(baseProxy, {\n get(target, prop, receiver) {\n if (prop === `$selected`) {\n return wrappedSelectedProxy\n }\n return Reflect.get(target, prop, receiver)\n },\n\n has(target, prop) {\n if (prop === `$selected`) return true\n return Reflect.has(target, prop)\n },\n\n ownKeys(target) {\n return [...Reflect.ownKeys(target), `$selected`]\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (prop === `$selected`) {\n return {\n enumerable: true,\n configurable: true,\n value: wrappedSelectedProxy,\n }\n }\n return Reflect.getOwnPropertyDescriptor(target, prop)\n },\n }) as RefProxy<T> &\n T & {\n $selected: SingleRowRefProxy<any, string | number, true>\n }\n return selectedRootProxy\n}\n\n/**\n * Converts a value to an Expression.\n * If it's a RefProxy, creates a PropRef. Throws if the value is a\n * ToArrayWrapper, ConcatToArrayWrapper, CaseWhenWrapper, or MaterializeWrapper\n * (these must be used as direct select fields). Otherwise wraps it as a Value.\n */\nexport function toExpression<T = any>(value: T): BasicExpression<T>\nexport function toExpression(value: RefProxy<any>): BasicExpression<any>\nexport function toExpression(value: any): BasicExpression<any> {\n // A primitive cannot be a ref proxy, a wrapper, or an expression.\n if (\n value === null ||\n (typeof value !== `object` && typeof value !== `function`)\n ) {\n return new Value(value)\n }\n const brand = readRefProxyBrand(value)\n if (brand !== undefined) {\n // An alias-qualified ref proxy answers the brand with its path.\n return Array.isArray(brand)\n ? new PropRef(brand, brand[0], value.__bindingId)\n : new PropRef(value.__path, value.__sourceAlias, value.__bindingId)\n }\n // toArray(), concat(toArray()), and materialize() must be used as direct\n // select fields, not inside expressions\n const name = getWrapperExpressionName(value)\n if (name) {\n throw new Error(\n devBuild() && process.env.NODE_ENV !== `production`\n ? `${name} cannot be used inside expressions (e.g., coalesce(), eq(), not()). ` +\n `Use ${name} directly as a select field value instead.`\n : codedMessage(126, { name }),\n )\n }\n // Only constructed expressions are IR; user values may have the same fields.\n if (isBasicOrAggregateExpression(value)) {\n return value as BasicExpression\n }\n return new Value(value)\n}\n\n/**\n * Helper to create a Value expression from a literal\n */\nexport function val<T>(value: T): BasicExpression<T> {\n return new Value(value)\n}\n"],"mappings":";;;;A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