1- import isObject from './is-object.js' ;
2- import normalizeKey from './normalize-key.js' ;
3- import normalizeRoot from './normalize-root.js' ;
1+ /** @import {Query} from '#src/index.js' */
2+
3+ import { isObject } from '#src/is-object.js' ;
4+ import { normalizeKey } from '#src/normalize-key.js' ;
5+ import { normalizeRoot } from '#src/normalize-root.js' ;
46
57const { isArray } = Array ;
68
9+ /**
10+ * @param {{ cache: { [K: string]: any }; query: Query; value: any } } options
11+ * @returns {any }
12+ */
713const walk = ( { cache, query, value } ) => {
814 while ( true ) {
915 if ( isArray ( value ) ) {
@@ -25,10 +31,10 @@ const walk = ({ cache, query, value }) => {
2531 continue ;
2632 }
2733
28- // eslint-disable-next-line no-unused-vars
34+ // eslint-disable-next-line @typescript-eslint/ no-unused-vars
2935 let { _, $, ..._query } = query ;
3036 _query = _query [ `_on_${ value . _type } ` ] ?? _query ;
31- const data = { } ;
37+ const data = /** @type { typeof _query } */ ( { } ) ;
3238 for ( const alias in _query ) {
3339 if ( alias . startsWith ( '_on_' ) ) continue ;
3440
@@ -43,5 +49,6 @@ const walk = ({ cache, query, value }) => {
4349 }
4450} ;
4551
46- export default ( { cache, key, query } ) =>
52+ /** @param {{ cache: { [K: string]: any }; key?: string; query: Query } } options */
53+ export const cacheExecute = ( { cache, key, query } ) =>
4754 walk ( { cache, query, value : cache [ key ?? normalizeRoot ( { query } ) ] } ) ;
0 commit comments