UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

29 lines (28 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const dbIvm = require("@tanstack/db-ivm"); const PARENT_ROUTE_CROSS_KEY = `__tanstack_parent_route_cross__`; function crossJoinParentRoutes(input, parentKeyStream, assemble) { const rows = input.pipe( dbIvm.map(([rowKey, row]) => [PARENT_ROUTE_CROSS_KEY, [rowKey, row]]) ); const routes = parentKeyStream.pipe( dbIvm.map(([correlationKey, parentContext]) => [ PARENT_ROUTE_CROSS_KEY, [correlationKey, parentContext] ]) ); return rows.pipe( dbIvm.join(routes, `inner`), dbIvm.filter( ([, [rowSide, routeSide]]) => Boolean(rowSide != null && routeSide != null) ), dbIvm.map(([, [rowSide, routeSide]]) => { const [rowKey, row] = rowSide; const [correlationKey, parentContext] = routeSide; return assemble(rowKey, row, correlationKey, parentContext); }) ); } exports.crossJoinParentRoutes = crossJoinParentRoutes; //# sourceMappingURL=parent-routes.cjs.map