@datarecce/ui 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks.d.mts +67 -2
- package/dist/hooks.d.ts +67 -2
- package/dist/hooks.js +72 -4
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +68 -4
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/hooks.d.mts
CHANGED
|
@@ -4,8 +4,8 @@ export { u as useLineageViewContext } from './LineageViewContext-DEa54ZNF.mjs';
|
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import React__default, { Dispatch, SetStateAction, ReactNode } from 'react';
|
|
6
6
|
import { J as stateMetadata, K as gitInfo, O as pullRequestInfo, M as ManifestMetadata, z as SQLMeshInfo, as as RunsAggregated, b4 as RunType, aB as AxiosQueryParams, aj as SubmitRunTrackProps } from './lineagecheck-BQaKAQzn.mjs';
|
|
7
|
+
import { AxiosInstance } from 'axios';
|
|
7
8
|
import '@xyflow/react';
|
|
8
|
-
import 'axios';
|
|
9
9
|
import 'react-icons';
|
|
10
10
|
import 'ag-grid-community';
|
|
11
11
|
import 'ag-grid-react';
|
|
@@ -229,4 +229,69 @@ declare function IdleTimeoutProvider({ children }: {
|
|
|
229
229
|
*/
|
|
230
230
|
declare function useIdleTimeout(): IdleTimeoutContextType;
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
/**
|
|
233
|
+
* API Configuration Context
|
|
234
|
+
*
|
|
235
|
+
* Provides configurable API endpoint prefix and authentication token
|
|
236
|
+
* for use with recce-cloud or other custom API backends.
|
|
237
|
+
*
|
|
238
|
+
* Default behavior (OSS):
|
|
239
|
+
* - apiPrefix: "" (uses /api/* paths directly)
|
|
240
|
+
* - authToken: undefined (no auth header)
|
|
241
|
+
*
|
|
242
|
+
* Cloud usage example:
|
|
243
|
+
* - apiPrefix: "/api/v2/sessions/abc123" (replaces /api with this prefix)
|
|
244
|
+
* - authToken: "eyJ..." (adds Authorization: Bearer header)
|
|
245
|
+
*/
|
|
246
|
+
interface ApiConfig {
|
|
247
|
+
/**
|
|
248
|
+
* API endpoint prefix to replace `/api` in all requests.
|
|
249
|
+
* For OSS: "" (empty string, uses default /api/* paths)
|
|
250
|
+
* For Cloud: "/api/v2/sessions/<session_id>" (replaces /api with this)
|
|
251
|
+
*/
|
|
252
|
+
apiPrefix: string;
|
|
253
|
+
/**
|
|
254
|
+
* Optional authentication token for API requests.
|
|
255
|
+
* When provided, adds "Authorization: Bearer <token>" header.
|
|
256
|
+
*/
|
|
257
|
+
authToken?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Optional base URL override.
|
|
260
|
+
* When provided, overrides the PUBLIC_API_URL for this context.
|
|
261
|
+
*/
|
|
262
|
+
baseUrl?: string;
|
|
263
|
+
}
|
|
264
|
+
interface ApiConfigContextType extends ApiConfig {
|
|
265
|
+
/**
|
|
266
|
+
* Pre-configured axios instance with interceptors for
|
|
267
|
+
* API prefix replacement and auth token injection.
|
|
268
|
+
*/
|
|
269
|
+
apiClient: AxiosInstance;
|
|
270
|
+
}
|
|
271
|
+
interface ApiConfigProviderProps extends Partial<ApiConfig> {
|
|
272
|
+
children: React__default.ReactNode;
|
|
273
|
+
}
|
|
274
|
+
declare function ApiConfigProvider({ children, apiPrefix, authToken, baseUrl, }: ApiConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
275
|
+
/**
|
|
276
|
+
* Hook to access the API configuration and configured axios client.
|
|
277
|
+
*
|
|
278
|
+
* When used outside ApiConfigProvider, returns default config with
|
|
279
|
+
* standard axiosClient (for OSS backward compatibility).
|
|
280
|
+
*
|
|
281
|
+
* @returns ApiConfigContextType with apiPrefix, authToken, and apiClient
|
|
282
|
+
*/
|
|
283
|
+
declare function useApiConfig(): ApiConfigContextType;
|
|
284
|
+
/**
|
|
285
|
+
* Hook to get the configured axios client.
|
|
286
|
+
* Convenience wrapper around useApiConfig().apiClient
|
|
287
|
+
*
|
|
288
|
+
* @returns AxiosInstance configured with API prefix and auth token
|
|
289
|
+
*/
|
|
290
|
+
declare function useApiClient(): AxiosInstance;
|
|
291
|
+
/**
|
|
292
|
+
* Safe version of useApiConfig that returns null if outside provider.
|
|
293
|
+
* Useful for components that need to detect if ApiConfigProvider is present.
|
|
294
|
+
*/
|
|
295
|
+
declare function useApiConfigSafe(): ApiConfigContextType | null;
|
|
296
|
+
|
|
297
|
+
export { type ApiConfig, ApiConfigProvider, IdleTimeoutProvider, LineageGraphContextProvider, RecceActionContextProvider, RecceCheckContextProvider, RecceContextProvider, RecceInstanceInfoProvider, RecceQueryContextProvider, RecceShareStateContextProvider, RowCountStateContextProvider, useApiClient, useApiConfig, useApiConfigSafe, useCheckToast, useClipBoardToast, useIdleTimeout, useLineageGraphContext, useRecceActionContext, useRecceCheckContext, useRecceInstanceContext, useRecceInstanceInfo, useRecceQueryContext, useRecceShareStateContext, useRowCountStateContext, useRunsAggregated, useValueDiffAlertDialog };
|
package/dist/hooks.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { u as useLineageViewContext } from './LineageViewContext-DPVC8ak8.js';
|
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import React__default, { Dispatch, SetStateAction, ReactNode } from 'react';
|
|
6
6
|
import { J as stateMetadata, K as gitInfo, O as pullRequestInfo, M as ManifestMetadata, z as SQLMeshInfo, as as RunsAggregated, b4 as RunType, aB as AxiosQueryParams, aj as SubmitRunTrackProps } from './lineagecheck-BQaKAQzn.js';
|
|
7
|
+
import { AxiosInstance } from 'axios';
|
|
7
8
|
import '@xyflow/react';
|
|
8
|
-
import 'axios';
|
|
9
9
|
import 'react-icons';
|
|
10
10
|
import 'ag-grid-community';
|
|
11
11
|
import 'ag-grid-react';
|
|
@@ -229,4 +229,69 @@ declare function IdleTimeoutProvider({ children }: {
|
|
|
229
229
|
*/
|
|
230
230
|
declare function useIdleTimeout(): IdleTimeoutContextType;
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
/**
|
|
233
|
+
* API Configuration Context
|
|
234
|
+
*
|
|
235
|
+
* Provides configurable API endpoint prefix and authentication token
|
|
236
|
+
* for use with recce-cloud or other custom API backends.
|
|
237
|
+
*
|
|
238
|
+
* Default behavior (OSS):
|
|
239
|
+
* - apiPrefix: "" (uses /api/* paths directly)
|
|
240
|
+
* - authToken: undefined (no auth header)
|
|
241
|
+
*
|
|
242
|
+
* Cloud usage example:
|
|
243
|
+
* - apiPrefix: "/api/v2/sessions/abc123" (replaces /api with this prefix)
|
|
244
|
+
* - authToken: "eyJ..." (adds Authorization: Bearer header)
|
|
245
|
+
*/
|
|
246
|
+
interface ApiConfig {
|
|
247
|
+
/**
|
|
248
|
+
* API endpoint prefix to replace `/api` in all requests.
|
|
249
|
+
* For OSS: "" (empty string, uses default /api/* paths)
|
|
250
|
+
* For Cloud: "/api/v2/sessions/<session_id>" (replaces /api with this)
|
|
251
|
+
*/
|
|
252
|
+
apiPrefix: string;
|
|
253
|
+
/**
|
|
254
|
+
* Optional authentication token for API requests.
|
|
255
|
+
* When provided, adds "Authorization: Bearer <token>" header.
|
|
256
|
+
*/
|
|
257
|
+
authToken?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Optional base URL override.
|
|
260
|
+
* When provided, overrides the PUBLIC_API_URL for this context.
|
|
261
|
+
*/
|
|
262
|
+
baseUrl?: string;
|
|
263
|
+
}
|
|
264
|
+
interface ApiConfigContextType extends ApiConfig {
|
|
265
|
+
/**
|
|
266
|
+
* Pre-configured axios instance with interceptors for
|
|
267
|
+
* API prefix replacement and auth token injection.
|
|
268
|
+
*/
|
|
269
|
+
apiClient: AxiosInstance;
|
|
270
|
+
}
|
|
271
|
+
interface ApiConfigProviderProps extends Partial<ApiConfig> {
|
|
272
|
+
children: React__default.ReactNode;
|
|
273
|
+
}
|
|
274
|
+
declare function ApiConfigProvider({ children, apiPrefix, authToken, baseUrl, }: ApiConfigProviderProps): react_jsx_runtime.JSX.Element;
|
|
275
|
+
/**
|
|
276
|
+
* Hook to access the API configuration and configured axios client.
|
|
277
|
+
*
|
|
278
|
+
* When used outside ApiConfigProvider, returns default config with
|
|
279
|
+
* standard axiosClient (for OSS backward compatibility).
|
|
280
|
+
*
|
|
281
|
+
* @returns ApiConfigContextType with apiPrefix, authToken, and apiClient
|
|
282
|
+
*/
|
|
283
|
+
declare function useApiConfig(): ApiConfigContextType;
|
|
284
|
+
/**
|
|
285
|
+
* Hook to get the configured axios client.
|
|
286
|
+
* Convenience wrapper around useApiConfig().apiClient
|
|
287
|
+
*
|
|
288
|
+
* @returns AxiosInstance configured with API prefix and auth token
|
|
289
|
+
*/
|
|
290
|
+
declare function useApiClient(): AxiosInstance;
|
|
291
|
+
/**
|
|
292
|
+
* Safe version of useApiConfig that returns null if outside provider.
|
|
293
|
+
* Useful for components that need to detect if ApiConfigProvider is present.
|
|
294
|
+
*/
|
|
295
|
+
declare function useApiConfigSafe(): ApiConfigContextType | null;
|
|
296
|
+
|
|
297
|
+
export { type ApiConfig, ApiConfigProvider, IdleTimeoutProvider, LineageGraphContextProvider, RecceActionContextProvider, RecceCheckContextProvider, RecceContextProvider, RecceInstanceInfoProvider, RecceQueryContextProvider, RecceShareStateContextProvider, RowCountStateContextProvider, useApiClient, useApiConfig, useApiConfigSafe, useCheckToast, useClipBoardToast, useIdleTimeout, useLineageGraphContext, useRecceActionContext, useRecceCheckContext, useRecceInstanceContext, useRecceInstanceInfo, useRecceQueryContext, useRecceShareStateContext, useRowCountStateContext, useRunsAggregated, useValueDiffAlertDialog };
|
package/dist/hooks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var reactQuery = require('@tanstack/react-query');
|
|
4
|
-
var
|
|
4
|
+
var axios2 = require('axios');
|
|
5
5
|
var React12 = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
require('@mui/material/Alert');
|
|
@@ -58,7 +58,7 @@ var Divider = require('@mui/material/Divider');
|
|
|
58
58
|
|
|
59
59
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var axios2__default = /*#__PURE__*/_interopDefault(axios2);
|
|
62
62
|
var React12__default = /*#__PURE__*/_interopDefault(React12);
|
|
63
63
|
var Stack5__default = /*#__PURE__*/_interopDefault(Stack5);
|
|
64
64
|
var Typography9__default = /*#__PURE__*/_interopDefault(Typography9);
|
|
@@ -111,7 +111,7 @@ var PUBLIC_API_URL = apiUrl;
|
|
|
111
111
|
process.env.NEXT_PUBLIC_CLOUD_WEB_URL;
|
|
112
112
|
|
|
113
113
|
// recce-source/js/src/lib/api/axiosClient.ts
|
|
114
|
-
var axiosClient =
|
|
114
|
+
var axiosClient = axios2__default.default.create({
|
|
115
115
|
baseURL: PUBLIC_API_URL
|
|
116
116
|
});
|
|
117
117
|
new reactQuery.QueryClient();
|
|
@@ -122,17 +122,81 @@ async function getRecceInstanceInfo(client = axiosClient) {
|
|
|
122
122
|
"/api/instance-info"
|
|
123
123
|
)).data;
|
|
124
124
|
}
|
|
125
|
+
var defaultConfig = {
|
|
126
|
+
apiPrefix: "",
|
|
127
|
+
authToken: void 0,
|
|
128
|
+
baseUrl: void 0
|
|
129
|
+
};
|
|
125
130
|
var ApiConfigContext = React12.createContext(null);
|
|
131
|
+
function createApiClient(config) {
|
|
132
|
+
const { apiPrefix, authToken, baseUrl } = config;
|
|
133
|
+
const client = axios2__default.default.create({
|
|
134
|
+
baseURL: baseUrl ?? PUBLIC_API_URL
|
|
135
|
+
});
|
|
136
|
+
client.interceptors.request.use(
|
|
137
|
+
(requestConfig) => {
|
|
138
|
+
try {
|
|
139
|
+
if (apiPrefix && requestConfig.url) {
|
|
140
|
+
if (requestConfig.url === "/api") {
|
|
141
|
+
requestConfig.url = apiPrefix;
|
|
142
|
+
} else if (requestConfig.url.startsWith("/api/")) {
|
|
143
|
+
requestConfig.url = apiPrefix + requestConfig.url.slice(4);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (authToken) {
|
|
147
|
+
requestConfig.headers.Authorization = `Bearer ${authToken}`;
|
|
148
|
+
}
|
|
149
|
+
return requestConfig;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.warn(
|
|
152
|
+
"API request interceptor error, proceeding with unmodified request:",
|
|
153
|
+
error
|
|
154
|
+
);
|
|
155
|
+
return requestConfig;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
(error) => {
|
|
159
|
+
return Promise.reject(error);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
return client;
|
|
163
|
+
}
|
|
164
|
+
function ApiConfigProvider({
|
|
165
|
+
children,
|
|
166
|
+
apiPrefix = defaultConfig.apiPrefix,
|
|
167
|
+
authToken = defaultConfig.authToken,
|
|
168
|
+
baseUrl = defaultConfig.baseUrl
|
|
169
|
+
}) {
|
|
170
|
+
const config = React12.useMemo(
|
|
171
|
+
() => ({ apiPrefix, authToken, baseUrl }),
|
|
172
|
+
[apiPrefix, authToken, baseUrl]
|
|
173
|
+
);
|
|
174
|
+
const apiClient = React12.useMemo(() => createApiClient(config), [config]);
|
|
175
|
+
const contextValue = React12.useMemo(
|
|
176
|
+
() => ({
|
|
177
|
+
...config,
|
|
178
|
+
apiClient
|
|
179
|
+
}),
|
|
180
|
+
[config, apiClient]
|
|
181
|
+
);
|
|
182
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ApiConfigContext.Provider, { value: contextValue, children });
|
|
183
|
+
}
|
|
126
184
|
var defaultApiConfigContext = {
|
|
127
185
|
apiPrefix: "",
|
|
128
186
|
authToken: void 0,
|
|
129
187
|
baseUrl: void 0,
|
|
130
|
-
apiClient:
|
|
188
|
+
apiClient: axios2__default.default.create({ baseURL: PUBLIC_API_URL })
|
|
131
189
|
};
|
|
132
190
|
function useApiConfig() {
|
|
133
191
|
const context = React12.useContext(ApiConfigContext);
|
|
134
192
|
return context ?? defaultApiConfigContext;
|
|
135
193
|
}
|
|
194
|
+
function useApiClient() {
|
|
195
|
+
return useApiConfig().apiClient;
|
|
196
|
+
}
|
|
197
|
+
function useApiConfigSafe() {
|
|
198
|
+
return React12.useContext(ApiConfigContext);
|
|
199
|
+
}
|
|
136
200
|
|
|
137
201
|
// recce-source/js/src/lib/hooks/useRecceInstanceInfo.tsx
|
|
138
202
|
var useRecceInstanceInfo = () => {
|
|
@@ -7488,6 +7552,7 @@ function RecceContextProvider({ children }) {
|
|
|
7488
7552
|
return /* @__PURE__ */ jsxRuntime.jsx(RecceInstanceInfoProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(RecceShareStateContextProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(RecceQueryContextProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(LineageGraphContextProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(RowCountStateContextProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(RecceActionContextProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(RecceCheckContextProvider, { children }) }) }) }) }) }) });
|
|
7489
7553
|
}
|
|
7490
7554
|
|
|
7555
|
+
exports.ApiConfigProvider = ApiConfigProvider;
|
|
7491
7556
|
exports.IdleTimeoutProvider = IdleTimeoutProvider;
|
|
7492
7557
|
exports.LineageGraphContextProvider = LineageGraphContextProvider;
|
|
7493
7558
|
exports.RecceActionContextProvider = RecceActionContextProvider;
|
|
@@ -7497,6 +7562,9 @@ exports.RecceInstanceInfoProvider = RecceInstanceInfoProvider;
|
|
|
7497
7562
|
exports.RecceQueryContextProvider = RecceQueryContextProvider;
|
|
7498
7563
|
exports.RecceShareStateContextProvider = RecceShareStateContextProvider;
|
|
7499
7564
|
exports.RowCountStateContextProvider = RowCountStateContextProvider;
|
|
7565
|
+
exports.useApiClient = useApiClient;
|
|
7566
|
+
exports.useApiConfig = useApiConfig;
|
|
7567
|
+
exports.useApiConfigSafe = useApiConfigSafe;
|
|
7500
7568
|
exports.useCheckToast = useCheckToast;
|
|
7501
7569
|
exports.useClipBoardToast = useClipBoardToast;
|
|
7502
7570
|
exports.useIdleTimeout = useIdleTimeout;
|