@datarecce/ui 0.1.28 → 0.1.29

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.
Files changed (43) hide show
  1. package/dist/{RecceCheckContext-CiG9fGRW.mjs → RecceCheckContext-PT4-g1bW.mjs} +2 -2
  2. package/dist/{RecceCheckContext-CiG9fGRW.mjs.map → RecceCheckContext-PT4-g1bW.mjs.map} +1 -1
  3. package/dist/{RecceCheckContext-tUxygNmN.js → RecceCheckContext-fAKHgsGz.js} +2 -2
  4. package/dist/{RecceCheckContext-tUxygNmN.js.map → RecceCheckContext-fAKHgsGz.js.map} +1 -1
  5. package/dist/api.d.mts +1 -1
  6. package/dist/api.js +2 -2
  7. package/dist/api.mjs +2 -2
  8. package/dist/{components-Cvfq_6t4.js → components-B9F5oJbK.js} +4 -4
  9. package/dist/{components-Cvfq_6t4.js.map → components-B9F5oJbK.js.map} +1 -1
  10. package/dist/{components-Bt0G4cpr.mjs → components-gDC1ucjo.mjs} +4 -4
  11. package/dist/{components-Bt0G4cpr.mjs.map → components-gDC1ucjo.mjs.map} +1 -1
  12. package/dist/components.d.mts +1 -1
  13. package/dist/components.js +4 -4
  14. package/dist/components.mjs +4 -4
  15. package/dist/hooks-4hRUjy9Q.mjs +34 -0
  16. package/dist/hooks-4hRUjy9Q.mjs.map +1 -0
  17. package/dist/hooks-C2jUJ9EN.js +40 -0
  18. package/dist/hooks-C2jUJ9EN.js.map +1 -0
  19. package/dist/hooks.d.mts +1 -1
  20. package/dist/hooks.js +11 -11
  21. package/dist/hooks.mjs +3 -3
  22. package/dist/{index-OJCzYajo.d.mts → index-Bv5R8iLo.d.mts} +70 -70
  23. package/dist/{index-OJCzYajo.d.mts.map → index-Bv5R8iLo.d.mts.map} +1 -1
  24. package/dist/index-CUtFlKOo.d.ts.map +1 -1
  25. package/dist/index.d.mts +1 -1
  26. package/dist/index.js +13 -13
  27. package/dist/index.mjs +5 -5
  28. package/dist/{state-DyHCt6IJ.mjs → state-CELzQ0tM.mjs} +183 -20
  29. package/dist/state-CELzQ0tM.mjs.map +1 -0
  30. package/dist/{state-FkYREAs-.js → state-CemiRRon.js} +223 -18
  31. package/dist/state-CemiRRon.js.map +1 -0
  32. package/dist/types.d.mts +1 -1
  33. package/dist/{version-BGNaeW6k.js → version-bWg7XwOu.js} +2 -2
  34. package/dist/{version-BGNaeW6k.js.map → version-bWg7XwOu.js.map} +1 -1
  35. package/dist/{version-Dav28qEz.mjs → version-paZ9esBk.mjs} +2 -2
  36. package/dist/{version-Dav28qEz.mjs.map → version-paZ9esBk.mjs.map} +1 -1
  37. package/package.json +1 -1
  38. package/dist/hooks-BxV6qN9q.mjs +0 -233
  39. package/dist/hooks-BxV6qN9q.mjs.map +0 -1
  40. package/dist/hooks-CriUVJO1.js +0 -287
  41. package/dist/hooks-CriUVJO1.js.map +0 -1
  42. package/dist/state-DyHCt6IJ.mjs.map +0 -1
  43. package/dist/state-FkYREAs-.js.map +0 -1
package/dist/types.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
 
2
- import { Ar as isQueryBaseRun, Cr as Run, Dr as isLineageDiffRun, Er as isHistogramDiffRun, Fr as isSchemaDiffRun, G as DisableTooltipMessages, Ir as isSimpleRun, J as columnPrecisionSelectOptions, K as RECCE_SUPPORT_CALENDAR_URL, Lr as isTopKDiffRun, Mr as isQueryRun, Nr as isRowCountDiffRun, Or as isProfileDiffRun, Pr as isRowCountRun, Q as buildTitle, Rr as isValueDiffDetailRun, Sr as RowObjectType, Tr as SchemaDiffParams, U as PUBLIC_API_URL, W as PUBLIC_CLOUD_WEB_URL, X as buildDescription, Y as isSchemaChanged, Z as buildQuery, _r as ColumnType, br as RowData, gr as ColumnRenderMode, hr as AxiosQueryParams, jr as isQueryDiffRun, kr as isProfileRun, mr as RunResultViewProps, pr as RunFormProps, q as deltaPercentageString, vr as DataFrame, wr as RunParamTypes, xr as RowDataTypes, yr as LineageDiffParams, zr as isValueDiffRun } from "./index-OJCzYajo.mjs";
2
+ import { Ar as isQueryBaseRun, Cr as Run, Dr as isLineageDiffRun, Er as isHistogramDiffRun, Fr as isSchemaDiffRun, G as DisableTooltipMessages, Ir as isSimpleRun, J as columnPrecisionSelectOptions, K as RECCE_SUPPORT_CALENDAR_URL, Lr as isTopKDiffRun, Mr as isQueryRun, Nr as isRowCountDiffRun, Or as isProfileDiffRun, Pr as isRowCountRun, Q as buildTitle, Rr as isValueDiffDetailRun, Sr as RowObjectType, Tr as SchemaDiffParams, U as PUBLIC_API_URL, W as PUBLIC_CLOUD_WEB_URL, X as buildDescription, Y as isSchemaChanged, Z as buildQuery, _r as ColumnType, br as RowData, gr as ColumnRenderMode, hr as AxiosQueryParams, jr as isQueryDiffRun, kr as isProfileRun, mr as RunResultViewProps, pr as RunFormProps, q as deltaPercentageString, vr as DataFrame, wr as RunParamTypes, xr as RowDataTypes, yr as LineageDiffParams, zr as isValueDiffRun } from "./index-Bv5R8iLo.mjs";
3
3
  export { AxiosQueryParams, ColumnRenderMode, ColumnType, DataFrame, DisableTooltipMessages, LineageDiffParams, PUBLIC_API_URL, PUBLIC_CLOUD_WEB_URL, RECCE_SUPPORT_CALENDAR_URL, RowData, RowDataTypes, RowObjectType, Run, RunFormProps, RunParamTypes, RunResultViewProps, SchemaDiffParams, buildDescription, buildQuery, buildTitle, columnPrecisionSelectOptions, deltaPercentageString, isHistogramDiffRun, isLineageDiffRun, isProfileDiffRun, isProfileRun, isQueryBaseRun, isQueryDiffRun, isQueryRun, isRowCountDiffRun, isRowCountRun, isSchemaChanged, isSchemaDiffRun, isSimpleRun, isTopKDiffRun, isValueDiffDetailRun, isValueDiffRun };
@@ -1,5 +1,5 @@
1
1
  "use client"
2
- const require_state = require('./state-FkYREAs-.js');
2
+ const require_state = require('./state-CemiRRon.js');
3
3
  let react = require("react");
4
4
  let axios = require("axios");
5
5
  axios = require_state.__toESM(axios);
@@ -144,4 +144,4 @@ Object.defineProperty(exports, 'useVersionNumber', {
144
144
  return useVersionNumber;
145
145
  }
146
146
  });
147
- //# sourceMappingURL=version-BGNaeW6k.js.map
147
+ //# sourceMappingURL=version-bWg7XwOu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-BGNaeW6k.js","names":["axiosClient","axiosClient","prefix","axiosClient","axiosClient","axiosClient","useApiConfig","version","latestVersion"],"sources":["../recce-source/js/src/lib/api/schemacheck.ts","../recce-source/js/src/lib/api/select.ts","../recce-source/js/src/lib/api/sessionStorageKeys.ts","../recce-source/js/src/lib/api/localStorageKeys.ts","../recce-source/js/src/lib/api/connectToCloud.ts","../recce-source/js/src/lib/api/user.ts","../recce-source/js/src/lib/api/version.ts"],"sourcesContent":["import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\nimport { Check } from \"./checks\";\n\nexport interface SchemaDiffViewParams {\n node_id?: string | string[];\n select?: string;\n exclude?: string;\n view_mode?: \"all\" | \"changed_models\";\n packages?: string[];\n}\n\ninterface CreateSchemaDiffCheckBody {\n type: string;\n params: SchemaDiffViewParams;\n}\n\nexport async function createSchemaDiffCheck(\n params: SchemaDiffViewParams,\n client: AxiosInstance = axiosClient,\n): Promise<Check> {\n const response = await client.post<\n CreateSchemaDiffCheckBody,\n AxiosResponse<Check>\n >(\"/api/checks\", {\n type: \"schema_diff\",\n params: params,\n });\n\n return response.data;\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface SelectInput {\n select?: string;\n exclude?: string;\n packages?: string[];\n view_mode?: \"all\" | \"changed_models\";\n}\n\nexport interface SelectOutput {\n nodes: string[];\n}\n\nexport async function select(\n input: SelectInput,\n client: AxiosInstance = axiosClient,\n): Promise<SelectOutput> {\n return (\n await client.post<SelectInput, AxiosResponse<SelectOutput>>(\n `/api/select`,\n input,\n )\n ).data;\n}\n","const prefix = \"recce\";\n\nexport const sessionStorageKeys = {\n recommendationIgnored: `${prefix}-recommendation-ignored`,\n recommendationShowed: `${prefix}-recommendation-showed`,\n prevRefreshTimeStamp: `${prefix}-prev-refresh-timestamp`,\n lineageNotificationDismissed: `${prefix}-lineage-notification-dismissed`,\n};\n","const prefix = \"recce-\";\n\nexport const localStorageKeys = {\n bypassSaveOverwrite: `${prefix}-bypass-save-overwrite`,\n previewChangeFeedbackID: `${prefix}-preview-change-feedback`,\n prepareEnvGuideID: `${prefix}-prepare-env`,\n};\n","import { AxiosInstance } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface ConnectToCloud {\n connection_url: string;\n}\n\nexport async function connectToCloud(\n client: AxiosInstance = axiosClient,\n): Promise<ConnectToCloud> {\n const data = await client.post<ConnectToCloud>(\"/api/connect\");\n return data.data;\n}\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface User {\n id: string;\n login: string;\n login_type: string;\n email: string;\n onboarding_state: string;\n}\n\ninterface GitHubUser {\n login: string;\n id: number;\n avatar_url: string;\n}\n\nexport async function fetchUser(\n client: AxiosInstance = axiosClient,\n): Promise<User> {\n try {\n const response = await client.get<never, AxiosResponse<User>>(\"/api/users\");\n return response.data;\n } catch (error) {\n console.error(\"Error fetching user data:\", error);\n throw error;\n }\n}\n\nexport async function fetchGitHubAvatar(\n userId: string,\n): Promise<string | null> {\n try {\n const response = await axios.get<GitHubUser>(\n `https://api.github.com/user/${userId}`,\n );\n return response.data.avatar_url;\n } catch (error) {\n console.warn(\"Failed to fetch GitHub avatar:\", error);\n return null;\n }\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { useEffect, useState } from \"react\";\nimport { useApiConfig } from \"../hooks/ApiConfigContext\";\nimport { axiosClient } from \"./axiosClient\";\n\ninterface VersionResponse {\n version: string;\n latestVersion: string;\n}\n\nexport async function getVersion(\n client: AxiosInstance = axiosClient,\n): Promise<VersionResponse> {\n const response = await client.get<never, AxiosResponse<VersionResponse>>(\n \"/api/version\",\n );\n return response.data;\n}\n\nexport function useVersionNumber() {\n const [version, setVersion] = useState(\"\");\n const [latestVersion, setLatestVersion] = useState(\"\");\n const { apiClient } = useApiConfig();\n\n useEffect(() => {\n async function fetchVersion() {\n try {\n const { version, latestVersion } = await getVersion(apiClient);\n\n setVersion(version);\n setLatestVersion(latestVersion);\n } catch (error) {\n console.error(\"Error fetching version number:\", error);\n }\n }\n void fetchVersion();\n }, [apiClient]);\n\n return { version, latestVersion };\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,sBACpB,QACA,SAAwBA,2BACR;AAShB,SARiB,MAAM,OAAO,KAG5B,eAAe;EACf,MAAM;EACE;EACT,CAAC,EAEc;;;;;ACflB,eAAsB,OACpB,OACA,SAAwBC,2BACD;AACvB,SACE,MAAM,OAAO,KACX,eACA,MACD,EACD;;;;;ACvBJ,MAAMC,WAAS;AAEf,MAAa,qBAAqB;CAChC,uBAAuB,GAAGA,SAAO;CACjC,sBAAsB,GAAGA,SAAO;CAChC,sBAAsB,GAAGA,SAAO;CAChC,8BAA8B,GAAGA,SAAO;CACzC;;;;ACPD,MAAM,SAAS;AAEf,MAAa,mBAAmB;CAC9B,qBAAqB,GAAG,OAAO;CAC/B,yBAAyB,GAAG,OAAO;CACnC,mBAAmB,GAAG,OAAO;CAC9B;;;;ACCD,eAAsB,eACpB,SAAwBC,2BACC;AAEzB,SADa,MAAM,OAAO,KAAqB,eAAe,EAClD;;;;;ACMd,eAAsB,UACpB,SAAwBC,2BACT;AACf,KAAI;AAEF,UADiB,MAAM,OAAO,IAAgC,aAAa,EAC3D;UACT,OAAO;AACd,UAAQ,MAAM,6BAA6B,MAAM;AACjD,QAAM;;;AAIV,eAAsB,kBACpB,QACwB;AACxB,KAAI;AAIF,UAHiB,MAAM,cAAM,IAC3B,+BAA+B,SAChC,EACe,KAAK;UACd,OAAO;AACd,UAAQ,KAAK,kCAAkC,MAAM;AACrD,SAAO;;;;;;AC7BX,eAAsB,WACpB,SAAwBC,2BACE;AAI1B,SAHiB,MAAM,OAAO,IAC5B,eACD,EACe;;AAGlB,SAAgB,mBAAmB;CACjC,MAAM,CAAC,SAAS,kCAAuB,GAAG;CAC1C,MAAM,CAAC,eAAe,wCAA6B,GAAG;CACtD,MAAM,EAAE,cAAcC,4BAAc;AAEpC,4BAAgB;EACd,eAAe,eAAe;AAC5B,OAAI;IACF,MAAM,EAAE,oBAAS,mCAAkB,MAAM,WAAW,UAAU;AAE9D,eAAWC,UAAQ;AACnB,qBAAiBC,gBAAc;YACxB,OAAO;AACd,YAAQ,MAAM,kCAAkC,MAAM;;;AAG1D,EAAK,cAAc;IAClB,CAAC,UAAU,CAAC;AAEf,QAAO;EAAE;EAAS;EAAe"}
1
+ {"version":3,"file":"version-bWg7XwOu.js","names":["axiosClient","axiosClient","prefix","axiosClient","axiosClient","axiosClient","useApiConfig","version","latestVersion"],"sources":["../recce-source/js/src/lib/api/schemacheck.ts","../recce-source/js/src/lib/api/select.ts","../recce-source/js/src/lib/api/sessionStorageKeys.ts","../recce-source/js/src/lib/api/localStorageKeys.ts","../recce-source/js/src/lib/api/connectToCloud.ts","../recce-source/js/src/lib/api/user.ts","../recce-source/js/src/lib/api/version.ts"],"sourcesContent":["import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\nimport { Check } from \"./checks\";\n\nexport interface SchemaDiffViewParams {\n node_id?: string | string[];\n select?: string;\n exclude?: string;\n view_mode?: \"all\" | \"changed_models\";\n packages?: string[];\n}\n\ninterface CreateSchemaDiffCheckBody {\n type: string;\n params: SchemaDiffViewParams;\n}\n\nexport async function createSchemaDiffCheck(\n params: SchemaDiffViewParams,\n client: AxiosInstance = axiosClient,\n): Promise<Check> {\n const response = await client.post<\n CreateSchemaDiffCheckBody,\n AxiosResponse<Check>\n >(\"/api/checks\", {\n type: \"schema_diff\",\n params: params,\n });\n\n return response.data;\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface SelectInput {\n select?: string;\n exclude?: string;\n packages?: string[];\n view_mode?: \"all\" | \"changed_models\";\n}\n\nexport interface SelectOutput {\n nodes: string[];\n}\n\nexport async function select(\n input: SelectInput,\n client: AxiosInstance = axiosClient,\n): Promise<SelectOutput> {\n return (\n await client.post<SelectInput, AxiosResponse<SelectOutput>>(\n `/api/select`,\n input,\n )\n ).data;\n}\n","const prefix = \"recce\";\n\nexport const sessionStorageKeys = {\n recommendationIgnored: `${prefix}-recommendation-ignored`,\n recommendationShowed: `${prefix}-recommendation-showed`,\n prevRefreshTimeStamp: `${prefix}-prev-refresh-timestamp`,\n lineageNotificationDismissed: `${prefix}-lineage-notification-dismissed`,\n};\n","const prefix = \"recce-\";\n\nexport const localStorageKeys = {\n bypassSaveOverwrite: `${prefix}-bypass-save-overwrite`,\n previewChangeFeedbackID: `${prefix}-preview-change-feedback`,\n prepareEnvGuideID: `${prefix}-prepare-env`,\n};\n","import { AxiosInstance } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface ConnectToCloud {\n connection_url: string;\n}\n\nexport async function connectToCloud(\n client: AxiosInstance = axiosClient,\n): Promise<ConnectToCloud> {\n const data = await client.post<ConnectToCloud>(\"/api/connect\");\n return data.data;\n}\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface User {\n id: string;\n login: string;\n login_type: string;\n email: string;\n onboarding_state: string;\n}\n\ninterface GitHubUser {\n login: string;\n id: number;\n avatar_url: string;\n}\n\nexport async function fetchUser(\n client: AxiosInstance = axiosClient,\n): Promise<User> {\n try {\n const response = await client.get<never, AxiosResponse<User>>(\"/api/users\");\n return response.data;\n } catch (error) {\n console.error(\"Error fetching user data:\", error);\n throw error;\n }\n}\n\nexport async function fetchGitHubAvatar(\n userId: string,\n): Promise<string | null> {\n try {\n const response = await axios.get<GitHubUser>(\n `https://api.github.com/user/${userId}`,\n );\n return response.data.avatar_url;\n } catch (error) {\n console.warn(\"Failed to fetch GitHub avatar:\", error);\n return null;\n }\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { useEffect, useState } from \"react\";\nimport { useApiConfig } from \"../hooks/ApiConfigContext\";\nimport { axiosClient } from \"./axiosClient\";\n\ninterface VersionResponse {\n version: string;\n latestVersion: string;\n}\n\nexport async function getVersion(\n client: AxiosInstance = axiosClient,\n): Promise<VersionResponse> {\n const response = await client.get<never, AxiosResponse<VersionResponse>>(\n \"/api/version\",\n );\n return response.data;\n}\n\nexport function useVersionNumber() {\n const [version, setVersion] = useState(\"\");\n const [latestVersion, setLatestVersion] = useState(\"\");\n const { apiClient } = useApiConfig();\n\n useEffect(() => {\n async function fetchVersion() {\n try {\n const { version, latestVersion } = await getVersion(apiClient);\n\n setVersion(version);\n setLatestVersion(latestVersion);\n } catch (error) {\n console.error(\"Error fetching version number:\", error);\n }\n }\n void fetchVersion();\n }, [apiClient]);\n\n return { version, latestVersion };\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,sBACpB,QACA,SAAwBA,2BACR;AAShB,SARiB,MAAM,OAAO,KAG5B,eAAe;EACf,MAAM;EACE;EACT,CAAC,EAEc;;;;;ACflB,eAAsB,OACpB,OACA,SAAwBC,2BACD;AACvB,SACE,MAAM,OAAO,KACX,eACA,MACD,EACD;;;;;ACvBJ,MAAMC,WAAS;AAEf,MAAa,qBAAqB;CAChC,uBAAuB,GAAGA,SAAO;CACjC,sBAAsB,GAAGA,SAAO;CAChC,sBAAsB,GAAGA,SAAO;CAChC,8BAA8B,GAAGA,SAAO;CACzC;;;;ACPD,MAAM,SAAS;AAEf,MAAa,mBAAmB;CAC9B,qBAAqB,GAAG,OAAO;CAC/B,yBAAyB,GAAG,OAAO;CACnC,mBAAmB,GAAG,OAAO;CAC9B;;;;ACCD,eAAsB,eACpB,SAAwBC,2BACC;AAEzB,SADa,MAAM,OAAO,KAAqB,eAAe,EAClD;;;;;ACMd,eAAsB,UACpB,SAAwBC,2BACT;AACf,KAAI;AAEF,UADiB,MAAM,OAAO,IAAgC,aAAa,EAC3D;UACT,OAAO;AACd,UAAQ,MAAM,6BAA6B,MAAM;AACjD,QAAM;;;AAIV,eAAsB,kBACpB,QACwB;AACxB,KAAI;AAIF,UAHiB,MAAM,cAAM,IAC3B,+BAA+B,SAChC,EACe,KAAK;UACd,OAAO;AACd,UAAQ,KAAK,kCAAkC,MAAM;AACrD,SAAO;;;;;;AC7BX,eAAsB,WACpB,SAAwBC,2BACE;AAI1B,SAHiB,MAAM,OAAO,IAC5B,eACD,EACe;;AAGlB,SAAgB,mBAAmB;CACjC,MAAM,CAAC,SAAS,kCAAuB,GAAG;CAC1C,MAAM,CAAC,eAAe,wCAA6B,GAAG;CACtD,MAAM,EAAE,cAAcC,4BAAc;AAEpC,4BAAgB;EACd,eAAe,eAAe;AAC5B,OAAI;IACF,MAAM,EAAE,oBAAS,mCAAkB,MAAM,WAAW,UAAU;AAE9D,eAAWC,UAAQ;AACnB,qBAAiBC,gBAAc;YACxB,OAAO;AACd,YAAQ,MAAM,kCAAkC,MAAM;;;AAG1D,EAAK,cAAc;IAClB,CAAC,UAAU,CAAC;AAEf,QAAO;EAAE;EAAS;EAAe"}
@@ -1,5 +1,5 @@
1
1
  "use client"
2
- import { Mn as axiosClient, St as useApiConfig } from "./state-DyHCt6IJ.mjs";
2
+ import { kt as useApiConfig, zn as axiosClient } from "./state-CELzQ0tM.mjs";
3
3
  import { useEffect, useState } from "react";
4
4
  import axios, { AxiosInstance, AxiosResponse } from "axios";
5
5
 
@@ -90,4 +90,4 @@ function useVersionNumber() {
90
90
 
91
91
  //#endregion
92
92
  export { connectToCloud as a, select as c, fetchUser as i, createSchemaDiffCheck as l, useVersionNumber as n, localStorageKeys as o, fetchGitHubAvatar as r, sessionStorageKeys as s, getVersion as t };
93
- //# sourceMappingURL=version-Dav28qEz.mjs.map
93
+ //# sourceMappingURL=version-paZ9esBk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version-Dav28qEz.mjs","names":["prefix","version","latestVersion"],"sources":["../recce-source/js/src/lib/api/schemacheck.ts","../recce-source/js/src/lib/api/select.ts","../recce-source/js/src/lib/api/sessionStorageKeys.ts","../recce-source/js/src/lib/api/localStorageKeys.ts","../recce-source/js/src/lib/api/connectToCloud.ts","../recce-source/js/src/lib/api/user.ts","../recce-source/js/src/lib/api/version.ts"],"sourcesContent":["import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\nimport { Check } from \"./checks\";\n\nexport interface SchemaDiffViewParams {\n node_id?: string | string[];\n select?: string;\n exclude?: string;\n view_mode?: \"all\" | \"changed_models\";\n packages?: string[];\n}\n\ninterface CreateSchemaDiffCheckBody {\n type: string;\n params: SchemaDiffViewParams;\n}\n\nexport async function createSchemaDiffCheck(\n params: SchemaDiffViewParams,\n client: AxiosInstance = axiosClient,\n): Promise<Check> {\n const response = await client.post<\n CreateSchemaDiffCheckBody,\n AxiosResponse<Check>\n >(\"/api/checks\", {\n type: \"schema_diff\",\n params: params,\n });\n\n return response.data;\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface SelectInput {\n select?: string;\n exclude?: string;\n packages?: string[];\n view_mode?: \"all\" | \"changed_models\";\n}\n\nexport interface SelectOutput {\n nodes: string[];\n}\n\nexport async function select(\n input: SelectInput,\n client: AxiosInstance = axiosClient,\n): Promise<SelectOutput> {\n return (\n await client.post<SelectInput, AxiosResponse<SelectOutput>>(\n `/api/select`,\n input,\n )\n ).data;\n}\n","const prefix = \"recce\";\n\nexport const sessionStorageKeys = {\n recommendationIgnored: `${prefix}-recommendation-ignored`,\n recommendationShowed: `${prefix}-recommendation-showed`,\n prevRefreshTimeStamp: `${prefix}-prev-refresh-timestamp`,\n lineageNotificationDismissed: `${prefix}-lineage-notification-dismissed`,\n};\n","const prefix = \"recce-\";\n\nexport const localStorageKeys = {\n bypassSaveOverwrite: `${prefix}-bypass-save-overwrite`,\n previewChangeFeedbackID: `${prefix}-preview-change-feedback`,\n prepareEnvGuideID: `${prefix}-prepare-env`,\n};\n","import { AxiosInstance } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface ConnectToCloud {\n connection_url: string;\n}\n\nexport async function connectToCloud(\n client: AxiosInstance = axiosClient,\n): Promise<ConnectToCloud> {\n const data = await client.post<ConnectToCloud>(\"/api/connect\");\n return data.data;\n}\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface User {\n id: string;\n login: string;\n login_type: string;\n email: string;\n onboarding_state: string;\n}\n\ninterface GitHubUser {\n login: string;\n id: number;\n avatar_url: string;\n}\n\nexport async function fetchUser(\n client: AxiosInstance = axiosClient,\n): Promise<User> {\n try {\n const response = await client.get<never, AxiosResponse<User>>(\"/api/users\");\n return response.data;\n } catch (error) {\n console.error(\"Error fetching user data:\", error);\n throw error;\n }\n}\n\nexport async function fetchGitHubAvatar(\n userId: string,\n): Promise<string | null> {\n try {\n const response = await axios.get<GitHubUser>(\n `https://api.github.com/user/${userId}`,\n );\n return response.data.avatar_url;\n } catch (error) {\n console.warn(\"Failed to fetch GitHub avatar:\", error);\n return null;\n }\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { useEffect, useState } from \"react\";\nimport { useApiConfig } from \"../hooks/ApiConfigContext\";\nimport { axiosClient } from \"./axiosClient\";\n\ninterface VersionResponse {\n version: string;\n latestVersion: string;\n}\n\nexport async function getVersion(\n client: AxiosInstance = axiosClient,\n): Promise<VersionResponse> {\n const response = await client.get<never, AxiosResponse<VersionResponse>>(\n \"/api/version\",\n );\n return response.data;\n}\n\nexport function useVersionNumber() {\n const [version, setVersion] = useState(\"\");\n const [latestVersion, setLatestVersion] = useState(\"\");\n const { apiClient } = useApiConfig();\n\n useEffect(() => {\n async function fetchVersion() {\n try {\n const { version, latestVersion } = await getVersion(apiClient);\n\n setVersion(version);\n setLatestVersion(latestVersion);\n } catch (error) {\n console.error(\"Error fetching version number:\", error);\n }\n }\n void fetchVersion();\n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U;AAE9D,eAAWC,UAAQ;AACnB,qBAAiBC,gBAAc;YACxB,OAAO;AACd,YAAQ,MAAM,kCAAkC,MAAM;;;AAG1D,EAAK,cAAc;IAClB,CAAC,UAAU,CAAC;AAEf,QAAO;EAAE;EAAS;EAAe"}
1
+ {"version":3,"file":"version-paZ9esBk.mjs","names":["prefix","version","latestVersion"],"sources":["../recce-source/js/src/lib/api/schemacheck.ts","../recce-source/js/src/lib/api/select.ts","../recce-source/js/src/lib/api/sessionStorageKeys.ts","../recce-source/js/src/lib/api/localStorageKeys.ts","../recce-source/js/src/lib/api/connectToCloud.ts","../recce-source/js/src/lib/api/user.ts","../recce-source/js/src/lib/api/version.ts"],"sourcesContent":["import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\nimport { Check } from \"./checks\";\n\nexport interface SchemaDiffViewParams {\n node_id?: string | string[];\n select?: string;\n exclude?: string;\n view_mode?: \"all\" | \"changed_models\";\n packages?: string[];\n}\n\ninterface CreateSchemaDiffCheckBody {\n type: string;\n params: SchemaDiffViewParams;\n}\n\nexport async function createSchemaDiffCheck(\n params: SchemaDiffViewParams,\n client: AxiosInstance = axiosClient,\n): Promise<Check> {\n const response = await client.post<\n CreateSchemaDiffCheckBody,\n AxiosResponse<Check>\n >(\"/api/checks\", {\n type: \"schema_diff\",\n params: params,\n });\n\n return response.data;\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface SelectInput {\n select?: string;\n exclude?: string;\n packages?: string[];\n view_mode?: \"all\" | \"changed_models\";\n}\n\nexport interface SelectOutput {\n nodes: string[];\n}\n\nexport async function select(\n input: SelectInput,\n client: AxiosInstance = axiosClient,\n): Promise<SelectOutput> {\n return (\n await client.post<SelectInput, AxiosResponse<SelectOutput>>(\n `/api/select`,\n input,\n )\n ).data;\n}\n","const prefix = \"recce\";\n\nexport const sessionStorageKeys = {\n recommendationIgnored: `${prefix}-recommendation-ignored`,\n recommendationShowed: `${prefix}-recommendation-showed`,\n prevRefreshTimeStamp: `${prefix}-prev-refresh-timestamp`,\n lineageNotificationDismissed: `${prefix}-lineage-notification-dismissed`,\n};\n","const prefix = \"recce-\";\n\nexport const localStorageKeys = {\n bypassSaveOverwrite: `${prefix}-bypass-save-overwrite`,\n previewChangeFeedbackID: `${prefix}-preview-change-feedback`,\n prepareEnvGuideID: `${prefix}-prepare-env`,\n};\n","import { AxiosInstance } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface ConnectToCloud {\n connection_url: string;\n}\n\nexport async function connectToCloud(\n client: AxiosInstance = axiosClient,\n): Promise<ConnectToCloud> {\n const data = await client.post<ConnectToCloud>(\"/api/connect\");\n return data.data;\n}\n","import axios, { AxiosInstance, AxiosResponse } from \"axios\";\nimport { axiosClient } from \"./axiosClient\";\n\nexport interface User {\n id: string;\n login: string;\n login_type: string;\n email: string;\n onboarding_state: string;\n}\n\ninterface GitHubUser {\n login: string;\n id: number;\n avatar_url: string;\n}\n\nexport async function fetchUser(\n client: AxiosInstance = axiosClient,\n): Promise<User> {\n try {\n const response = await client.get<never, AxiosResponse<User>>(\"/api/users\");\n return response.data;\n } catch (error) {\n console.error(\"Error fetching user data:\", error);\n throw error;\n }\n}\n\nexport async function fetchGitHubAvatar(\n userId: string,\n): Promise<string | null> {\n try {\n const response = await axios.get<GitHubUser>(\n `https://api.github.com/user/${userId}`,\n );\n return response.data.avatar_url;\n } catch (error) {\n console.warn(\"Failed to fetch GitHub avatar:\", error);\n return null;\n }\n}\n","import { AxiosInstance, AxiosResponse } from \"axios\";\nimport { useEffect, useState } from \"react\";\nimport { useApiConfig } from \"../hooks/ApiConfigContext\";\nimport { axiosClient } from \"./axiosClient\";\n\ninterface VersionResponse {\n version: string;\n latestVersion: string;\n}\n\nexport async function getVersion(\n client: AxiosInstance = axiosClient,\n): Promise<VersionResponse> {\n const response = await client.get<never, AxiosResponse<VersionResponse>>(\n \"/api/version\",\n );\n return response.data;\n}\n\nexport function useVersionNumber() {\n const [version, setVersion] = useState(\"\");\n const [latestVersion, setLatestVersion] = useState(\"\");\n const { apiClient } = useApiConfig();\n\n useEffect(() => {\n async function fetchVersion() {\n try {\n const { version, latestVersion } = await getVersion(apiClient);\n\n setVersion(version);\n setLatestVersion(latestVersion);\n } catch (error) {\n console.error(\"Error fetching version number:\", error);\n }\n }\n void fetchVersion();\n }, [apiClient]);\n\n return { version, latestVersion };\n}\n"],"mappings":";;;;;;AAiBA,eAAsB,sBACpB,QACA,SAAwB,aACR;AAShB,SARiB,MAAM,OAAO,KAG5B,eAAe;EACf,MAAM;EACE;EACT,CAAC,EAEc;;;;;ACflB,eAAsB,OACpB,OACA,SAAwB,aACD;AACvB,SACE,MAAM,OAAO,KACX,eACA,MACD,EACD;;;;;ACvBJ,MAAMA,WAAS;AAEf,MAAa,qBAAqB;CAChC,uBAAuB,GAAGA,SAAO;CACjC,sBAAsB,GAAGA,SAAO;CAChC,sBAAsB,GAAGA,SAAO;CAChC,8BAA8B,GAAGA,SAAO;CACzC;;;;ACPD,MAAM,SAAS;AAEf,MAAa,mBAAmB;CAC9B,qBAAqB,GAAG,OAAO;CAC/B,yBAAyB,GAAG,OAAO;CACnC,mBAAmB,GAAG,OAAO;CAC9B;;;;ACCD,eAAsB,eACpB,SAAwB,aACC;AAEzB,SADa,MAAM,OAAO,KAAqB,eAAe,EAClD;;;;;ACMd,eAAsB,UACpB,SAAwB,aACT;AACf,KAAI;AAEF,UADiB,MAAM,OAAO,IAAgC,aAAa,EAC3D;UACT,OAAO;AACd,UAAQ,MAAM,6BAA6B,MAAM;AACjD,QAAM;;;AAIV,eAAsB,kBACpB,QACwB;AACxB,KAAI;AAIF,UAHiB,MAAM,MAAM,IAC3B,+BAA+B,SAChC,EACe,KAAK;UACd,OAAO;AACd,UAAQ,KAAK,kCAAkC,MAAM;AACrD,SAAO;;;;;;AC7BX,eAAsB,WACpB,SAAwB,aACE;AAI1B,SAHiB,MAAM,OAAO,IAC5B,eACD,EACe;;AAGlB,SAAgB,mBAAmB;CACjC,MAAM,CAAC,SAAS,cAAc,SAAS,GAAG;CAC1C,MAAM,CAAC,eAAe,oBAAoB,SAAS,GAAG;CACtD,MAAM,EAAE,cAAc,cAAc;AAEpC,iBAAgB;EACd,eAAe,eAAe;AAC5B,OAAI;IACF,MAAM,EAAE,oBAAS,mCAAkB,MAAM,WAAW,UAAU;AAE9D,eAAWC,UAAQ;AACnB,qBAAiBC,gBAAc;YACxB,OAAO;AACd,YAAQ,MAAM,kCAAkC,MAAM;;;AAG1D,EAAK,cAAc;IAClB,CAAC,UAAU,CAAC;AAEf,QAAO;EAAE;EAAS;EAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarecce/ui",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Recce UI Components Library - Reusable React components for data validation and review",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1,233 +0,0 @@
1
- "use client"
2
- import { F as RecceActionContextProvider, _t as RecceInstanceInfoProvider, st as LineageGraphContextProvider } from "./state-DyHCt6IJ.mjs";
3
- import { a as RecceShareStateContextProvider, c as RowCountStateContextProvider, s as RecceQueryContextProvider, t as RecceCheckContextProvider } from "./RecceCheckContext-CiG9fGRW.mjs";
4
- import React, { createContext, useCallback, useContext, useMemo } from "react";
5
- import { jsx } from "react/jsx-runtime";
6
- import { useParams, usePathname as usePathname$1, useRouter, useSearchParams } from "next/navigation";
7
-
8
- //#region recce-source/js/src/lib/hooks/RecceContextProvider.tsx
9
- /**
10
- * Main context provider for Recce application.
11
- *
12
- * For custom API configuration (e.g., recce-cloud), wrap this provider
13
- * with ApiConfigProvider:
14
- *
15
- * ```tsx
16
- * <ApiConfigProvider
17
- * apiPrefix="/api/v2/sessions/abc123"
18
- * authToken="eyJ..."
19
- * >
20
- * <RecceContextProvider>
21
- * {children}
22
- * </RecceContextProvider>
23
- * </ApiConfigProvider>
24
- * ```
25
- *
26
- * When used without ApiConfigProvider (OSS mode), hooks will use
27
- * the default axios client with standard /api/* endpoints.
28
- */
29
- function RecceContextProvider({ children }) {
30
- return /* @__PURE__ */ jsx(RecceInstanceInfoProvider, { children: /* @__PURE__ */ jsx(RecceShareStateContextProvider, { children: /* @__PURE__ */ jsx(RecceQueryContextProvider, { children: /* @__PURE__ */ jsx(LineageGraphContextProvider, { children: /* @__PURE__ */ jsx(RowCountStateContextProvider, { children: /* @__PURE__ */ jsx(RecceActionContextProvider, { children: /* @__PURE__ */ jsx(RecceCheckContextProvider, { children }) }) }) }) }) }) });
31
- }
32
-
33
- //#endregion
34
- //#region src/lib/hooks/RouteConfigContext.ts
35
- const defaultConfig = { basePath: "" };
36
- const RouteConfigContext = createContext(null);
37
- /**
38
- * Provider for route configuration.
39
- *
40
- * Wrap your application (or RecceContextProvider) with this provider
41
- * to configure path prefixes for navigation.
42
- *
43
- * @example
44
- * // In recce-cloud
45
- * <RouteConfigProvider basePath={`/oss/${sessionId}`}>
46
- * <RecceContextProvider>
47
- * {children}
48
- * </RecceContextProvider>
49
- * </RouteConfigProvider>
50
- */
51
- function RouteConfigProvider({ children, basePath = defaultConfig.basePath }) {
52
- const resolvePath = useCallback((path) => {
53
- if (!basePath) return path;
54
- if (path.startsWith(basePath)) return path;
55
- if (path.match(/^https?:\/\//)) return path;
56
- if (path.startsWith("#")) return path;
57
- return `${basePath.endsWith("/") ? basePath.slice(0, -1) : basePath}${path.startsWith("/") ? path : `/${path}`}`;
58
- }, [basePath]);
59
- const contextValue = useMemo(() => ({
60
- basePath,
61
- resolvePath
62
- }), [basePath, resolvePath]);
63
- return React.createElement(RouteConfigContext.Provider, { value: contextValue }, children);
64
- }
65
- const defaultRouteConfigContext = {
66
- basePath: "",
67
- resolvePath: (path) => path
68
- };
69
- /**
70
- * Hook to access route configuration.
71
- *
72
- * When used outside RouteConfigProvider, returns default config
73
- * (for OSS backward compatibility).
74
- *
75
- * @returns RouteConfigContextType with basePath and resolvePath function
76
- */
77
- function useRouteConfig() {
78
- return useContext(RouteConfigContext) ?? defaultRouteConfigContext;
79
- }
80
- /**
81
- * Safe hook that returns null if context not available.
82
- * Useful for components that need to detect if RouteConfigProvider is present.
83
- */
84
- function useRouteConfigSafe() {
85
- return useContext(RouteConfigContext);
86
- }
87
-
88
- //#endregion
89
- //#region src/lib/hooks/useAppRouter.ts
90
- /**
91
- * useAppRouter - Navigation utilities for Next.js App Router with RouteConfig support
92
- *
93
- * This is a custom version that wraps the OSS useAppRouter to add
94
- * RouteConfigContext support for path prefixing in recce-cloud.
95
- *
96
- * The key difference from OSS:
97
- * - setLocation() automatically prefixes paths with the configured basePath
98
- * - This allows OSS components to use setLocation("/query") while
99
- * recce-cloud can configure basePath="/oss/abc123" to get "/oss/abc123/query"
100
- */
101
- /**
102
- * Hook that provides Wouter-compatible location API using Next.js App Router
103
- * with RouteConfigContext support for path prefixing.
104
- *
105
- * NOTE: This returns only the pathname (not search params) to avoid
106
- * triggering Suspense boundaries on every navigation.
107
- *
108
- * @returns [pathname, setLocation] tuple similar to Wouter's useLocation
109
- *
110
- * @example
111
- * const [location, setLocation] = useAppLocation();
112
- * setLocation("/checks?id=123"); // In cloud mode with basePath="/oss/abc123"
113
- * // navigates to "/oss/abc123/checks?id=123"
114
- */
115
- function useAppLocation() {
116
- const router = useRouter();
117
- const pathname = usePathname$1();
118
- const { resolvePath } = useRouteConfig();
119
- return [pathname, useCallback((to, options) => {
120
- const [pathPart, queryPart] = to.split("?");
121
- const resolvedPath = resolvePath(pathPart);
122
- const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
123
- if (options?.replace) router.replace(fullPath, { scroll: options?.scroll ?? true });
124
- else router.push(fullPath, { scroll: options?.scroll ?? true });
125
- }, [router, resolvePath])];
126
- }
127
- /**
128
- * Hook that includes search params in the location string.
129
- * Also supports RouteConfigContext path prefixing.
130
- *
131
- * WARNING: This hook uses useSearchParams() which triggers Suspense.
132
- * Only use this in components that are wrapped in a <Suspense> boundary,
133
- * or in leaf components where suspension is acceptable.
134
- *
135
- * @returns [fullLocation, setLocation] tuple with search params included
136
- */
137
- function useAppLocationWithSearch() {
138
- const router = useRouter();
139
- const pathname = usePathname$1();
140
- const searchParams = useSearchParams();
141
- const { resolvePath } = useRouteConfig();
142
- return [useMemo(() => {
143
- const search = searchParams?.toString();
144
- return search ? `${pathname}?${search}` : pathname;
145
- }, [pathname, searchParams]), useCallback((to, options) => {
146
- const [pathPart, queryPart] = to.split("?");
147
- const resolvedPath = resolvePath(pathPart);
148
- const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
149
- if (options?.replace) router.replace(fullPath, { scroll: options?.scroll ?? true });
150
- else router.push(fullPath, { scroll: options?.scroll ?? true });
151
- }, [router, resolvePath])];
152
- }
153
- /**
154
- * Hook to check if current path matches a pattern
155
- * Similar to Wouter's useRoute
156
- *
157
- * @param pattern - The route pattern to match (e.g., "/checks/:checkId")
158
- * @returns [isMatch, params] tuple
159
- *
160
- * @example
161
- * const [isMatch, params] = useAppRoute("/checks/:checkId");
162
- * if (isMatch) {
163
- * console.log(params.checkId); // "abc-123"
164
- * }
165
- */
166
- function useAppRoute(pattern) {
167
- const pathname = usePathname$1();
168
- const params = useParams();
169
- return [useMemo(() => {
170
- const regexPattern = pattern.replace(/:\w+/g, "([^/]+)").replace(/\*/g, ".*");
171
- return (/* @__PURE__ */ new RegExp(`^${regexPattern}$`)).test(pathname);
172
- }, [pattern, pathname]), useMemo(() => {
173
- if (!params) return {};
174
- return Object.fromEntries(Object.entries(params).map(([key, value]) => [key, Array.isArray(value) ? value.join("/") : value]));
175
- }, [params])];
176
- }
177
- /**
178
- * Imperative navigation function for use outside React components
179
- * Use sparingly - prefer useAppLocation hook in components
180
- *
181
- * NOTE: This function does NOT support RouteConfigContext because
182
- * it's used outside of React component tree. If you need path prefixing,
183
- * use useAppLocation hook instead.
184
- *
185
- * @example
186
- * // In an event handler or utility function
187
- * import { navigateTo } from "@/lib/hooks/useAppRouter";
188
- * navigateTo("/checks?id=123");
189
- */
190
- function navigateTo(path, replace = false) {
191
- if (typeof window !== "undefined") {
192
- if (replace) window.history.replaceState(null, "", path);
193
- else window.history.pushState(null, "", path);
194
- window.dispatchEvent(new PopStateEvent("popstate"));
195
- }
196
- }
197
- /**
198
- * Hook for programmatic navigation with more options
199
- * Provides direct access to Next.js router methods with RouteConfigContext support
200
- *
201
- * NOTE: Does not include searchParams to avoid Suspense.
202
- * Use useSearchParams() directly in components that need it.
203
- */
204
- function useAppNavigation() {
205
- const router = useRouter();
206
- const pathname = usePathname$1();
207
- const params = useParams();
208
- const { resolvePath } = useRouteConfig();
209
- return {
210
- pathname,
211
- params,
212
- push: useCallback((href, options) => {
213
- const [pathPart, queryPart] = href.split("?");
214
- const resolvedPath = resolvePath(pathPart);
215
- const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
216
- router.push(fullPath, options);
217
- }, [router, resolvePath]),
218
- replace: useCallback((href, options) => {
219
- const [pathPart, queryPart] = href.split("?");
220
- const resolvedPath = resolvePath(pathPart);
221
- const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;
222
- router.replace(fullPath, options);
223
- }, [router, resolvePath]),
224
- back: router.back,
225
- forward: router.forward,
226
- refresh: router.refresh,
227
- prefetch: router.prefetch
228
- };
229
- }
230
-
231
- //#endregion
232
- export { useAppRoute as a, useRouteConfigSafe as c, useAppNavigation as i, RecceContextProvider as l, useAppLocation as n, RouteConfigProvider as o, useAppLocationWithSearch as r, useRouteConfig as s, navigateTo as t };
233
- //# sourceMappingURL=hooks-BxV6qN9q.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks-BxV6qN9q.mjs","names":["defaultConfig: RouteConfig","contextValue: RouteConfigContextType","defaultRouteConfigContext: RouteConfigContextType","usePathname"],"sources":["../recce-source/js/src/lib/hooks/RecceContextProvider.tsx","../src/lib/hooks/RouteConfigContext.ts","../src/lib/hooks/useAppRouter.ts"],"sourcesContent":["import React from \"react\";\nimport { LineageGraphContextProvider } from \"./LineageGraphContext\";\nimport { RecceActionContextProvider } from \"./RecceActionContext\";\nimport { RecceCheckContextProvider } from \"./RecceCheckContext\";\nimport { RecceInstanceInfoProvider } from \"./RecceInstanceContext\";\nimport {\n RecceQueryContextProvider,\n RowCountStateContextProvider,\n} from \"./RecceQueryContext\";\nimport { RecceShareStateContextProvider } from \"./RecceShareStateContext\";\n\ninterface RecceContextProps {\n children: React.ReactNode;\n}\n\n/**\n * Main context provider for Recce application.\n *\n * For custom API configuration (e.g., recce-cloud), wrap this provider\n * with ApiConfigProvider:\n *\n * ```tsx\n * <ApiConfigProvider\n * apiPrefix=\"/api/v2/sessions/abc123\"\n * authToken=\"eyJ...\"\n * >\n * <RecceContextProvider>\n * {children}\n * </RecceContextProvider>\n * </ApiConfigProvider>\n * ```\n *\n * When used without ApiConfigProvider (OSS mode), hooks will use\n * the default axios client with standard /api/* endpoints.\n */\nexport default function RecceContextProvider({ children }: RecceContextProps) {\n return (\n <RecceInstanceInfoProvider>\n <RecceShareStateContextProvider>\n <RecceQueryContextProvider>\n <LineageGraphContextProvider>\n <RowCountStateContextProvider>\n <RecceActionContextProvider>\n <RecceCheckContextProvider>\n {children}\n </RecceCheckContextProvider>\n </RecceActionContextProvider>\n </RowCountStateContextProvider>\n </LineageGraphContextProvider>\n </RecceQueryContextProvider>\n </RecceShareStateContextProvider>\n </RecceInstanceInfoProvider>\n );\n}\n","\"use client\";\n\nimport React, { createContext, useCallback, useContext, useMemo } from \"react\";\n\n/**\n * Route Configuration for path prefix customization.\n *\n * This context allows recce-cloud to configure a base path prefix\n * for all navigation within OSS components.\n *\n * Default behavior (OSS):\n * - basePath: \"\" (uses absolute paths like /query, /checks)\n *\n * Cloud usage example:\n * - basePath: \"/oss/abc123\" or \"/preview/abc123\"\n * - Navigation to \"/query\" becomes \"/oss/abc123/query\"\n */\n\nexport interface RouteConfig {\n /**\n * Base path prefix for navigation.\n * For OSS: \"\" (empty string, uses absolute paths like /query)\n * For Cloud: \"/oss/<sessionId>\" or \"/preview/<sessionId>\"\n */\n basePath: string;\n}\n\nexport interface RouteConfigContextType extends RouteConfig {\n /**\n * Resolves a path with the base path prefix.\n * @param path - The path to resolve (e.g., \"/query\")\n * @returns The resolved path (e.g., \"/oss/abc123/query\")\n */\n resolvePath: (path: string) => string;\n}\n\nconst defaultConfig: RouteConfig = {\n basePath: \"\",\n};\n\nconst RouteConfigContext = createContext<RouteConfigContextType | null>(null);\n\ninterface RouteConfigProviderProps extends Partial<RouteConfig> {\n children: React.ReactNode;\n}\n\n/**\n * Provider for route configuration.\n *\n * Wrap your application (or RecceContextProvider) with this provider\n * to configure path prefixes for navigation.\n *\n * @example\n * // In recce-cloud\n * <RouteConfigProvider basePath={`/oss/${sessionId}`}>\n * <RecceContextProvider>\n * {children}\n * </RecceContextProvider>\n * </RouteConfigProvider>\n */\nexport function RouteConfigProvider({\n children,\n basePath = defaultConfig.basePath,\n}: RouteConfigProviderProps) {\n const resolvePath = useCallback(\n (path: string): string => {\n // If no basePath configured, return path as-is (OSS mode)\n if (!basePath) {\n return path;\n }\n\n // Handle paths that already start with the basePath (avoid double-prefixing)\n if (path.startsWith(basePath)) {\n return path;\n }\n\n // Handle absolute URLs (http://, https://, etc.) - don't prefix\n if (path.match(/^https?:\\/\\//)) {\n return path;\n }\n\n // Handle hash-only paths - don't prefix\n if (path.startsWith(\"#\")) {\n return path;\n }\n\n // Ensure proper joining (no double slashes)\n const cleanBasePath = basePath.endsWith(\"/\")\n ? basePath.slice(0, -1)\n : basePath;\n const cleanPath = path.startsWith(\"/\") ? path : `/${path}`;\n\n return `${cleanBasePath}${cleanPath}`;\n },\n [basePath],\n );\n\n const contextValue: RouteConfigContextType = useMemo(\n () => ({\n basePath,\n resolvePath,\n }),\n [basePath, resolvePath],\n );\n\n return React.createElement(\n RouteConfigContext.Provider,\n { value: contextValue },\n children,\n );\n}\n\n// Default context for OSS mode (no prefix)\nconst defaultRouteConfigContext: RouteConfigContextType = {\n basePath: \"\",\n resolvePath: (path: string) => path,\n};\n\n/**\n * Hook to access route configuration.\n *\n * When used outside RouteConfigProvider, returns default config\n * (for OSS backward compatibility).\n *\n * @returns RouteConfigContextType with basePath and resolvePath function\n */\nexport function useRouteConfig(): RouteConfigContextType {\n const context = useContext(RouteConfigContext);\n // Return default config if outside provider (OSS mode)\n return context ?? defaultRouteConfigContext;\n}\n\n/**\n * Safe hook that returns null if context not available.\n * Useful for components that need to detect if RouteConfigProvider is present.\n */\nexport function useRouteConfigSafe(): RouteConfigContextType | null {\n return useContext(RouteConfigContext);\n}\n","/**\n * useAppRouter - Navigation utilities for Next.js App Router with RouteConfig support\n *\n * This is a custom version that wraps the OSS useAppRouter to add\n * RouteConfigContext support for path prefixing in recce-cloud.\n *\n * The key difference from OSS:\n * - setLocation() automatically prefixes paths with the configured basePath\n * - This allows OSS components to use setLocation(\"/query\") while\n * recce-cloud can configure basePath=\"/oss/abc123\" to get \"/oss/abc123/query\"\n */\n\n\"use client\";\n\nimport {\n useParams,\n usePathname,\n useRouter,\n useSearchParams,\n} from \"next/navigation\";\nimport { useCallback, useMemo } from \"react\";\nimport { useRouteConfig } from \"./RouteConfigContext\";\n\ninterface NavigateOptions {\n replace?: boolean;\n scroll?: boolean;\n}\n\n/**\n * Hook that provides Wouter-compatible location API using Next.js App Router\n * with RouteConfigContext support for path prefixing.\n *\n * NOTE: This returns only the pathname (not search params) to avoid\n * triggering Suspense boundaries on every navigation.\n *\n * @returns [pathname, setLocation] tuple similar to Wouter's useLocation\n *\n * @example\n * const [location, setLocation] = useAppLocation();\n * setLocation(\"/checks?id=123\"); // In cloud mode with basePath=\"/oss/abc123\"\n * // navigates to \"/oss/abc123/checks?id=123\"\n */\nexport function useAppLocation(): [\n string,\n (to: string, options?: NavigateOptions) => void,\n] {\n const router = useRouter();\n const pathname = usePathname();\n const { resolvePath } = useRouteConfig();\n\n // Navigation function compatible with Wouter's setLocation\n // Automatically applies basePath prefix from RouteConfigContext\n const setLocation = useCallback(\n (to: string, options?: NavigateOptions) => {\n // Separate path and query string for proper handling\n const [pathPart, queryPart] = to.split(\"?\");\n const resolvedPath = resolvePath(pathPart);\n const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;\n\n if (options?.replace) {\n router.replace(fullPath, { scroll: options?.scroll ?? true });\n } else {\n router.push(fullPath, { scroll: options?.scroll ?? true });\n }\n },\n [router, resolvePath],\n );\n\n return [pathname, setLocation];\n}\n\n/**\n * Hook that includes search params in the location string.\n * Also supports RouteConfigContext path prefixing.\n *\n * WARNING: This hook uses useSearchParams() which triggers Suspense.\n * Only use this in components that are wrapped in a <Suspense> boundary,\n * or in leaf components where suspension is acceptable.\n *\n * @returns [fullLocation, setLocation] tuple with search params included\n */\nexport function useAppLocationWithSearch(): [\n string,\n (to: string, options?: NavigateOptions) => void,\n] {\n const router = useRouter();\n const pathname = usePathname();\n const searchParams = useSearchParams();\n const { resolvePath } = useRouteConfig();\n\n // Construct full location string including search params\n const location = useMemo(() => {\n const search = searchParams?.toString();\n return search ? `${pathname}?${search}` : pathname;\n }, [pathname, searchParams]);\n\n // Navigation function with RouteConfigContext support\n const setLocation = useCallback(\n (to: string, options?: NavigateOptions) => {\n const [pathPart, queryPart] = to.split(\"?\");\n const resolvedPath = resolvePath(pathPart);\n const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;\n\n if (options?.replace) {\n router.replace(fullPath, { scroll: options?.scroll ?? true });\n } else {\n router.push(fullPath, { scroll: options?.scroll ?? true });\n }\n },\n [router, resolvePath],\n );\n\n return [location, setLocation];\n}\n\n/**\n * Hook to check if current path matches a pattern\n * Similar to Wouter's useRoute\n *\n * @param pattern - The route pattern to match (e.g., \"/checks/:checkId\")\n * @returns [isMatch, params] tuple\n *\n * @example\n * const [isMatch, params] = useAppRoute(\"/checks/:checkId\");\n * if (isMatch) {\n * console.log(params.checkId); // \"abc-123\"\n * }\n */\nexport function useAppRoute(\n pattern: string,\n): [boolean, Record<string, string>] {\n const pathname = usePathname();\n const params = useParams();\n\n const isMatch = useMemo(() => {\n // Convert Next.js dynamic route pattern to regex\n // /checks/[checkId] -> /checks/:checkId -> /checks/([^/]+)\n const regexPattern = pattern\n .replace(/:\\w+/g, \"([^/]+)\") // :param -> capture group\n .replace(/\\*/g, \".*\"); // * -> wildcard\n\n const regex = new RegExp(`^${regexPattern}$`);\n return regex.test(pathname);\n }, [pattern, pathname]);\n\n // Convert Next.js params to plain object\n const paramsObj = useMemo(() => {\n if (!params) return {};\n return Object.fromEntries(\n Object.entries(params).map(([key, value]) => [\n key,\n Array.isArray(value) ? value.join(\"/\") : value,\n ]),\n );\n }, [params]);\n\n return [isMatch, paramsObj as Record<string, string>];\n}\n\n/**\n * Imperative navigation function for use outside React components\n * Use sparingly - prefer useAppLocation hook in components\n *\n * NOTE: This function does NOT support RouteConfigContext because\n * it's used outside of React component tree. If you need path prefixing,\n * use useAppLocation hook instead.\n *\n * @example\n * // In an event handler or utility function\n * import { navigateTo } from \"@/lib/hooks/useAppRouter\";\n * navigateTo(\"/checks?id=123\");\n */\nexport function navigateTo(path: string, replace = false): void {\n if (typeof window !== \"undefined\") {\n if (replace) {\n window.history.replaceState(null, \"\", path);\n } else {\n window.history.pushState(null, \"\", path);\n }\n // Trigger Next.js to recognize the navigation\n window.dispatchEvent(new PopStateEvent(\"popstate\"));\n }\n}\n\n/**\n * Hook for programmatic navigation with more options\n * Provides direct access to Next.js router methods with RouteConfigContext support\n *\n * NOTE: Does not include searchParams to avoid Suspense.\n * Use useSearchParams() directly in components that need it.\n */\nexport function useAppNavigation() {\n const router = useRouter();\n const pathname = usePathname();\n const params = useParams();\n const { resolvePath } = useRouteConfig();\n\n // Wrap router.push and router.replace with path resolution\n const push = useCallback(\n (href: string, options?: { scroll?: boolean }) => {\n const [pathPart, queryPart] = href.split(\"?\");\n const resolvedPath = resolvePath(pathPart);\n const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;\n router.push(fullPath, options);\n },\n [router, resolvePath],\n );\n\n const replace = useCallback(\n (href: string, options?: { scroll?: boolean }) => {\n const [pathPart, queryPart] = href.split(\"?\");\n const resolvedPath = resolvePath(pathPart);\n const fullPath = queryPart ? `${resolvedPath}?${queryPart}` : resolvedPath;\n router.replace(fullPath, options);\n },\n [router, resolvePath],\n );\n\n return {\n /** Current pathname */\n pathname,\n /** Current route params */\n params: params as Record<string, string>,\n /** Navigate to a new path (with RouteConfigContext support) */\n push,\n /** Replace current history entry (with RouteConfigContext support) */\n replace,\n /** Go back in history */\n back: router.back,\n /** Go forward in history */\n forward: router.forward,\n /** Refresh the current route */\n refresh: router.refresh,\n /** Prefetch a route for faster navigation */\n prefetch: router.prefetch,\n };\n}\n\n// Re-export Next.js hooks for convenience\nexport { useRouter, usePathname, useParams, useSearchParams };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAwB,qBAAqB,EAAE,YAA+B;AAC5E,QACE,oBAAC,uCACC,oBAAC,4CACC,oBAAC,uCACC,oBAAC,yCACC,oBAAC,0CACC,oBAAC,wCACC,oBAAC,6BACE,WACyB,GACD,GACA,GACH,GACJ,GACG,GACP;;;;;ACfhC,MAAMA,gBAA6B,EACjC,UAAU,IACX;AAED,MAAM,qBAAqB,cAA6C,KAAK;;;;;;;;;;;;;;;AAoB7E,SAAgB,oBAAoB,EAClC,UACA,WAAW,cAAc,YACE;CAC3B,MAAM,cAAc,aACjB,SAAyB;AAExB,MAAI,CAAC,SACH,QAAO;AAIT,MAAI,KAAK,WAAW,SAAS,CAC3B,QAAO;AAIT,MAAI,KAAK,MAAM,eAAe,CAC5B,QAAO;AAIT,MAAI,KAAK,WAAW,IAAI,CACtB,QAAO;AAST,SAAO,GALe,SAAS,SAAS,IAAI,GACxC,SAAS,MAAM,GAAG,GAAG,GACrB,WACc,KAAK,WAAW,IAAI,GAAG,OAAO,IAAI;IAItD,CAAC,SAAS,CACX;CAED,MAAMC,eAAuC,eACpC;EACL;EAC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