Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Move query-endpoints into querying (#79564)

Fraser59646dd4b080
diff --git a/frontend/src/metabase/api/index.ts b/frontend/src/metabase/api/index.ts
index 1cf824e18ac..b7e5967479e 100644
--- a/frontend/src/metabase/api/index.ts
+++ b/frontend/src/metabase/api/index.ts
@@ -34,7 +34,6 @@ export * from "./persist";
export * from "./premium-features";
export * from "./public";
export * from "./pulse";
-export * from "./query-endpoints";
export * from "./revision";
export * from "./search";
export * from "./security-center";
diff --git a/frontend/src/metabase/dashboard/actions/data-fetching.ts b/frontend/src/metabase/dashboard/actions/data-fetching.ts
index 7dca4c6f152..3ad6d6ec1b3 100644
--- a/frontend/src/metabase/dashboard/actions/data-fetching.ts
+++ b/frontend/src/metabase/dashboard/actions/data-fetching.ts
@@ -9,7 +9,6 @@ import {
cardApi,
dashboardApi,
embedApi,
- makePivotAwareQueryRunner,
publicApi,
} from "metabase/api";
import { isAbortError } from "metabase/api/client";
@@ -35,6 +34,7 @@ import {
} from "metabase/dashboard/utils";
import { getSavedDashboardUiParameters } from "metabase/parameters/utils/dashboards";
import { getParameterValuesByIdFromQueryParams } from "metabase/parameters/utils/parameter-parsing";
+import { makePivotAwareQueryRunner } from "metabase/querying/api/query-endpoints";
import { runAdhocDatasetQuery } from "metabase/querying/run-query";
import { updateMetadata } from "metabase/redux/metadata";
import type { Dispatch, GetState } from "metabase/redux/store";
diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx
index b8f9c6d7e3e..b62ee799efe 100644
--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx
+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from "react";
import { useLatest, useMount } from "react-use";
-import { embedApi, makePivotAwareQueryRunner, publicApi } from "metabase/api";
+import { embedApi, publicApi } from "metabase/api";
import { runRtkEndpoint } from "metabase/api/utils/run-rtk-endpoint";
import { applyParameters } from "metabase/common/utils/card";
import { fetchDataOrError } from "metabase/dashboard/utils";
@@ -11,6 +11,7 @@ import { getParameterValuesByIdFromQueryParams } from "metabase/parameters/utils
import { useEmbedFrameOptions } from "metabase/public/hooks";
import { usePublicEndpoints } from "metabase/public/hooks/use-public-endpoints";
import { useSetEmbedFont } from "metabase/public/hooks/use-set-embed-font";
+import { makePivotAwareQueryRunner } from "metabase/querying/api/query-endpoints";
import { useDispatch, useSelector } from "metabase/redux";
import { setErrorPage } from "metabase/redux/app";
import { updateMetadata } from "metabase/redux/metadata";
diff --git a/frontend/src/metabase/api/query-endpoints.ts b/frontend/src/metabase/querying/api/query-endpoints.ts
similarity index 97%
rename from frontend/src/metabase/api/query-endpoints.ts
rename to frontend/src/metabase/querying/api/query-endpoints.ts
index 7ea235b6670..afe03be915f 100644
--- a/frontend/src/metabase/api/query-endpoints.ts
+++ b/frontend/src/metabase/querying/api/query-endpoints.ts
@@ -1,14 +1,10 @@
+import { cardApi, dashboardApi, embedApi, publicApi } from "metabase/api";
import { isNative } from "metabase/common/utils/card";
import type { Dispatch } from "metabase/redux/store";
import Question from "metabase-lib/v1/Question";
import type Metadata from "metabase-lib/v1/metadata/Metadata";
import type { Card, Dataset } from "metabase-types/api";
-import { cardApi } from "./card";
-import { dashboardApi } from "./dashboard";
-import { embedApi } from "./embed";
-import { publicApi } from "./public";
-
// Minimal structural view of an RTK Query endpoint. We only ever dispatch
// `.initiate(...)`, so this is all the runner and pivot map need. Declared as a
// method (not an arrow property) so RTK's concrete endpoints stay assignable.
diff --git a/frontend/src/metabase/querying/run-query.ts b/frontend/src/metabase/querying/run-query.ts
index bce98e09f2c..ec7afa294b9 100644
--- a/frontend/src/metabase/querying/run-query.ts
+++ b/frontend/src/metabase/querying/run-query.ts
@@ -2,11 +2,6 @@ import { RTK_CACHE_KEY_PARAM } from "metabase/api/api";
import { cardApi } from "metabase/api/card";
import { dashboardApi } from "metabase/api/dashboard";
import { datasetApi } from "metabase/api/dataset";
-import {
- dispatchQueryEndpoint,
- makePivotAwareQueryRunner,
- shouldUsePivotEndpoint,
-} from "metabase/api/query-endpoints";
import type { Dispatch } from "metabase/redux/store";
import Question from "metabase-lib/v1/Question";
import type Metadata from "metabase-lib/v1/metadata/Metadata";
@@ -20,6 +15,12 @@ import type {
DatasetQuery,
} from "metabase-types/api";
+import {
+ dispatchQueryEndpoint,
+ makePivotAwareQueryRunner,
+ shouldUsePivotEndpoint,
+} from "./api/query-endpoints";
+
type RunQuestionQueryOptions = {
dispatch: Dispatch;
signal?: AbortSignal;