MCPcopy
hub / github.com/tinyplex/tinybase / setQueryDefinition

Function setQueryDefinition

src/queries/index.ts:330–366  ·  view source on GitHub ↗
(
    queryId: Id,
    tableIdOrAsQuery: Id | true,
    tableIdOrBuild: Id | Build,
    buildOrParamValues?: Build | ParamValues,
    paramValuesIfSourceIsQuery: ParamValues = {},
  )

Source from the content-addressed store, hash-verified

328 };
329
330 const setQueryDefinition = (
331 queryId: Id,
332 tableIdOrAsQuery: Id | true,
333 tableIdOrBuild: Id | Build,
334 buildOrParamValues?: Build | ParamValues,
335 paramValuesIfSourceIsQuery: ParamValues = {},
336 ): Queries => {
337 const [tableId, build, sourceIsQuery, paramValues] = isTrue(
338 tableIdOrAsQuery,
339 )
340 ? [
341 tableIdOrBuild as Id,
342 buildOrParamValues as Build,
343 1 as const,
344 paramValuesIfSourceIsQuery,
345 ]
346 : [
347 tableIdOrAsQuery,
348 tableIdOrBuild as Build,
349 0 as const,
350 (buildOrParamValues as ParamValues | undefined) ?? {},
351 ];
352 ifNotUndefined(getQueryArgs(queryId), ([, listenerId]) =>
353 paramStore.delListener(listenerId),
354 );
355 setDefinition(queryId, tableId);
356 setQueryArgs(queryId, [
357 build,
358 paramStore.addRowListener(PARAMS_TABLE, queryId, () =>
359 setQueryDefinitionImpl(queryId),
360 ),
361 sourceIsQuery,
362 ]);
363 setOrDelParamValues(queryId, paramValues);
364 setQueryDefinitionImpl(queryId);
365 return queries;
366 };
367
368 const setQueryDefinitionImpl = (queryId: Id): Queries =>
369 getResultStore(queryId).transaction(

Callers

nothing calls this directly

Calls 6

isTrueFunction · 0.90
setQueryDefinitionImplFunction · 0.70
setOrDelParamValuesFunction · 0.70
delListenerMethod · 0.65
addRowListenerMethod · 0.65
setDefinitionFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…