MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / buildRegionQueryKey

Function buildRegionQueryKey

console/src/api/buildQueryKeySchema.ts:54–76  ·  view source on GitHub ↗
(scope: string, regionId?: string)

Source from the content-addressed store, hash-verified

52 *
53 */
54export function buildRegionQueryKey(scope: string, regionId?: string) {
55 const store = getStore();
56 const maybeRegionId = store.get(currentRegionIdAtomLoadable);
57 const currentRegionId =
58 maybeRegionId.state === "hasData" ? maybeRegionId.data : "no-region";
59
60 // Get the environment version if available
61 const environments = store.get(environmentsWithHealth);
62 const environment = environments?.get(regionId ?? currentRegionId);
63 const environmentVersion =
64 environment &&
65 environment.state === "enabled" &&
66 environment.status.health === "healthy"
67 ? environment.status.version.crateVersion.version
68 : undefined;
69
70 return [
71 buildQueryKeyPart(scope, {
72 regionId: regionId ?? currentRegionId,
73 environmentVersion,
74 }),
75 ] as const;
76}
77
78/**
79 * A function that takes a scope (used for identification) and returns a query key.

Callers 15

queries.tsFile · 0.90
showCreateQueryKeyFunction · 0.90
cancelQuery.tsFile · 0.90
queries.tsFile · 0.90
queries.tsFile · 0.90
queries.tsFile · 0.90
queries.tsFile · 0.90
queries.tsFile · 0.90
queries.tsFile · 0.90
queries.tsFile · 0.90

Calls 3

getStoreFunction · 0.90
buildQueryKeyPartFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected