@gen3/frontend 0.12.4 → 0.12.5
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/.swcrc +24 -0
- package/__mocks__/createWebStorageMock.js +10 -0
- package/dist/dts/components/HeaderTitle.d.ts +5 -0
- package/dist/dts/components/HeaderTitle.d.ts.map +1 -0
- package/dist/dts/components/HeaderTitle.js +8 -0
- package/dist/dts/components/HeaderTitle.js.map +1 -0
- package/dist/dts/components/HeaderTitle.stories.d.ts +13 -0
- package/dist/dts/components/HeaderTitle.stories.d.ts.map +1 -0
- package/dist/dts/components/HeaderTitle.stories.js +27 -0
- package/dist/dts/components/HeaderTitle.stories.js.map +1 -0
- package/dist/dts/components/Providers/Gen3Provider.d.ts +2 -2
- package/dist/dts/components/SegmentedControl.stories.d.ts +15 -15
- package/dist/dts/components/charts/echarts/BarChart.js.map +1 -1
- package/dist/dts/exports/app.d.ts +14 -0
- package/dist/dts/exports/app.d.ts.map +1 -0
- package/dist/dts/exports/app.js +9 -0
- package/dist/dts/exports/app.js.map +1 -0
- package/dist/dts/exports/content.d.ts +7 -0
- package/dist/dts/exports/content.d.ts.map +1 -0
- package/dist/dts/exports/content.js +5 -0
- package/dist/dts/exports/content.js.map +1 -0
- package/dist/dts/exports/explorerRenderers.d.ts +7 -0
- package/dist/dts/exports/explorerRenderers.d.ts.map +1 -0
- package/dist/dts/exports/explorerRenderers.js +5 -0
- package/dist/dts/exports/explorerRenderers.js.map +1 -0
- package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +2 -2
- package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/CohortBuilder.js +1 -1
- package/dist/dts/features/CohortBuilder/CohortBuilder.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpression.d.ts +2 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpression.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpression.js +6 -5
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpression.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionContext.d.ts +3 -2
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionContext.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionContext.js +5 -4
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionContext.js.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryRepresentation.d.ts +3 -3
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryRepresentation.d.ts.map +1 -1
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryRepresentation.js +53 -34
- package/dist/dts/features/CohortBuilder/QueryExpression/QueryRepresentation.js.map +1 -1
- package/dist/dts/features/Discovery/DiscoveryTable.d.ts.map +1 -1
- package/dist/dts/features/Discovery/DiscoveryTable.js +4 -2
- package/dist/dts/features/Discovery/DiscoveryTable.js.map +1 -1
- package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.d.ts.map +1 -1
- package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js +1 -1
- package/dist/dts/features/Discovery/TableRenderers/DataAccessCellRenderers.js.map +1 -1
- package/dist/dts/features/Profile/Profile.d.ts.map +1 -1
- package/dist/dts/features/Profile/Profile.js +1 -1
- package/dist/dts/features/Profile/Profile.js.map +1 -1
- package/dist/dts/index.d.ts +19 -21
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.js +20 -22
- package/dist/dts/index.js.map +1 -1
- package/dist/dts/lib/content/index.d.ts +1 -0
- package/dist/dts/lib/content/index.d.ts.map +1 -1
- package/dist/dts/lib/content/index.js +4 -0
- package/dist/dts/lib/content/index.js.map +1 -1
- package/dist/dts/pages/403/index.d.ts +2 -1
- package/dist/dts/pages/403/index.d.ts.map +1 -1
- package/dist/dts/pages/403/index.js +2 -1
- package/dist/dts/pages/403/index.js.map +1 -1
- package/dist/dts/pages/404/index.d.ts +2 -1
- package/dist/dts/pages/404/index.d.ts.map +1 -1
- package/dist/dts/pages/404/index.js +2 -1
- package/dist/dts/pages/404/index.js.map +1 -1
- package/dist/dts/pages/{AiSearch/AiSearch.d.ts → AISearch/AISearchPage.d.ts} +1 -1
- package/dist/dts/pages/AISearch/AISearchPage.d.ts.map +1 -0
- package/dist/dts/pages/{AiSearch/AiSearch.js → AISearch/AISearchPage.js} +1 -1
- package/dist/dts/pages/AISearch/AISearchPage.js.map +1 -0
- package/dist/dts/pages/{AiSearch → AISearch}/data.d.ts.map +1 -1
- package/dist/dts/pages/{AiSearch → AISearch}/data.js.map +1 -1
- package/dist/dts/pages/AISearch/index.d.ts +4 -0
- package/dist/dts/pages/AISearch/index.d.ts.map +1 -0
- package/dist/dts/pages/AISearch/index.js +4 -0
- package/dist/dts/pages/AISearch/index.js.map +1 -0
- package/dist/dts/pages/Analysis/{Analysis.d.ts → AnalysisPage.d.ts} +1 -1
- package/dist/dts/pages/Analysis/AnalysisPage.d.ts.map +1 -0
- package/dist/dts/pages/Analysis/{Analysis.js → AnalysisPage.js} +1 -1
- package/dist/dts/pages/Analysis/AnalysisPage.js.map +1 -0
- package/dist/dts/pages/Analysis/index.d.ts +4 -3
- package/dist/dts/pages/Analysis/index.d.ts.map +1 -1
- package/dist/dts/pages/Analysis/index.js +3 -2
- package/dist/dts/pages/Analysis/index.js.map +1 -1
- package/dist/dts/pages/Crosswalk/{Crosswalk.d.ts → CrosswalkPage.d.ts} +1 -1
- package/dist/dts/pages/Crosswalk/CrosswalkPage.d.ts.map +1 -0
- package/dist/dts/pages/Crosswalk/{Crosswalk.js → CrosswalkPage.js} +1 -1
- package/dist/dts/pages/Crosswalk/CrosswalkPage.js.map +1 -0
- package/dist/dts/pages/Crosswalk/index.d.ts +4 -2
- package/dist/dts/pages/Crosswalk/index.d.ts.map +1 -1
- package/dist/dts/pages/Crosswalk/index.js +3 -2
- package/dist/dts/pages/Crosswalk/index.js.map +1 -1
- package/dist/dts/pages/DataDictionary/{DataDictionary.d.ts → DataDictionaryPage.d.ts} +1 -1
- package/dist/dts/pages/DataDictionary/DataDictionaryPage.d.ts.map +1 -0
- package/dist/dts/pages/DataDictionary/{DataDictionary.js → DataDictionaryPage.js} +1 -1
- package/dist/dts/pages/DataDictionary/DataDictionaryPage.js.map +1 -0
- package/dist/dts/pages/DataDictionary/index.d.ts +4 -2
- package/dist/dts/pages/DataDictionary/index.d.ts.map +1 -1
- package/dist/dts/pages/DataDictionary/index.js +3 -2
- package/dist/dts/pages/DataDictionary/index.js.map +1 -1
- package/dist/dts/pages/DataLibrary/{DataLibrary.d.ts → DataLibraryPage.d.ts} +1 -1
- package/dist/dts/pages/DataLibrary/DataLibraryPage.d.ts.map +1 -0
- package/dist/dts/pages/DataLibrary/{DataLibrary.js → DataLibraryPage.js} +1 -1
- package/dist/dts/pages/DataLibrary/DataLibraryPage.js.map +1 -0
- package/dist/dts/pages/DataLibrary/index.d.ts +3 -2
- package/dist/dts/pages/DataLibrary/index.d.ts.map +1 -1
- package/dist/dts/pages/DataLibrary/index.js +3 -2
- package/dist/dts/pages/DataLibrary/index.js.map +1 -1
- package/dist/dts/pages/Discovery/{Discovery.d.ts → DiscoveryPage.d.ts} +1 -1
- package/dist/dts/pages/Discovery/DiscoveryPage.d.ts.map +1 -0
- package/dist/dts/pages/Discovery/{Discovery.js → DiscoveryPage.js} +1 -1
- package/dist/dts/pages/Discovery/DiscoveryPage.js.map +1 -0
- package/dist/dts/pages/Discovery/index.d.ts +4 -2
- package/dist/dts/pages/Discovery/index.d.ts.map +1 -1
- package/dist/dts/pages/Discovery/index.js +3 -2
- package/dist/dts/pages/Discovery/index.js.map +1 -1
- package/dist/dts/pages/Explorer/{Explorer.d.ts → ExplorerPage.d.ts} +1 -1
- package/dist/dts/pages/Explorer/ExplorerPage.d.ts.map +1 -0
- package/dist/dts/pages/Explorer/{Explorer.js → ExplorerPage.js} +1 -1
- package/dist/dts/pages/Explorer/ExplorerPage.js.map +1 -0
- package/dist/dts/pages/Explorer/index.d.ts +4 -3
- package/dist/dts/pages/Explorer/index.d.ts.map +1 -1
- package/dist/dts/pages/Explorer/index.js +3 -3
- package/dist/dts/pages/Explorer/index.js.map +1 -1
- package/dist/dts/pages/Landing/{Landing.d.ts → LandingPage.d.ts} +1 -1
- package/dist/dts/pages/Landing/LandingPage.d.ts.map +1 -0
- package/dist/dts/pages/Landing/{Landing.js → LandingPage.js} +1 -1
- package/dist/dts/pages/Landing/LandingPage.js.map +1 -0
- package/dist/dts/pages/Landing/index.d.ts +3 -2
- package/dist/dts/pages/Landing/index.d.ts.map +1 -1
- package/dist/dts/pages/Landing/index.js +3 -2
- package/dist/dts/pages/Landing/index.js.map +1 -1
- package/dist/dts/pages/Login/{Login.d.ts → LoginPage.d.ts} +1 -1
- package/dist/dts/pages/Login/LoginPage.d.ts.map +1 -0
- package/dist/dts/pages/Login/{Login.js → LoginPage.js} +1 -1
- package/dist/dts/pages/Login/LoginPage.js.map +1 -0
- package/dist/dts/pages/Login/index.d.ts +4 -2
- package/dist/dts/pages/Login/index.d.ts.map +1 -1
- package/dist/dts/pages/Login/index.js +3 -2
- package/dist/dts/pages/Login/index.js.map +1 -1
- package/dist/dts/pages/NotebookLite/{NotebookLite.d.ts → NotebookLitePage.d.ts} +1 -1
- package/dist/dts/pages/NotebookLite/NotebookLitePage.d.ts.map +1 -0
- package/dist/dts/pages/NotebookLite/{NotebookLite.js → NotebookLitePage.js} +1 -1
- package/dist/dts/pages/NotebookLite/NotebookLitePage.js.map +1 -0
- package/dist/dts/pages/NotebookLite/index.d.ts +3 -2
- package/dist/dts/pages/NotebookLite/index.d.ts.map +1 -1
- package/dist/dts/pages/NotebookLite/index.js +3 -2
- package/dist/dts/pages/NotebookLite/index.js.map +1 -1
- package/dist/dts/pages/Profile/{Profile.d.ts → ProfilePage.d.ts} +1 -1
- package/dist/dts/pages/Profile/ProfilePage.d.ts.map +1 -0
- package/dist/dts/pages/Profile/{Profile.js → ProfilePage.js} +1 -1
- package/dist/dts/pages/Profile/ProfilePage.js.map +1 -0
- package/dist/dts/pages/Profile/index.d.ts +3 -2
- package/dist/dts/pages/Profile/index.d.ts.map +1 -1
- package/dist/dts/pages/Profile/index.js +3 -2
- package/dist/dts/pages/Profile/index.js.map +1 -1
- package/dist/dts/pages/Query/{Query.d.ts → QueryPage.d.ts} +1 -1
- package/dist/dts/pages/Query/QueryPage.d.ts.map +1 -0
- package/dist/dts/pages/Query/{Query.js → QueryPage.js} +1 -1
- package/dist/dts/pages/Query/QueryPage.js.map +1 -0
- package/dist/dts/pages/Query/index.d.ts +4 -3
- package/dist/dts/pages/Query/index.d.ts.map +1 -1
- package/dist/dts/pages/Query/index.js +3 -3
- package/dist/dts/pages/Query/index.js.map +1 -1
- package/dist/dts/pages/Repository/{Repository.d.ts → RepositoryPage.d.ts} +1 -1
- package/dist/dts/pages/Repository/RepositoryPage.d.ts.map +1 -0
- package/dist/dts/pages/Repository/{Repository.js → RepositoryPage.js} +1 -1
- package/dist/dts/pages/Repository/RepositoryPage.js.map +1 -0
- package/dist/dts/pages/Repository/index.d.ts +4 -3
- package/dist/dts/pages/Repository/index.d.ts.map +1 -1
- package/dist/dts/pages/Repository/index.js +3 -3
- package/dist/dts/pages/Repository/index.js.map +1 -1
- package/dist/dts/pages/Submission/{Submission.d.ts → SubmissionPage.d.ts} +1 -1
- package/dist/dts/pages/Submission/SubmissionPage.d.ts.map +1 -0
- package/dist/dts/pages/Submission/{Submission.js → SubmissionPage.js} +1 -1
- package/dist/dts/pages/Submission/SubmissionPage.js.map +1 -0
- package/dist/dts/pages/Submission/index.d.ts +4 -2
- package/dist/dts/pages/Submission/index.d.ts.map +1 -1
- package/dist/dts/pages/Submission/index.js +3 -2
- package/dist/dts/pages/Submission/index.js.map +1 -1
- package/dist/dts/pages/TabbedCohortBuilder/index.d.ts +4 -2
- package/dist/dts/pages/TabbedCohortBuilder/index.d.ts.map +1 -1
- package/dist/dts/pages/TabbedCohortBuilder/index.js +3 -2
- package/dist/dts/pages/TabbedCohortBuilder/index.js.map +1 -1
- package/dist/dts/pages/Theme/{Colors.d.ts → ColorThemePage.d.ts} +1 -1
- package/dist/dts/pages/Theme/ColorThemePage.d.ts.map +1 -0
- package/dist/dts/pages/Theme/{Colors.js → ColorThemePage.js} +1 -1
- package/dist/dts/pages/Theme/ColorThemePage.js.map +1 -0
- package/dist/dts/pages/Theme/index.d.ts +3 -3
- package/dist/dts/pages/Theme/index.d.ts.map +1 -1
- package/dist/dts/pages/Theme/index.js +3 -2
- package/dist/dts/pages/Theme/index.js.map +1 -1
- package/dist/dts/pages/Workspace/{WorkspaceNoAccess.d.ts → WorkspaceNoAccess.Page.d.ts} +1 -1
- package/dist/dts/pages/Workspace/WorkspaceNoAccess.Page.d.ts.map +1 -0
- package/dist/dts/pages/Workspace/{WorkspaceNoAccess.js → WorkspaceNoAccess.Page.js} +1 -1
- package/dist/dts/pages/Workspace/WorkspaceNoAccess.Page.js.map +1 -0
- package/dist/dts/pages/Workspace/{Workspace.d.ts → WorkspacePage.d.ts} +1 -1
- package/dist/dts/pages/Workspace/WorkspacePage.d.ts.map +1 -0
- package/dist/dts/pages/Workspace/{Workspace.js → WorkspacePage.js} +1 -1
- package/dist/dts/pages/Workspace/WorkspacePage.js.map +1 -0
- package/dist/dts/pages/Workspace/index.d.ts +5 -4
- package/dist/dts/pages/Workspace/index.d.ts.map +1 -1
- package/dist/dts/pages/Workspace/index.js +4 -4
- package/dist/dts/pages/Workspace/index.js.map +1 -1
- package/dist/dts/pages/external/{footer.d.ts → StandaloneFooterPage.d.ts} +1 -1
- package/dist/dts/pages/external/StandaloneFooterPage.d.ts.map +1 -0
- package/dist/dts/pages/external/{footer.js → StandaloneFooterPage.js} +1 -1
- package/dist/dts/pages/external/StandaloneFooterPage.js.map +1 -0
- package/dist/dts/pages/index.d.ts +19 -3
- package/dist/dts/pages/index.d.ts.map +1 -1
- package/dist/dts/pages/index.js +19 -54
- package/dist/dts/pages/index.js.map +1 -1
- package/dist/dts/utils/labels.d.ts +5 -5
- package/dist/dts/utils/labels.d.ts.map +1 -1
- package/dist/dts/utils/labels.js +7 -7
- package/dist/dts/utils/labels.js.map +1 -1
- package/dist/index/cjs/{QueryPanel-BMyMDa0j.js → QueryPanel-DjEGC2y4.js} +2 -2
- package/dist/index/cjs/{QueryPanel-BMyMDa0j.js.map → QueryPanel-DjEGC2y4.js.map} +1 -1
- package/dist/index/cjs/{index-UneMBb1i.js → index-Dbe1092a.js} +116 -79
- package/dist/index/cjs/index-Dbe1092a.js.map +1 -0
- package/dist/index/cjs/index.js +2 -2
- package/dist/index/esm/{QueryPanel-jUkVQ57q.js → QueryPanel-CuoHGg9R.js} +2 -2
- package/dist/index/esm/{QueryPanel-jUkVQ57q.js.map → QueryPanel-CuoHGg9R.js.map} +1 -1
- package/dist/index/esm/{index-CMqj9qc0.js → index-BzX6R_rC.js} +117 -80
- package/dist/index/esm/index-BzX6R_rC.js.map +1 -0
- package/dist/index/esm/index.js +1 -1
- package/dist/index.d.ts +28 -25
- package/dist/pages/cjs/CohortBuilder-um9lj6F0.js +480 -0
- package/dist/pages/cjs/CohortBuilder-um9lj6F0.js.map +1 -0
- package/dist/pages/cjs/GqlQueryEditor-C2C--3Sq.js +54 -0
- package/dist/pages/cjs/GqlQueryEditor-C2C--3Sq.js.map +1 -0
- package/dist/pages/cjs/QueryPanel-FE6wpWyr.js +24 -0
- package/dist/pages/cjs/QueryPanel-FE6wpWyr.js.map +1 -0
- package/dist/pages/cjs/index-DEefrENb.js +22201 -0
- package/dist/pages/cjs/index-DEefrENb.js.map +1 -0
- package/dist/pages/cjs/index.js +103 -0
- package/dist/pages/cjs/index.js.map +1 -0
- package/dist/pages/esm/CohortBuilder-DKva6j9o.js +477 -0
- package/dist/pages/esm/CohortBuilder-DKva6j9o.js.map +1 -0
- package/dist/pages/esm/GqlQueryEditor--3qrsd-o.js +52 -0
- package/dist/pages/esm/GqlQueryEditor--3qrsd-o.js.map +1 -0
- package/dist/pages/esm/QueryPanel-D4MUqmA6.js +22 -0
- package/dist/pages/esm/QueryPanel-D4MUqmA6.js.map +1 -0
- package/dist/pages/esm/index-CbfjtvBZ.js +22119 -0
- package/dist/pages/esm/index-CbfjtvBZ.js.map +1 -0
- package/dist/pages/esm/index.js +59 -0
- package/dist/pages/esm/index.js.map +1 -0
- package/dist/pages.d.ts +1002 -0
- package/dist/server/cjs/server.js +4 -0
- package/dist/server/cjs/server.js.map +1 -1
- package/dist/server/esm/server.js +4 -0
- package/dist/server/esm/server.js.map +1 -1
- package/dist/server.d.ts +1 -0
- package/docs/components/Part 1.3 (1).ics +68 -0
- package/docs/components/TextContent.md +185 -0
- package/jest.config.ts +32 -0
- package/package.json +14 -48
- package/postcss.config.js +8 -0
- package/rollup.config.mjs +198 -0
- package/schemas/discovery_config_schema.json +925 -0
- package/setupTests.ts +18 -0
- package/LICENSE +0 -201
- package/dist/dts/features/cart/types.d.ts +0 -2
- package/dist/dts/features/cart/types.d.ts.map +0 -1
- package/dist/dts/features/cart/types.js +0 -2
- package/dist/dts/features/cart/types.js.map +0 -1
- package/dist/dts/pages/AiSearch/AiSearch.d.ts.map +0 -1
- package/dist/dts/pages/AiSearch/AiSearch.js.map +0 -1
- package/dist/dts/pages/AiSearch/index.d.ts +0 -3
- package/dist/dts/pages/AiSearch/index.d.ts.map +0 -1
- package/dist/dts/pages/AiSearch/index.js +0 -3
- package/dist/dts/pages/AiSearch/index.js.map +0 -1
- package/dist/dts/pages/Analysis/Analysis.d.ts.map +0 -1
- package/dist/dts/pages/Analysis/Analysis.js.map +0 -1
- package/dist/dts/pages/Crosswalk/Crosswalk.d.ts.map +0 -1
- package/dist/dts/pages/Crosswalk/Crosswalk.js.map +0 -1
- package/dist/dts/pages/DataDictionary/DataDictionary.d.ts.map +0 -1
- package/dist/dts/pages/DataDictionary/DataDictionary.js.map +0 -1
- package/dist/dts/pages/DataLibrary/DataLibrary.d.ts.map +0 -1
- package/dist/dts/pages/DataLibrary/DataLibrary.js.map +0 -1
- package/dist/dts/pages/Discovery/Discovery.d.ts.map +0 -1
- package/dist/dts/pages/Discovery/Discovery.js.map +0 -1
- package/dist/dts/pages/Explorer/Explorer.d.ts.map +0 -1
- package/dist/dts/pages/Explorer/Explorer.js.map +0 -1
- package/dist/dts/pages/Landing/Landing.d.ts.map +0 -1
- package/dist/dts/pages/Landing/Landing.js.map +0 -1
- package/dist/dts/pages/Login/Login.d.ts.map +0 -1
- package/dist/dts/pages/Login/Login.js.map +0 -1
- package/dist/dts/pages/NotebookLite/NotebookLite.d.ts.map +0 -1
- package/dist/dts/pages/NotebookLite/NotebookLite.js.map +0 -1
- package/dist/dts/pages/Profile/Profile.d.ts.map +0 -1
- package/dist/dts/pages/Profile/Profile.js.map +0 -1
- package/dist/dts/pages/Query/Query.d.ts.map +0 -1
- package/dist/dts/pages/Query/Query.js.map +0 -1
- package/dist/dts/pages/Repository/Repository.d.ts.map +0 -1
- package/dist/dts/pages/Repository/Repository.js.map +0 -1
- package/dist/dts/pages/Submission/Submission.d.ts.map +0 -1
- package/dist/dts/pages/Submission/Submission.js.map +0 -1
- package/dist/dts/pages/Theme/Colors.d.ts.map +0 -1
- package/dist/dts/pages/Theme/Colors.js.map +0 -1
- package/dist/dts/pages/Workspace/Workspace.d.ts.map +0 -1
- package/dist/dts/pages/Workspace/Workspace.js.map +0 -1
- package/dist/dts/pages/Workspace/WorkspaceNoAccess.d.ts.map +0 -1
- package/dist/dts/pages/Workspace/WorkspaceNoAccess.js.map +0 -1
- package/dist/dts/pages/external/footer.d.ts.map +0 -1
- package/dist/dts/pages/external/footer.js.map +0 -1
- package/dist/index/cjs/index-UneMBb1i.js.map +0 -1
- package/dist/index/cjs/styles.css +0 -7
- package/dist/index/cjs/styles.css.map +0 -1
- package/dist/index/esm/index-CMqj9qc0.js.map +0 -1
- package/dist/index/esm/styles.css +0 -7
- package/dist/index/esm/styles.css.map +0 -1
- package/dist/styles.css +0 -7
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/dts/pages/{AiSearch → AISearch}/data.d.ts +0 -0
- /package/dist/dts/pages/{AiSearch → AISearch}/data.js +0 -0
|
@@ -75,6 +75,10 @@ class ContentSource {
|
|
|
75
75
|
getContentDatabase() {
|
|
76
76
|
return this.contentDatabase;
|
|
77
77
|
}
|
|
78
|
+
// ✅ Compatibility helper: allow `ContentSource.getContentDatabase()`
|
|
79
|
+
static getContentDatabase() {
|
|
80
|
+
return ContentSource.getInstance().getContentDatabase();
|
|
81
|
+
}
|
|
78
82
|
}
|
|
79
83
|
// Export a singleton instance
|
|
80
84
|
var index = ContentSource.getInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../../src/lib/content/filesystem.ts","../../../src/lib/content/ContentDatabase.ts","../../../src/lib/content/constants.ts","../../../src/lib/content/index.ts","../../../src/lib/authz/type.ts","../../../src/lib/auth/utils.ts","../../../src/api/auth/errorHandler.ts","../../../src/api/auth/sessionToken.ts"],"sourcesContent":["import { ContentSourceInterface } from './types';\nimport fs from 'fs';\nimport path from 'path';\n\nconst myGlob = (dir: string, filter: string) => {\n try {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.search(filter) !== -1);\n } catch (error: any) {\n console.log('myGlob error', error, dir);\n }\n return [];\n};\n\nexport class FilesystemContent implements ContentSourceInterface {\n rootPath: string;\n constructor({ rootPath }: { rootPath?: string }) {\n this.rootPath = rootPath || '';\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n try {\n return await JSON.parse(\n fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'),\n );\n } catch (err: unknown) {\n throw new Error(`Cannot process ${path.join(this.rootPath, filepath)} `);\n }\n }\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n try {\n const files = myGlob(path.join(this.rootPath, filepath), filter);\n return Promise.all(\n files.map((file) => this.get<T>(path.join(filepath, file))),\n );\n } catch (_err: unknown) {\n throw new Error(\n `getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`,\n );\n }\n }\n}\n","import { ContentSourceInterface } from './types';\n\n/**\n * The Content management \"datastore\" which is an abstracted interface to\n * some persistent storage of content needed for Gen3's content management system\n */\n\nexport interface CreateDatabase {\n store: ContentSourceInterface;\n}\n\nexport class ContentDatabase {\n public store: ContentSourceInterface;\n\n constructor(public config: CreateDatabase) {\n this.store = config.store;\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n return this.store.get(filepath);\n }\n\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n // Array<Promise<T>>\n return this.store.getAll(filepath, filter);\n }\n}\n","export const GEN3_FRONTEND_CONFIGURATION_ROOT =\n process.env.GEN3_FRONTEND_CONFIGURATION_ROOT || './config/';\n","import { FilesystemContent } from './filesystem';\nimport { ContentDatabase } from './ContentDatabase';\nimport { GEN3_FRONTEND_CONFIGURATION_ROOT } from './constants';\n\nexport class ContentSource {\n private static instance: ContentSource | null = null;\n private contentDatabase: ContentDatabase;\n\n private constructor() {\n const config = {\n store: new FilesystemContent({\n rootPath: GEN3_FRONTEND_CONFIGURATION_ROOT,\n }),\n };\n this.contentDatabase = new ContentDatabase(config);\n }\n\n public static getInstance(): ContentSource {\n if (!ContentSource.instance) {\n ContentSource.instance = new ContentSource();\n }\n return ContentSource.instance;\n }\n\n // Add methods to access the ContentDatabase functionality\n // For example:\n public getContentDatabase(): ContentDatabase {\n return this.contentDatabase;\n }\n}\n\n// Export a singleton instance\nexport default ContentSource.getInstance();\n","export type RouteRule = {\n loginRequired?: boolean;\n authz?: string[];\n};\n\nexport type RouteConfig = Record<string, RouteRule>;\n\nexport interface AuthorizedRoutesConfig {\n routes: RouteConfig;\n}\n\nexport const DefaultAuthorizedRoutesConfig = {\n routes: {\n '/DataLibrary': {\n loginRequired: true,\n },\n '/Workspace': {\n loginRequired: true,\n },\n '/Profile': {\n loginRequired: true,\n },\n '*': {\n loginRequired: false,\n },\n },\n};\n","import { fetchFence } from '@gen3/core/server';\n\ninterface Gen3JTWKeys {\n keys: string[];\n}\n\n/**\n * Fetches a JSON Web Token (JWT) key from the specified endpoint.\n *\n * This asynchronous function interacts with the Gen3 Fence API to retrieve JWT keys.\n * If the response status is not 200 or the expected key format is not found, the function\n * will return null. Otherwise, it returns the first available key.\n *\n * @function\n * @async\n * @returns {Promise<string|null>} A Promise resolving to the JWT key as a string if available, or null if not.\n */\nexport const fetchJWTKey = async (useService: boolean = false) => {\n const response = await fetchFence<Gen3JTWKeys>(\n {\n endpoint: '/jwt/keys',\n isJSON: true,\n },\n useService,\n );\n if (response.status !== 200) {\n return null;\n }\n\n if (response?.data?.keys.length && response?.data?.keys[0].length > 1) {\n return response.data.keys[0][1];\n }\n return null;\n};\n","import type { NextApiResponse } from 'next';\nimport { errors as joseErrors } from 'jose';\nimport { isFetchError } from '@gen3/core/server';\n\nconst HTTP_INTERNAL_ERROR = 500;\n/**\n * An object that contains predefined error messages for handling JWT-related issues.\n *\n * Properties:\n * - TOKEN_EXPIRED: Error message indicating that the JSON Web Token (JWT) has expired.\n * - TOKEN_INVALID: Error message specifying that the JWT is invalid.\n * - TOKEN_SIGNATURE_INVALID: Error message for when the JWT signature cannot be verified.\n * - JWKS_NO_MATCHING_KEY: Error message indicating that no matching key was found in JWKS\n * (JSON Web Key Set) for JWT verification.\n * - UNKNOWN: General error message for unspecified or unknown errors.\n *\n */\nconst ERRORS = {\n TOKEN_EXPIRED: 'The JWT has expired.',\n TOKEN_INVALID: 'The JWT is invalid.',\n TOKEN_SIGNATURE_INVALID: 'The JWT signature is invalid.',\n JWKS_NO_MATCHING_KEY: 'No matching key found in JWKS for JWT verification.',\n UNKNOWN: 'Unknown error',\n};\n\n/**\n * Handles and returns an appropriate error response based on the provided error.\n *\n * @param {unknown} error - The error object which could be of various types such as fetch errors, JWT errors, or generic errors.\n * @param {NextApiResponse} res - The API response object used to send the error response.\n * @returns {NextApiResponse} - The response object containing the appropriate error status and message.\n *\n * This function evaluates the type of error passed to it and maps these errors to suitable\n * HTTP status codes and human-readable messages. It supports specific cases such as:\n * - Fetch errors.\n * - JSON Web Token (JWT) related errors (expired tokens, invalid tokens, signature issues, missing matching keys).\n * - Standard JavaScript errors.\n * - Unknown errors where it defaults to a generic unknown error message.\n *\n * The response will always include the error status and a message describing the error.\n */\nexport const getWebTokenErrorResponse = (\n error: unknown,\n res: NextApiResponse,\n): NextApiResponse => {\n if (isFetchError(error)) {\n res.status(error.status).json({ message: error.statusText });\n return res;\n }\n\n if (error instanceof joseErrors.JWTExpired) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_EXPIRED });\n return res;\n }\n if (error instanceof joseErrors.JWTInvalid) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWSInvalid) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.TOKEN_SIGNATURE_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWKSNoMatchingKey) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.JWKS_NO_MATCHING_KEY });\n return res;\n }\n\n if (error instanceof Error) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: error.message });\n return res;\n }\n\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.UNKNOWN });\n return res;\n};\n","import type { NextApiRequest, NextApiResponse } from 'next';\nimport { parse } from 'cookie';\nimport { decodeJwt, importSPKI, JWTPayload, jwtVerify } from 'jose';\nimport { fetchJWTKey } from '../../lib/auth/utils';\nimport { getWebTokenErrorResponse } from './errorHandler';\n\nexport const isExpired = (value: number) => value - Date.now() > 0;\n\nexport interface JWTPayloadAndUser extends JWTPayload {\n context: Record<string, string>;\n}\n\n/**\n * returns the access_token expiration, user, and status\n * @param req\n * @param res\n */\nexport default async function handler(\n req: NextApiRequest,\n res: NextApiResponse,\n): Promise<void> {\n try {\n const cookies = req.headers.cookie ? parse(req.headers.cookie) : {};\n let accessToken = cookies.access_token;\n\n // in development mode we support \"credentials login\"\n if (!accessToken && process.env.NODE_ENV === 'development') {\n // NOTE: This cookie can only be accessed from the client side\n // in development mode. Otherwise, the cookie is set as httpOnly\n accessToken = cookies.credentials_token;\n }\n\n if (accessToken) {\n const jwtKey = await fetchJWTKey(process.env.NODE_ENV === 'production');\n if (!jwtKey) {\n res.status(500).json({\n message: 'No JWT Key to verify token',\n });\n return;\n }\n // validate the token\n const publicKey = await importSPKI(jwtKey, 'RS256');\n await jwtVerify(accessToken, publicKey);\n const decodedAccessToken = decodeJwt(accessToken) as JWTPayloadAndUser;\n\n res.status(200).json({\n issued: decodedAccessToken.iat,\n expires: decodedAccessToken.exp,\n userContext: decodedAccessToken.context.user,\n status: decodedAccessToken.exp\n ? isExpired(decodedAccessToken.exp)\n ? 'expired'\n : 'issued'\n : 'invalid',\n });\n return;\n }\n\n res.status(200).json({\n status: 'not present',\n });\n } catch (error: unknown) {\n getWebTokenErrorResponse(error, res); // will update the res object with error\n }\n}\n"],"names":["myGlob","dir","filter","files","fs","readdirSync","file","search","error","console","log","FilesystemContent","rootPath","get","filepath","JSON","parse","readFileSync","path","join","toString","err","Error","getAll","Promise","all","map","_err","ContentDatabase","config","store","GEN3_FRONTEND_CONFIGURATION_ROOT","process","env","ContentSource","instance","contentDatabase","getInstance","getContentDatabase","DefaultAuthorizedRoutesConfig","routes","loginRequired","fetchJWTKey","useService","response","fetchFence","endpoint","isJSON","status","data","keys","length","HTTP_INTERNAL_ERROR","ERRORS","TOKEN_EXPIRED","TOKEN_INVALID","TOKEN_SIGNATURE_INVALID","JWKS_NO_MATCHING_KEY","UNKNOWN","getWebTokenErrorResponse","res","isFetchError","json","message","statusText","joseErrors","JWTExpired","JWTInvalid","JWSInvalid","JWKSNoMatchingKey","isExpired","value","Date","now","handler","req","cookies","headers","cookie","accessToken","access_token","NODE_ENV","credentials_token","jwtKey","publicKey","importSPKI","jwtVerify","decodedAccessToken","decodeJwt","issued","iat","expires","exp","userContext","context","user"],"mappings":";;;;;;;;AAIA,MAAMA,MAAAA,GAAS,CAACC,GAAAA,EAAaC,MAAAA,GAAAA;IAC3B,IAAI;QACF,MAAMC,KAAAA,GAAQC,EAAAA,CAAGC,WAAW,CAACJ,GAAAA,CAAAA;QAC7B,OAAOE,KAAAA,CAAMD,MAAM,CAAC,CAACI,OAASA,IAAAA,CAAKC,MAAM,CAACL,MAAAA,CAAAA,KAAY,CAAC,CAAA,CAAA;AACzD,IAAA,CAAA,CAAE,OAAOM,KAAAA,EAAY;QACnBC,OAAAA,CAAQC,GAAG,CAAC,cAAA,EAAgBF,KAAAA,EAAOP,GAAAA,CAAAA;AACrC,IAAA;AACA,IAAA,OAAO,EAAE;AACX,CAAA;AAEO,MAAMU,iBAAAA,CAAAA;IAEX,WAAA,CAAY,EAAEC,QAAQ,EAAyB,CAAE;QAC/C,IAAI,CAACA,QAAQ,GAAGA,QAAAA,IAAY,EAAA;AAC9B,IAAA;IAEA,MAAaC,GAAAA,CACXC,QAAgB,EACJ;QACZ,IAAI;AACF,YAAA,OAAO,MAAMC,IAAAA,CAAKC,KAAK,CACrBZ,EAAAA,CAAGa,YAAY,CAACC,IAAAA,CAAKC,IAAI,CAAC,IAAI,CAACP,QAAQ,EAAEE,QAAAA,CAAAA,CAAAA,CAAWM,QAAQ,CAAC,MAAA,CAAA,CAAA;AAEjE,QAAA,CAAA,CAAE,OAAOC,GAAAA,EAAc;AACrB,YAAA,MAAM,IAAIC,KAAAA,CAAM,CAAC,eAAe,EAAEJ,IAAAA,CAAKC,IAAI,CAAC,IAAI,CAACP,QAAQ,EAAEE,QAAAA,CAAAA,CAAU,CAAC,CAAC,CAAA;AACzE,QAAA;AACF,IAAA;AACA,IAAA,MAAaS,MAAAA,CACXT,QAAgB,EAChBZ,MAAc,EACK;QACnB,IAAI;YACF,MAAMC,KAAAA,GAAQH,OAAOkB,IA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I,CAACE,MAAAA,EAAQ;AACXvB,gBAAAA,GAAAA,CAAIZ,MAAM,CAAC,GAAA,CAAA,CAAKc,IAAI,CAAC;oBACnBC,OAAAA,EAAS;AACX,iBAAA,CAAA;AACA,gBAAA;AACF,YAAA;;YAEA,MAAMqB,SAAAA,GAAY,MAAMC,eAAAA,CAAWF,MAAAA,EAAQ,OAAA,CAAA;AAC3C,YAAA,MAAMG,eAAUP,WAAAA,EAAaK,SAAAA,CAAAA;AAC7B,YAAA,MAAMG,qBAAqBC,cAAAA,CAAUT,WAAAA,CAAAA;AAErCnB,YAAAA,GAAAA,CAAIZ,MAAM,CAAC,GAAA,CAAA,CAAKc,IAAI,CAAC;AACnB2B,gBAAAA,MAAAA,EAAQF,mBAAmBG,GAAG;AAC9BC,gBAAAA,OAAAA,EAASJ,mBAAmBK,GAAG;gBAC/BC,WAAAA,EAAaN,kBAAAA,CAAmBO,OAAO,CAACC,IAAI;gBAC5C/C,MAAAA,EAAQuC,kBAAAA,CAAmBK,GAAG,GAC1BtB,SAAAA,CAAUiB,mBAAmBK,GAAG,CAAA,GAC9B,YACA,QAAA,GACF;AACN,aAAA,CAAA;AACA,YAAA;AACF,QAAA;AAEAhC,QAAAA,GAAAA,CAAIZ,MAAM,CAAC,GAAA,CAAA,CAAKc,IAAI,CAAC;YACnBd,MAAAA,EAAQ;AACV,SAAA,CAAA;AACF,IAAA,CAAA,CAAE,OAAOxC,KAAAA,EAAgB;QACvBmD,wBAAAA,CAAyBnD,KAAAA,EAAOoD;AAClC,IAAA;AACF;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../src/lib/content/filesystem.ts","../../../src/lib/content/ContentDatabase.ts","../../../src/lib/content/constants.ts","../../../src/lib/content/index.ts","../../../src/lib/authz/type.ts","../../../src/lib/auth/utils.ts","../../../src/api/auth/errorHandler.ts","../../../src/api/auth/sessionToken.ts"],"sourcesContent":["import { ContentSourceInterface } from './types';\nimport fs from 'fs';\nimport path from 'path';\n\nconst myGlob = (dir: string, filter: string) => {\n try {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.search(filter) !== -1);\n } catch (error: any) {\n console.log('myGlob error', error, dir);\n }\n return [];\n};\n\nexport class FilesystemContent implements ContentSourceInterface {\n rootPath: string;\n constructor({ rootPath }: { rootPath?: string }) {\n this.rootPath = rootPath || '';\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n try {\n return await JSON.parse(\n fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'),\n );\n } catch (err: unknown) {\n throw new Error(`Cannot process ${path.join(this.rootPath, filepath)} `);\n }\n }\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n try {\n const files = myGlob(path.join(this.rootPath, filepath), filter);\n return Promise.all(\n files.map((file) => this.get<T>(path.join(filepath, file))),\n );\n } catch (_err: unknown) {\n throw new Error(\n `getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`,\n );\n }\n }\n}\n","import { ContentSourceInterface } from './types';\n\n/**\n * The Content management \"datastore\" which is an abstracted interface to\n * some persistent storage of content needed for Gen3's content management system\n */\n\nexport interface CreateDatabase {\n store: ContentSourceInterface;\n}\n\nexport class ContentDatabase {\n public store: ContentSourceInterface;\n\n constructor(public config: CreateDatabase) {\n this.store = config.store;\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n return this.store.get(filepath);\n }\n\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n // Array<Promise<T>>\n return this.store.getAll(filepath, filter);\n }\n}\n","export const GEN3_FRONTEND_CONFIGURATION_ROOT =\n process.env.GEN3_FRONTEND_CONFIGURATION_ROOT || './config/';\n","import { FilesystemContent } from './filesystem';\nimport { ContentDatabase } from './ContentDatabase';\nimport { GEN3_FRONTEND_CONFIGURATION_ROOT } from './constants';\n\nexport class ContentSource {\n private static instance: ContentSource | null = null;\n private contentDatabase: ContentDatabase;\n\n private constructor() {\n const config = {\n store: new FilesystemContent({\n rootPath: GEN3_FRONTEND_CONFIGURATION_ROOT,\n }),\n };\n this.contentDatabase = new ContentDatabase(config);\n }\n\n public static getInstance(): ContentSource {\n if (!ContentSource.instance) {\n ContentSource.instance = new ContentSource();\n }\n return ContentSource.instance;\n }\n\n // Add methods to access the ContentDatabase functionality\n // For example:\n public getContentDatabase(): ContentDatabase {\n return this.contentDatabase;\n }\n\n // ✅ Compatibility helper: allow `ContentSource.getContentDatabase()`\n public static getContentDatabase(): ContentDatabase {\n return ContentSource.getInstance().getContentDatabase();\n }\n}\n\n// Export a singleton instance\nexport default ContentSource.getInstance();\n","export type RouteRule = {\n loginRequired?: boolean;\n authz?: string[];\n};\n\nexport type RouteConfig = Record<string, RouteRule>;\n\nexport interface AuthorizedRoutesConfig {\n routes: RouteConfig;\n}\n\nexport const DefaultAuthorizedRoutesConfig = {\n routes: {\n '/DataLibrary': {\n loginRequired: true,\n },\n '/Workspace': {\n loginRequired: true,\n },\n '/Profile': {\n loginRequired: true,\n },\n '*': {\n loginRequired: false,\n },\n },\n};\n","import { fetchFence } from '@gen3/core/server';\n\ninterface Gen3JTWKeys {\n keys: string[];\n}\n\n/**\n * Fetches a JSON Web Token (JWT) key from the specified endpoint.\n *\n * This asynchronous function interacts with the Gen3 Fence API to retrieve JWT keys.\n * If the response status is not 200 or the expected key format is not found, the function\n * will return null. Otherwise, it returns the first available key.\n *\n * @function\n * @async\n * @returns {Promise<string|null>} A Promise resolving to the JWT key as a string if available, or null if not.\n */\nexport const fetchJWTKey = async (useService: boolean = false) => {\n const response = await fetchFence<Gen3JTWKeys>(\n {\n endpoint: '/jwt/keys',\n isJSON: true,\n },\n useService,\n );\n if (response.status !== 200) {\n return null;\n }\n\n if (response?.data?.keys.length && response?.data?.keys[0].length > 1) {\n return response.data.keys[0][1];\n }\n return null;\n};\n","import type { NextApiResponse } from 'next';\nimport { errors as joseErrors } from 'jose';\nimport { isFetchError } from '@gen3/core/server';\n\nconst HTTP_INTERNAL_ERROR = 500;\n/**\n * An object that contains predefined error messages for handling JWT-related issues.\n *\n * Properties:\n * - TOKEN_EXPIRED: Error message indicating that the JSON Web Token (JWT) has expired.\n * - TOKEN_INVALID: Error message specifying that the JWT is invalid.\n * - TOKEN_SIGNATURE_INVALID: Error message for when the JWT signature cannot be verified.\n * - JWKS_NO_MATCHING_KEY: Error message indicating that no matching key was found in JWKS\n * (JSON Web Key Set) for JWT verification.\n * - UNKNOWN: General error message for unspecified or unknown errors.\n *\n */\nconst ERRORS = {\n TOKEN_EXPIRED: 'The JWT has expired.',\n TOKEN_INVALID: 'The JWT is invalid.',\n TOKEN_SIGNATURE_INVALID: 'The JWT signature is invalid.',\n JWKS_NO_MATCHING_KEY: 'No matching key found in JWKS for JWT verification.',\n UNKNOWN: 'Unknown error',\n};\n\n/**\n * Handles and returns an appropriate error response based on the provided error.\n *\n * @param {unknown} error - The error object which could be of various types such as fetch errors, JWT errors, or generic errors.\n * @param {NextApiResponse} res - The API response object used to send the error response.\n * @returns {NextApiResponse} - The response object containing the appropriate error status and message.\n *\n * This function evaluates the type of error passed to it and maps these errors to suitable\n * HTTP status codes and human-readable messages. It supports specific cases such as:\n * - Fetch errors.\n * - JSON Web Token (JWT) related errors (expired tokens, invalid tokens, signature issues, missing matching keys).\n * - Standard JavaScript errors.\n * - Unknown errors where it defaults to a generic unknown error message.\n *\n * The response will always include the error status and a message describing the error.\n */\nexport const getWebTokenErrorResponse = (\n error: unknown,\n res: NextApiResponse,\n): NextApiResponse => {\n if (isFetchError(error)) {\n res.status(error.status).json({ message: error.statusText });\n return res;\n }\n\n if (error instanceof joseErrors.JWTExpired) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_EXPIRED });\n return res;\n }\n if (error instanceof joseErrors.JWTInvalid) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWSInvalid) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.TOKEN_SIGNATURE_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWKSNoMatchingKey) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.JWKS_NO_MATCHING_KEY });\n return res;\n }\n\n if (error instanceof Error) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: error.message });\n return res;\n }\n\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.UNKNOWN });\n return res;\n};\n","import type { NextApiRequest, NextApiResponse } from 'next';\nimport { parse } from 'cookie';\nimport { decodeJwt, importSPKI, JWTPayload, jwtVerify } from 'jose';\nimport { fetchJWTKey } from '../../lib/auth/utils';\nimport { getWebTokenErrorResponse } from './errorHandler';\n\nexport const isExpired = (value: number) => value - Date.now() > 0;\n\nexport interface JWTPayloadAndUser extends JWTPayload {\n context: Record<string, string>;\n}\n\n/**\n * returns the access_token expiration, user, and status\n * @param req\n * @param res\n */\nexport default async function handler(\n req: NextApiRequest,\n res: NextApiResponse,\n): Promise<void> {\n try {\n const cookies = req.headers.cookie ? parse(req.headers.cookie) : {};\n let accessToken = cookies.access_token;\n\n // in development mode we support \"credentials login\"\n if (!accessToken && process.env.NODE_ENV === 'development') {\n // NOTE: This cookie can only be accessed from the client side\n // in development mode. Otherwise, the cookie is set as httpOnly\n accessToken = cookies.credentials_token;\n }\n\n if (accessToken) {\n const jwtKey = await fetchJWTKey(process.env.NODE_ENV === 'production');\n if (!jwtKey) {\n res.status(500).json({\n message: 'No JWT Key to verify token',\n });\n return;\n }\n // validate the token\n const publicKey = await importSPKI(jwtKey, 'RS256');\n await jwtVerify(accessToken, publicKey);\n const decodedAccessToken = decodeJwt(accessToken) as JWTPayloadAndUser;\n\n res.status(200).json({\n issued: decodedAccessToken.iat,\n expires: decodedAccessToken.exp,\n userContext: decodedAccessToken.context.user,\n status: decodedAccessToken.exp\n ? isExpired(decodedAccessToken.exp)\n ? 'expired'\n : 'issued'\n : 'invalid',\n });\n return;\n }\n\n res.status(200).json({\n status: 'not present',\n });\n } catch (error: unknown) {\n getWebTokenErrorResponse(error, res); // will update the res object with error\n }\n}\n"],"names":["myGlob","dir","filter","files","fs","readdirSync","file","search","error","console","log","FilesystemContent","rootPath","get","filepath","JSON","parse","readFileSync","path","join","toString","err","Error","getAll","Promise","all","map","_err","ContentDatabase","config","store","GEN3_FRONTEND_CONFIGURATION_ROOT","process","env","ContentSource","instance","contentDatabase","getInstance","getContentDatabase","DefaultAuthorizedRoutesConfig","routes","loginRequired","fetchJWTKey","useService","response","fetchFence","endpoint","isJSON","status","data","keys","length","HTTP_INTERNAL_ERROR","ERRORS","TOKEN_EXPIRED","TOKEN_INVALID","TOKEN_SIGNATURE_INVALID","JWKS_NO_MATCHING_KEY","UNKNOWN","getWebTokenErrorResponse","res","isFetchError","json","message","statusText","joseErrors","JWTExpired","JWTInvalid","JWSInvalid","JWKSNoMatchingKey","isExpired","value","Date","now","handler","req","cookies","headers","cookie","accessToken","access_token","NODE_ENV","credentials_token","jwtKey","publicKey","importSPKI","jwtVerify","decodedAccessToken","decodeJwt","issued","iat","expires","exp","userContext","context","user"],"mappings":";;;;;;;;AAIA,MAAMA,MAAAA,GAAS,CAACC,GAAAA,EAAaC,MAAAA,GAAAA;IAC3B,IAAI;QACF,MAAMC,KAAAA,GAAQC,EAAAA,CAAGC,WAAW,CAACJ,GAAAA,CAAAA;QAC7B,OAAOE,KAAAA,CAAMD,MAAM,CAAC,CAACI,OAASA,IAAAA,CAAKC,MAAM,CAACL,MAAAA,CAAAA,KAAY,CAAC,CAAA,CAAA;AACzD,IAAA,CAAA,CAAE,OAAOM,KAAAA,EAAY;QACnBC,OAAAA,CAAQC,GAAG,CAAC,cAAA,EAAgBF,KAAAA,EAAOP,GAAAA,CAAAA;AACrC,IAAA;AACA,IAAA,OAAO,EAAE;AACX,CAAA;AAEO,MAAMU,iBAAAA,CAAAA;IAEX,WAAA,CAAY,EAAEC,QAAQ,EAAyB,CAAE;QA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AAA,OAAAA,EAASJ,mBAAmBK,GAAG;gBAC/BC,WAAAA,EAAaN,kBAAAA,CAAmBO,OAAO,CAACC,IAAI;gBAC5C/C,MAAAA,EAAQuC,kBAAAA,CAAmBK,GAAG,GAC1BtB,SAAAA,CAAUiB,mBAAmBK,GAAG,CAAA,GAC9B,YACA,QAAA,GACF;AACN,aAAA,CAAA;AACA,YAAA;AACF,QAAA;AAEAhC,QAAAA,GAAAA,CAAIZ,MAAM,CAAC,GAAA,CAAA,CAAKc,IAAI,CAAC;YACnBd,MAAAA,EAAQ;AACV,SAAA,CAAA;AACF,IAAA,CAAA,CAAE,OAAOxC,KAAAA,EAAgB;QACvBmD,wBAAAA,CAAyBnD,KAAAA,EAAOoD;AAClC,IAAA;AACF;;;;;;;"}
|
|
@@ -73,6 +73,10 @@ class ContentSource {
|
|
|
73
73
|
getContentDatabase() {
|
|
74
74
|
return this.contentDatabase;
|
|
75
75
|
}
|
|
76
|
+
// ✅ Compatibility helper: allow `ContentSource.getContentDatabase()`
|
|
77
|
+
static getContentDatabase() {
|
|
78
|
+
return ContentSource.getInstance().getContentDatabase();
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
// Export a singleton instance
|
|
78
82
|
var index = ContentSource.getInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../../src/lib/content/filesystem.ts","../../../src/lib/content/ContentDatabase.ts","../../../src/lib/content/constants.ts","../../../src/lib/content/index.ts","../../../src/lib/authz/type.ts","../../../src/lib/auth/utils.ts","../../../src/api/auth/errorHandler.ts","../../../src/api/auth/sessionToken.ts"],"sourcesContent":["import { ContentSourceInterface } from './types';\nimport fs from 'fs';\nimport path from 'path';\n\nconst myGlob = (dir: string, filter: string) => {\n try {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.search(filter) !== -1);\n } catch (error: any) {\n console.log('myGlob error', error, dir);\n }\n return [];\n};\n\nexport class FilesystemContent implements ContentSourceInterface {\n rootPath: string;\n constructor({ rootPath }: { rootPath?: string }) {\n this.rootPath = rootPath || '';\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n try {\n return await JSON.parse(\n fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'),\n );\n } catch (err: unknown) {\n throw new Error(`Cannot process ${path.join(this.rootPath, filepath)} `);\n }\n }\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n try {\n const files = myGlob(path.join(this.rootPath, filepath), filter);\n return Promise.all(\n files.map((file) => this.get<T>(path.join(filepath, file))),\n );\n } catch (_err: unknown) {\n throw new Error(\n `getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`,\n );\n }\n }\n}\n","import { ContentSourceInterface } from './types';\n\n/**\n * The Content management \"datastore\" which is an abstracted interface to\n * some persistent storage of content needed for Gen3's content management system\n */\n\nexport interface CreateDatabase {\n store: ContentSourceInterface;\n}\n\nexport class ContentDatabase {\n public store: ContentSourceInterface;\n\n constructor(public config: CreateDatabase) {\n this.store = config.store;\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n return this.store.get(filepath);\n }\n\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n // Array<Promise<T>>\n return this.store.getAll(filepath, filter);\n }\n}\n","export const GEN3_FRONTEND_CONFIGURATION_ROOT =\n process.env.GEN3_FRONTEND_CONFIGURATION_ROOT || './config/';\n","import { FilesystemContent } from './filesystem';\nimport { ContentDatabase } from './ContentDatabase';\nimport { GEN3_FRONTEND_CONFIGURATION_ROOT } from './constants';\n\nexport class ContentSource {\n private static instance: ContentSource | null = null;\n private contentDatabase: ContentDatabase;\n\n private constructor() {\n const config = {\n store: new FilesystemContent({\n rootPath: GEN3_FRONTEND_CONFIGURATION_ROOT,\n }),\n };\n this.contentDatabase = new ContentDatabase(config);\n }\n\n public static getInstance(): ContentSource {\n if (!ContentSource.instance) {\n ContentSource.instance = new ContentSource();\n }\n return ContentSource.instance;\n }\n\n // Add methods to access the ContentDatabase functionality\n // For example:\n public getContentDatabase(): ContentDatabase {\n return this.contentDatabase;\n }\n}\n\n// Export a singleton instance\nexport default ContentSource.getInstance();\n","export type RouteRule = {\n loginRequired?: boolean;\n authz?: string[];\n};\n\nexport type RouteConfig = Record<string, RouteRule>;\n\nexport interface AuthorizedRoutesConfig {\n routes: RouteConfig;\n}\n\nexport const DefaultAuthorizedRoutesConfig = {\n routes: {\n '/DataLibrary': {\n loginRequired: true,\n },\n '/Workspace': {\n loginRequired: true,\n },\n '/Profile': {\n loginRequired: true,\n },\n '*': {\n loginRequired: false,\n },\n },\n};\n","import { fetchFence } from '@gen3/core/server';\n\ninterface Gen3JTWKeys {\n keys: string[];\n}\n\n/**\n * Fetches a JSON Web Token (JWT) key from the specified endpoint.\n *\n * This asynchronous function interacts with the Gen3 Fence API to retrieve JWT keys.\n * If the response status is not 200 or the expected key format is not found, the function\n * will return null. Otherwise, it returns the first available key.\n *\n * @function\n * @async\n * @returns {Promise<string|null>} A Promise resolving to the JWT key as a string if available, or null if not.\n */\nexport const fetchJWTKey = async (useService: boolean = false) => {\n const response = await fetchFence<Gen3JTWKeys>(\n {\n endpoint: '/jwt/keys',\n isJSON: true,\n },\n useService,\n );\n if (response.status !== 200) {\n return null;\n }\n\n if (response?.data?.keys.length && response?.data?.keys[0].length > 1) {\n return response.data.keys[0][1];\n }\n return null;\n};\n","import type { NextApiResponse } from 'next';\nimport { errors as joseErrors } from 'jose';\nimport { isFetchError } from '@gen3/core/server';\n\nconst HTTP_INTERNAL_ERROR = 500;\n/**\n * An object that contains predefined error messages for handling JWT-related issues.\n *\n * Properties:\n * - TOKEN_EXPIRED: Error message indicating that the JSON Web Token (JWT) has expired.\n * - TOKEN_INVALID: Error message specifying that the JWT is invalid.\n * - TOKEN_SIGNATURE_INVALID: Error message for when the JWT signature cannot be verified.\n * - JWKS_NO_MATCHING_KEY: Error message indicating that no matching key was found in JWKS\n * (JSON Web Key Set) for JWT verification.\n * - UNKNOWN: General error message for unspecified or unknown errors.\n *\n */\nconst ERRORS = {\n TOKEN_EXPIRED: 'The JWT has expired.',\n TOKEN_INVALID: 'The JWT is invalid.',\n TOKEN_SIGNATURE_INVALID: 'The JWT signature is invalid.',\n JWKS_NO_MATCHING_KEY: 'No matching key found in JWKS for JWT verification.',\n UNKNOWN: 'Unknown error',\n};\n\n/**\n * Handles and returns an appropriate error response based on the provided error.\n *\n * @param {unknown} error - The error object which could be of various types such as fetch errors, JWT errors, or generic errors.\n * @param {NextApiResponse} res - The API response object used to send the error response.\n * @returns {NextApiResponse} - The response object containing the appropriate error status and message.\n *\n * This function evaluates the type of error passed to it and maps these errors to suitable\n * HTTP status codes and human-readable messages. It supports specific cases such as:\n * - Fetch errors.\n * - JSON Web Token (JWT) related errors (expired tokens, invalid tokens, signature issues, missing matching keys).\n * - Standard JavaScript errors.\n * - Unknown errors where it defaults to a generic unknown error message.\n *\n * The response will always include the error status and a message describing the error.\n */\nexport const getWebTokenErrorResponse = (\n error: unknown,\n res: NextApiResponse,\n): NextApiResponse => {\n if (isFetchError(error)) {\n res.status(error.status).json({ message: error.statusText });\n return res;\n }\n\n if (error instanceof joseErrors.JWTExpired) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_EXPIRED });\n return res;\n }\n if (error instanceof joseErrors.JWTInvalid) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWSInvalid) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.TOKEN_SIGNATURE_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWKSNoMatchingKey) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.JWKS_NO_MATCHING_KEY });\n return res;\n }\n\n if (error instanceof Error) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: error.message });\n return res;\n }\n\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.UNKNOWN });\n return res;\n};\n","import type { NextApiRequest, NextApiResponse } from 'next';\nimport { parse } from 'cookie';\nimport { decodeJwt, importSPKI, JWTPayload, jwtVerify } from 'jose';\nimport { fetchJWTKey } from '../../lib/auth/utils';\nimport { getWebTokenErrorResponse } from './errorHandler';\n\nexport const isExpired = (value: number) => value - Date.now() > 0;\n\nexport interface JWTPayloadAndUser extends JWTPayload {\n context: Record<string, string>;\n}\n\n/**\n * returns the access_token expiration, user, and status\n * @param req\n * @param res\n */\nexport default async function handler(\n req: NextApiRequest,\n res: NextApiResponse,\n): Promise<void> {\n try {\n const cookies = req.headers.cookie ? parse(req.headers.cookie) : {};\n let accessToken = cookies.access_token;\n\n // in development mode we support \"credentials login\"\n if (!accessToken && process.env.NODE_ENV === 'development') {\n // NOTE: This cookie can only be accessed from the client side\n // in development mode. Otherwise, the cookie is set as httpOnly\n accessToken = cookies.credentials_token;\n }\n\n if (accessToken) {\n const jwtKey = await fetchJWTKey(process.env.NODE_ENV === 'production');\n if (!jwtKey) {\n res.status(500).json({\n message: 'No JWT Key to verify token',\n });\n return;\n }\n // validate the token\n const publicKey = await importSPKI(jwtKey, 'RS256');\n await jwtVerify(accessToken, publicKey);\n const decodedAccessToken = decodeJwt(accessToken) as JWTPayloadAndUser;\n\n res.status(200).json({\n issued: decodedAccessToken.iat,\n expires: decodedAccessToken.exp,\n userContext: decodedAccessToken.context.user,\n status: decodedAccessToken.exp\n ? isExpired(decodedAccessToken.exp)\n ? 'expired'\n : 'issued'\n : 'invalid',\n });\n return;\n }\n\n res.status(200).json({\n status: 'not present',\n });\n } catch (error: unknown) {\n getWebTokenErrorResponse(error, res); // will update the res object with error\n }\n}\n"],"names":["myGlob","dir","filter","files","fs","readdirSync","file","search","error","console","log","FilesystemContent","rootPath","get","filepath","JSON","parse","readFileSync","path","join","toString","err","Error","getAll","Promise","all","map","_err","ContentDatabase","config","store","GEN3_FRONTEND_CONFIGURATION_ROOT","process","env","ContentSource","instance","contentDatabase","getInstance","getContentDatabase","DefaultAuthorizedRoutesConfig","routes","loginRequired","fetchJWTKey","useService","response","fetchFence","endpoint","isJSON","status","data","keys","length","HTTP_INTERNAL_ERROR","ERRORS","TOKEN_EXPIRED","TOKEN_INVALID","TOKEN_SIGNATURE_INVALID","JWKS_NO_MATCHING_KEY","UNKNOWN","getWebTokenErrorResponse","res","isFetchError","json","message","statusText","joseErrors","JWTExpired","JWTInvalid","JWSInvalid","JWKSNoMatchingKey","isExpired","value","Date","now","handler","req","cookies","headers","cookie","accessToken","access_token","NODE_ENV","credentials_token","jwtKey","publicKey","importSPKI","jwtVerify","decodedAccessToken","decodeJwt","issued","iat","expires","exp","userContext","context","user"],"mappings":";;;;;;AAIA,MAAMA,MAAAA,GAAS,CAACC,GAAAA,EAAaC,MAAAA,GAAAA;IAC3B,IAAI;QACF,MAAMC,KAAAA,GAAQC,EAAAA,CAAGC,WAAW,CAACJ,GAAAA,CAAAA;QAC7B,OAAOE,KAAAA,CAAMD,MAAM,CAAC,CAACI,OAASA,IAAAA,CAAKC,MAAM,CAACL,MAAAA,CAAAA,KAAY,CAAC,CAAA,CAAA;AACzD,IAAA,CAAA,CAAE,OAAOM,KAAAA,EAAY;QACnBC,OAAAA,CAAQC,GAAG,CAAC,cAAA,EAAgBF,KAAAA,EAAOP,GAAAA,CAAAA;AACrC,IAAA;AACA,IAAA,OAAO,EAAE;AACX,CAAA;AAEO,MAAMU,iBAAAA,CAAAA;IAEX,WAAA,CAAY,EAAEC,QAAQ,EAAyB,CAAE;QAC/C,IAAI,CAACA,QAAQ,GAAGA,QAAAA,IAAY,EAAA;AAC9B,IAAA;IAEA,MAAaC,GAAAA,CACXC,QAAgB,EACJ;QACZ,IAAI;AACF,YAAA,OAAO,MAAMC,IAAAA,CAAKC,KAAK,CACrBZ,EAAAA,CAAGa,YAAY,CAACC,IAAAA,CAAKC,IAAI,CAAC,IAAI,CAACP,QAAQ,EAAEE,QAAAA,CAAAA,CAAAA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AAE,OAAOxC,KAAAA,EAAgB;QACvBmD,wBAAAA,CAAyBnD,KAAAA,EAAOoD;AAClC,IAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"server.js","sources":["../../../src/lib/content/filesystem.ts","../../../src/lib/content/ContentDatabase.ts","../../../src/lib/content/constants.ts","../../../src/lib/content/index.ts","../../../src/lib/authz/type.ts","../../../src/lib/auth/utils.ts","../../../src/api/auth/errorHandler.ts","../../../src/api/auth/sessionToken.ts"],"sourcesContent":["import { ContentSourceInterface } from './types';\nimport fs from 'fs';\nimport path from 'path';\n\nconst myGlob = (dir: string, filter: string) => {\n try {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.search(filter) !== -1);\n } catch (error: any) {\n console.log('myGlob error', error, dir);\n }\n return [];\n};\n\nexport class FilesystemContent implements ContentSourceInterface {\n rootPath: string;\n constructor({ rootPath }: { rootPath?: string }) {\n this.rootPath = rootPath || '';\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n try {\n return await JSON.parse(\n fs.readFileSync(path.join(this.rootPath, filepath)).toString('utf8'),\n );\n } catch (err: unknown) {\n throw new Error(`Cannot process ${path.join(this.rootPath, filepath)} `);\n }\n }\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n try {\n const files = myGlob(path.join(this.rootPath, filepath), filter);\n return Promise.all(\n files.map((file) => this.get<T>(path.join(filepath, file))),\n );\n } catch (_err: unknown) {\n throw new Error(\n `getAllCannot process ${path.join(this.rootPath, filepath)}/${filter}`,\n );\n }\n }\n}\n","import { ContentSourceInterface } from './types';\n\n/**\n * The Content management \"datastore\" which is an abstracted interface to\n * some persistent storage of content needed for Gen3's content management system\n */\n\nexport interface CreateDatabase {\n store: ContentSourceInterface;\n}\n\nexport class ContentDatabase {\n public store: ContentSourceInterface;\n\n constructor(public config: CreateDatabase) {\n this.store = config.store;\n }\n\n public async get<T extends Record<string, any>>(\n filepath: string,\n ): Promise<T> {\n return this.store.get(filepath);\n }\n\n public async getAll<T extends Record<string, any>>(\n filepath: string,\n filter: string,\n ): Promise<Array<T>> {\n // Array<Promise<T>>\n return this.store.getAll(filepath, filter);\n }\n}\n","export const GEN3_FRONTEND_CONFIGURATION_ROOT =\n process.env.GEN3_FRONTEND_CONFIGURATION_ROOT || './config/';\n","import { FilesystemContent } from './filesystem';\nimport { ContentDatabase } from './ContentDatabase';\nimport { GEN3_FRONTEND_CONFIGURATION_ROOT } from './constants';\n\nexport class ContentSource {\n private static instance: ContentSource | null = null;\n private contentDatabase: ContentDatabase;\n\n private constructor() {\n const config = {\n store: new FilesystemContent({\n rootPath: GEN3_FRONTEND_CONFIGURATION_ROOT,\n }),\n };\n this.contentDatabase = new ContentDatabase(config);\n }\n\n public static getInstance(): ContentSource {\n if (!ContentSource.instance) {\n ContentSource.instance = new ContentSource();\n }\n return ContentSource.instance;\n }\n\n // Add methods to access the ContentDatabase functionality\n // For example:\n public getContentDatabase(): ContentDatabase {\n return this.contentDatabase;\n }\n\n // ✅ Compatibility helper: allow `ContentSource.getContentDatabase()`\n public static getContentDatabase(): ContentDatabase {\n return ContentSource.getInstance().getContentDatabase();\n }\n}\n\n// Export a singleton instance\nexport default ContentSource.getInstance();\n","export type RouteRule = {\n loginRequired?: boolean;\n authz?: string[];\n};\n\nexport type RouteConfig = Record<string, RouteRule>;\n\nexport interface AuthorizedRoutesConfig {\n routes: RouteConfig;\n}\n\nexport const DefaultAuthorizedRoutesConfig = {\n routes: {\n '/DataLibrary': {\n loginRequired: true,\n },\n '/Workspace': {\n loginRequired: true,\n },\n '/Profile': {\n loginRequired: true,\n },\n '*': {\n loginRequired: false,\n },\n },\n};\n","import { fetchFence } from '@gen3/core/server';\n\ninterface Gen3JTWKeys {\n keys: string[];\n}\n\n/**\n * Fetches a JSON Web Token (JWT) key from the specified endpoint.\n *\n * This asynchronous function interacts with the Gen3 Fence API to retrieve JWT keys.\n * If the response status is not 200 or the expected key format is not found, the function\n * will return null. Otherwise, it returns the first available key.\n *\n * @function\n * @async\n * @returns {Promise<string|null>} A Promise resolving to the JWT key as a string if available, or null if not.\n */\nexport const fetchJWTKey = async (useService: boolean = false) => {\n const response = await fetchFence<Gen3JTWKeys>(\n {\n endpoint: '/jwt/keys',\n isJSON: true,\n },\n useService,\n );\n if (response.status !== 200) {\n return null;\n }\n\n if (response?.data?.keys.length && response?.data?.keys[0].length > 1) {\n return response.data.keys[0][1];\n }\n return null;\n};\n","import type { NextApiResponse } from 'next';\nimport { errors as joseErrors } from 'jose';\nimport { isFetchError } from '@gen3/core/server';\n\nconst HTTP_INTERNAL_ERROR = 500;\n/**\n * An object that contains predefined error messages for handling JWT-related issues.\n *\n * Properties:\n * - TOKEN_EXPIRED: Error message indicating that the JSON Web Token (JWT) has expired.\n * - TOKEN_INVALID: Error message specifying that the JWT is invalid.\n * - TOKEN_SIGNATURE_INVALID: Error message for when the JWT signature cannot be verified.\n * - JWKS_NO_MATCHING_KEY: Error message indicating that no matching key was found in JWKS\n * (JSON Web Key Set) for JWT verification.\n * - UNKNOWN: General error message for unspecified or unknown errors.\n *\n */\nconst ERRORS = {\n TOKEN_EXPIRED: 'The JWT has expired.',\n TOKEN_INVALID: 'The JWT is invalid.',\n TOKEN_SIGNATURE_INVALID: 'The JWT signature is invalid.',\n JWKS_NO_MATCHING_KEY: 'No matching key found in JWKS for JWT verification.',\n UNKNOWN: 'Unknown error',\n};\n\n/**\n * Handles and returns an appropriate error response based on the provided error.\n *\n * @param {unknown} error - The error object which could be of various types such as fetch errors, JWT errors, or generic errors.\n * @param {NextApiResponse} res - The API response object used to send the error response.\n * @returns {NextApiResponse} - The response object containing the appropriate error status and message.\n *\n * This function evaluates the type of error passed to it and maps these errors to suitable\n * HTTP status codes and human-readable messages. It supports specific cases such as:\n * - Fetch errors.\n * - JSON Web Token (JWT) related errors (expired tokens, invalid tokens, signature issues, missing matching keys).\n * - Standard JavaScript errors.\n * - Unknown errors where it defaults to a generic unknown error message.\n *\n * The response will always include the error status and a message describing the error.\n */\nexport const getWebTokenErrorResponse = (\n error: unknown,\n res: NextApiResponse,\n): NextApiResponse => {\n if (isFetchError(error)) {\n res.status(error.status).json({ message: error.statusText });\n return res;\n }\n\n if (error instanceof joseErrors.JWTExpired) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_EXPIRED });\n return res;\n }\n if (error instanceof joseErrors.JWTInvalid) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.TOKEN_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWSInvalid) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.TOKEN_SIGNATURE_INVALID });\n return res;\n }\n if (error instanceof joseErrors.JWKSNoMatchingKey) {\n res\n .status(HTTP_INTERNAL_ERROR)\n .json({ message: ERRORS.JWKS_NO_MATCHING_KEY });\n return res;\n }\n\n if (error instanceof Error) {\n res.status(HTTP_INTERNAL_ERROR).json({ message: error.message });\n return res;\n }\n\n res.status(HTTP_INTERNAL_ERROR).json({ message: ERRORS.UNKNOWN });\n return res;\n};\n","import type { NextApiRequest, NextApiResponse } from 'next';\nimport { parse } from 'cookie';\nimport { decodeJwt, importSPKI, JWTPayload, jwtVerify } from 'jose';\nimport { fetchJWTKey } from '../../lib/auth/utils';\nimport { getWebTokenErrorResponse } from './errorHandler';\n\nexport const isExpired = (value: number) => value - Date.now() > 0;\n\nexport interface JWTPayloadAndUser extends JWTPayload {\n context: Record<string, string>;\n}\n\n/**\n * returns the access_token expiration, user, and status\n * @param req\n * @param res\n */\nexport default async function handler(\n req: NextApiRequest,\n res: NextApiResponse,\n): Promise<void> {\n try {\n const cookies = req.headers.cookie ? parse(req.headers.cookie) : {};\n let accessToken = cookies.access_token;\n\n // in development mode we support \"credentials login\"\n if (!accessToken && process.env.NODE_ENV === 'development') {\n // NOTE: This cookie can only be accessed from the client side\n // in development mode. Otherwise, the cookie is set as httpOnly\n accessToken = cookies.credentials_token;\n }\n\n if (accessToken) {\n const jwtKey = await fetchJWTKey(process.env.NODE_ENV === 'production');\n if (!jwtKey) {\n res.status(500).json({\n message: 'No JWT Key to verify token',\n });\n return;\n }\n // validate the token\n const publicKey = await importSPKI(jwtKey, 'RS256');\n await jwtVerify(accessToken, publicKey);\n const decodedAccessToken = decodeJwt(accessToken) as JWTPayloadAndUser;\n\n res.status(200).json({\n issued: decodedAccessToken.iat,\n expires: decodedAccessToken.exp,\n userContext: decodedAccessToken.context.user,\n status: decodedAccessToken.exp\n ? isExpired(decodedAccessToken.exp)\n ? 'expired'\n : 'issued'\n : 'invalid',\n });\n return;\n }\n\n res.status(200).json({\n status: 'not present',\n });\n } catch (error: unknown) {\n getWebTokenErrorResponse(error, res); // will update the res object with error\n }\n}\n"],"names":["myGlob","dir","filter","files","fs","readdirSync","file","search","error","console","log","FilesystemContent","rootPath","get","filepath","JSON","parse","readFileSync","path","join","toString","err","Error","getAll","Promise","all","map","_err","ContentDatabase","config","store","GEN3_FRONTEND_CONFIGURATION_ROOT","process","env","ContentSource","instance","contentDatabase","getInstance","getContentDatabase","DefaultAuthorizedRoutesConfig","routes","loginRequired","fetchJWTKey","useService","response","fetchFence","endpoint","isJSON","status","data","keys","length","HTTP_INTERNAL_ERROR","ERRORS","TOKEN_EXPIRED","TOKEN_INVALID","TOKEN_SIGNATURE_INVALID","JWKS_NO_MATCHING_KEY","UNKNOWN","getWebTokenErrorResponse","res","isFetchError","json","message","statusText","joseErrors","JWTExpired","JWTInvalid","JWSInvalid","JWKSNoMatchingKey","isExpired","value","Date","now","handler","req","cookies","headers","cookie","accessToken","access_token","NODE_ENV","credentials_token","jwtKey","publicKey","importSPKI","jwtVerify","decodedAccessToken","decodeJwt","issued","iat","expires","exp","userContext","context","user"],"mappings":";;;;;;AAIA,MAAMA,MAAAA,GAAS,CAACC,GAAAA,EAAaC,MAAAA,GAAAA;IAC3B,IAAI;QACF,MAAMC,KAAAA,GAAQC,EAAAA,CAAGC,WAAW,CAACJ,GAAAA,CAAAA;QAC7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
TZNAME:GMT+2
|
|
13
|
+
DTSTART:19700329T020000
|
|
14
|
+
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
|
|
15
|
+
END:DAYLIGHT
|
|
16
|
+
BEGIN:STANDARD
|
|
17
|
+
TZOFFSETFROM:+0200
|
|
18
|
+
TZOFFSETTO:+0100
|
|
19
|
+
TZNAME:GMT+1
|
|
20
|
+
DTSTART:19701025T030000
|
|
21
|
+
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
|
|
22
|
+
END:STANDARD
|
|
23
|
+
END:VTIMEZONE
|
|
24
|
+
BEGIN:VEVENT
|
|
25
|
+
DTSTART;TZID=Europe/Amsterdam:20250205T163000
|
|
26
|
+
DTEND;TZID=Europe/Amsterdam:20250205T173000
|
|
27
|
+
DTSTAMP:20250201T135749Z
|
|
28
|
+
ORGANIZER;CN=Aniket Mitra:mailto:aniket@computationelewetenschapsgroep.com
|
|
29
|
+
UID:50oi6m3cerjvvpbnl708bqaapu@google.com
|
|
30
|
+
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;RSVP=TRUE
|
|
31
|
+
;CN=Aniket Mitra;X-NUM-GUESTS=0:mailto:aniket@computationelewetenschapsgroe
|
|
32
|
+
p.com
|
|
33
|
+
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
|
|
34
|
+
TRUE;CN=craigrbarnes@uchicago.edu;X-NUM-GUESTS=0:mailto:craigrbarnes@uchica
|
|
35
|
+
go.edu
|
|
36
|
+
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
|
|
37
|
+
TRUE;CN=aryantpratapsingh@gmail.com;X-NUM-GUESTS=0:mailto:aryantpratapsingh
|
|
38
|
+
@gmail.com
|
|
39
|
+
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
|
|
40
|
+
TRUE;CN=mail2shubho@gmail.com;X-NUM-GUESTS=0:mailto:mail2shubho@gmail.com
|
|
41
|
+
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
|
|
42
|
+
TRUE;CN=itabhiyanta@gmail.com;X-NUM-GUESTS=0:mailto:itabhiyanta@gmail.com
|
|
43
|
+
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
|
|
44
|
+
TRUE;CN=craig.barnes@intelligentlight.com;X-NUM-GUESTS=0:mailto:craig.barne
|
|
45
|
+
s@intelligentlight.com
|
|
46
|
+
X-GOOGLE-CONFERENCE:https://meet.google.com/cwe-owoc-vhb
|
|
47
|
+
X-MICROSOFT-CDO-OWNERAPPTID:-1774633336
|
|
48
|
+
CREATED:20250201T135748Z
|
|
49
|
+
DESCRIPTION:-::~:~::~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~
|
|
50
|
+
:~:~:~:~:~:~:~:~::~:~::-\nJoin with Google Meet: https://meet.google.com/cw
|
|
51
|
+
e-owoc-vhb\nOr dial: (NL) +31 20 257 4879 PIN: 812850777#\nMore phone numbe
|
|
52
|
+
rs: https://tel.meet/cwe-owoc-vhb?pin=1610194639690&hs=7\n\nLearn more abou
|
|
53
|
+
t Meet at: https://support.google.com/a/users/answer/9282720\n\nPlease do n
|
|
54
|
+
ot edit this section.\n-::~:~::~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:
|
|
55
|
+
~:~:~:~:~:~:~:~:~:~:~:~:~:~::~:~::-
|
|
56
|
+
LAST-MODIFIED:20250201T135748Z
|
|
57
|
+
LOCATION:
|
|
58
|
+
SEQUENCE:0
|
|
59
|
+
STATUS:CONFIRMED
|
|
60
|
+
SUMMARY:Boskalis DT
|
|
61
|
+
TRANSP:OPAQUE
|
|
62
|
+
BEGIN:VALARM
|
|
63
|
+
ACTION:DISPLAY
|
|
64
|
+
DESCRIPTION:This is an event reminder
|
|
65
|
+
TRIGGER:-P0DT0H10M0S
|
|
66
|
+
END:VALARM
|
|
67
|
+
END:VEVENT
|
|
68
|
+
END:VCALENDAR
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# TextContent Component Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The TextContent component is a versatile React component designed to render various types of text-based content with different formatting options. It supports multiple content types including plain text, HTML, Markdown, text arrays, and text with email or link attachments.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import TextContent, { ContentType } from './path/to/TextContent';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
|------|------|---------|-------------|
|
|
17
|
+
| text | `string \| string[]` | Required | The content to be displayed. Can be a single string or an array of strings. |
|
|
18
|
+
| className | `string` | `'inline text-base-contrast-max font-medium margin-block-start-1 margin-block-end-1'` | Custom Tailwind CSS classes for styling the component. |
|
|
19
|
+
| type | `ContentType` | `ContentType.Text` | Determines how the content will be rendered. |
|
|
20
|
+
| email | `string` | `undefined` | Optional email address for TextWithEmail type. |
|
|
21
|
+
| link | `string` | `undefined` | Optional URL for TextWithLink type. |
|
|
22
|
+
| linkText | `string` | `undefined` | Optional display text for the link. |
|
|
23
|
+
|
|
24
|
+
## Content Types
|
|
25
|
+
|
|
26
|
+
The component supports six different content types through the `ContentType` enum:
|
|
27
|
+
|
|
28
|
+
### 1. Text (`ContentType.Text`)
|
|
29
|
+
- Basic text rendering
|
|
30
|
+
- Renders content in a simple `<div>` with a `<p>` tag
|
|
31
|
+
- Default content type if none specified
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
<TextContent text="Hello, world!" />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Text Array (`ContentType.TextArray`)
|
|
38
|
+
- Renders an array of strings as separate paragraphs
|
|
39
|
+
- Each paragraph is wrapped in a `<p>` tag with `my-2` spacing
|
|
40
|
+
- Automatically generates unique keys using a hash function
|
|
41
|
+
|
|
42
|
+
```jsx
|
|
43
|
+
<TextContent
|
|
44
|
+
type={ContentType.TextArray}
|
|
45
|
+
text={["First paragraph", "Second paragraph"]}
|
|
46
|
+
/>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. HTML (`ContentType.Html`)
|
|
50
|
+
- Renders HTML content using dangerouslySetInnerHTML
|
|
51
|
+
- Joins arrays into a single string if provided
|
|
52
|
+
- Wrapped in a `<p>` tag with custom styling
|
|
53
|
+
|
|
54
|
+
```jsx
|
|
55
|
+
<TextContent
|
|
56
|
+
type={ContentType.Html}
|
|
57
|
+
text="<strong>Bold</strong> and <em>italic</em> text"
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 4. Markdown (`ContentType.Markdown`)
|
|
62
|
+
- Renders Markdown content using react-markdown
|
|
63
|
+
- Includes support for GitHub Flavored Markdown (GFM)
|
|
64
|
+
- Custom styling for paragraphs, lists, and list items
|
|
65
|
+
- Default text size of `text-lg` for paragraphs
|
|
66
|
+
|
|
67
|
+
```jsx
|
|
68
|
+
<TextContent
|
|
69
|
+
type={ContentType.Markdown}
|
|
70
|
+
text="# Header\n\nThis is **bold** text"
|
|
71
|
+
/>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 5. Text With Email (`ContentType.TextWithEmail`)
|
|
75
|
+
- Combines text content with a clickable email link
|
|
76
|
+
- Email is appended to the text with proper formatting
|
|
77
|
+
- Uses Mantine's Anchor component for the email link
|
|
78
|
+
|
|
79
|
+
```jsx
|
|
80
|
+
<TextContent
|
|
81
|
+
type={ContentType.TextWithEmail}
|
|
82
|
+
text="Contact us at"
|
|
83
|
+
email="example@domain.com"
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 6. Text With Link (`ContentType.TextWithLink`)
|
|
88
|
+
- Combines text content with a clickable URL
|
|
89
|
+
- Optional custom link text
|
|
90
|
+
- Uses Mantine's Anchor component for the link
|
|
91
|
+
|
|
92
|
+
```jsx
|
|
93
|
+
<TextContent
|
|
94
|
+
type={ContentType.TextWithLink}
|
|
95
|
+
text="Visit our website at"
|
|
96
|
+
link="https://example.com"
|
|
97
|
+
linkText="Example.com"
|
|
98
|
+
/>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Styling
|
|
102
|
+
|
|
103
|
+
The component uses Tailwind CSS for styling with a default className of:
|
|
104
|
+
```
|
|
105
|
+
inline text-base-contrast-max font-medium margin-block-start-1 margin-block-end-1
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Custom styles can be added through the `className` prop and will be merged with default styles using `tailwind-merge`.
|
|
109
|
+
|
|
110
|
+
## Dependencies
|
|
111
|
+
|
|
112
|
+
The component requires the following dependencies:
|
|
113
|
+
- React
|
|
114
|
+
- react-markdown
|
|
115
|
+
- remark-gfm
|
|
116
|
+
- @mantine/core
|
|
117
|
+
- tailwind-merge
|
|
118
|
+
|
|
119
|
+
## Error Handling
|
|
120
|
+
|
|
121
|
+
- For TextWithLink type, displays "Link is not defined" if no link is provided
|
|
122
|
+
- Automatically converts text to string using toString() in default case
|
|
123
|
+
- Handles both string and string[] inputs gracefully
|
|
124
|
+
|
|
125
|
+
## Best Practices
|
|
126
|
+
|
|
127
|
+
1. **Content Type Selection**
|
|
128
|
+
- Use plain Text for simple string content
|
|
129
|
+
- Use TextArray for multiple paragraphs
|
|
130
|
+
- Use Markdown for formatted content
|
|
131
|
+
- Use HTML only when necessary due to security implications
|
|
132
|
+
|
|
133
|
+
2. **Styling**
|
|
134
|
+
- Prefer using Tailwind classes for styling
|
|
135
|
+
- Use className prop for custom styles
|
|
136
|
+
- Avoid inline styles
|
|
137
|
+
|
|
138
|
+
3. **Performance**
|
|
139
|
+
- Use TextArray for large content blocks
|
|
140
|
+
- Provide unique content to avoid unnecessary re-renders
|
|
141
|
+
- Consider memoization for frequently updated content
|
|
142
|
+
|
|
143
|
+
## Examples
|
|
144
|
+
|
|
145
|
+
### Basic Usage
|
|
146
|
+
```jsx
|
|
147
|
+
<TextContent text="Simple text content" />
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Markdown with Custom Styling
|
|
151
|
+
```jsx
|
|
152
|
+
<TextContent
|
|
153
|
+
type={ContentType.Markdown}
|
|
154
|
+
text="# Title\n\nContent with **bold** text"
|
|
155
|
+
className="prose dark:prose-invert"
|
|
156
|
+
/>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Text Array with Custom Styling
|
|
160
|
+
```jsx
|
|
161
|
+
<TextContent
|
|
162
|
+
type={ContentType.TextArray}
|
|
163
|
+
text={["First paragraph", "Second paragraph"]}
|
|
164
|
+
className="text-lg font-serif"
|
|
165
|
+
/>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Email Contact
|
|
169
|
+
```jsx
|
|
170
|
+
<TextContent
|
|
171
|
+
type={ContentType.TextWithEmail}
|
|
172
|
+
text="For support, please contact"
|
|
173
|
+
email="support@example.com"
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### External Link
|
|
178
|
+
```jsx
|
|
179
|
+
<TextContent
|
|
180
|
+
type={ContentType.TextWithLink}
|
|
181
|
+
text="Check out our documentation at"
|
|
182
|
+
link="https://docs.example.com"
|
|
183
|
+
linkText="our docs site"
|
|
184
|
+
/>
|
|
185
|
+
```
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { JestConfigWithTsJest } from 'ts-jest';
|
|
2
|
+
|
|
3
|
+
const jestConfig: JestConfigWithTsJest = {
|
|
4
|
+
roots: ['<rootDir>/src'],
|
|
5
|
+
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'],
|
|
6
|
+
testEnvironment: 'jsdom',
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
'^@/app(.*)$': '<rootDir>/src/app/$1',
|
|
9
|
+
'^@/components(.*)$': '<rootDir>/src/components/$1',
|
|
10
|
+
'^@/features/(.*)$': '<rootDir>/src/features/$1',
|
|
11
|
+
'^@/utils/(.*)$': '<rootDir>/src/utils/$1',
|
|
12
|
+
'^redux-persist/lib/storage/createWebStorage$':
|
|
13
|
+
'<rootDir>/__mocks__/createWebStorageMock.js',
|
|
14
|
+
'jsonpath-plus': '<rootDir>/../../node_modules/jsonpath-plus',
|
|
15
|
+
flat: '<rootDir>/../../node_modules/flat',
|
|
16
|
+
},
|
|
17
|
+
transform: {
|
|
18
|
+
'^.+\\.(ts|tsx)?$': [
|
|
19
|
+
'ts-jest',
|
|
20
|
+
{
|
|
21
|
+
tsconfig: 'tsconfig.test.json',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
'<rootDir>/../../node_modules/(flat|jsonpath-plus)/.+\\.(j|t)s?$':
|
|
25
|
+
'ts-jest',
|
|
26
|
+
},
|
|
27
|
+
transformIgnorePatterns: [
|
|
28
|
+
'<rootDir>/../../node_modules/(?!(flat|jsonpath-plus))',
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default jestConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gen3/frontend",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.5",
|
|
4
4
|
"description": "Gen3 frontend components, content management, and pages",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Center for Translational Data Science",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "npm run compile && npm run types && npm run rollup",
|
|
28
28
|
"build:clean": "npm run clean && npm run build",
|
|
29
29
|
"build:watch": "npm run compile --stream && npm run rollup -- --watch",
|
|
30
|
-
"dev": "
|
|
30
|
+
"dev": "echo no dev tasks"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
@@ -45,6 +45,11 @@
|
|
|
45
45
|
"import": "./dist/server/esm/server.js",
|
|
46
46
|
"require": "./dist/server/cjs/server.cjs"
|
|
47
47
|
},
|
|
48
|
+
"./pages": {
|
|
49
|
+
"types": "./dist/pages.d.ts",
|
|
50
|
+
"import": "./dist/pages/esm/pages.js",
|
|
51
|
+
"require": "./dist/pages/cjs/pages.cjs"
|
|
52
|
+
},
|
|
48
53
|
"./dist/styles.css": "./dist/styles.css"
|
|
49
54
|
},
|
|
50
55
|
"style": "dist/styles.css",
|
|
@@ -57,7 +62,7 @@
|
|
|
57
62
|
"@dnd-kit/core": "^6.3.1",
|
|
58
63
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
59
64
|
"@dnd-kit/sortable": "^10.0.0",
|
|
60
|
-
"@gen3/core": "^0.12.
|
|
65
|
+
"@gen3/core": "^0.12.5",
|
|
61
66
|
"@graphiql/react": "^0.23.1",
|
|
62
67
|
"@hello-pangea/dnd": "^17.0.0",
|
|
63
68
|
"@iconify-icon/react": "^3.0.3",
|
|
@@ -93,64 +98,25 @@
|
|
|
93
98
|
"json-file-database": "^2.0.3",
|
|
94
99
|
"mantine-react-table": "^2.0.0-beta.9",
|
|
95
100
|
"mathjs": "^14.6.0",
|
|
96
|
-
"minisearch": "^
|
|
101
|
+
"minisearch": "^7.1.2",
|
|
97
102
|
"next": "^15.5.9",
|
|
98
103
|
"next-compose-plugins": "^2.2.1",
|
|
99
104
|
"next-images": "^1.8.5",
|
|
100
|
-
"node-json-db": "^2.3.0",
|
|
101
105
|
"pluralize": "^8.0.0",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"react-cookie": "^7.2.2",
|
|
105
|
-
"react-fast-compare": "^3.2.2",
|
|
106
|
-
"react-icons": "^4.10.1",
|
|
107
|
-
"react-markdown": "^9.1.0",
|
|
108
|
-
"react-minisearch": "^6.3.0",
|
|
109
|
-
"react-plotly.js": "^2.5.1",
|
|
110
|
-
"react-redux": "^8.1.0",
|
|
111
|
-
"react-table": "^7.8.0",
|
|
112
|
-
"remark-gfm": "^4.0.0",
|
|
113
|
-
"tailwind-merge": "^2.5.2",
|
|
114
|
-
"tailwind-styled-components": "^2.2.0",
|
|
115
|
-
"use-deep-compare": "^1.3.0",
|
|
116
|
-
"victory": "^36.6.11",
|
|
106
|
+
"react-minisearch": "^7.1.4",
|
|
107
|
+
"typescript-pluralize": "^1.0.1",
|
|
117
108
|
"yaml": "^2.3.4"
|
|
118
109
|
},
|
|
119
110
|
"devDependencies": {
|
|
120
111
|
"@iconify/types": "^2.0.0",
|
|
121
|
-
"
|
|
122
|
-
"@swc/core": "^1.7.28",
|
|
123
|
-
"@swc/jest": "^0.2.36",
|
|
124
|
-
"@testing-library/user-event": "^14.5.2",
|
|
125
|
-
"@types/color": "^3.0.3",
|
|
126
|
-
"@types/estree": "^1.0.0",
|
|
127
|
-
"@types/file-saver": "^2.0.5",
|
|
128
|
-
"@types/isomorphic-fetch": "^0.0.36",
|
|
129
|
-
"@types/jest": "^29.2.3",
|
|
130
|
-
"@types/lodash": "^4.14.191",
|
|
131
|
-
"@types/mdx": "^2.0.3",
|
|
132
|
-
"@types/pluralize": "^0.0.33",
|
|
133
|
-
"@types/react": "^18.3.18",
|
|
134
|
-
"@types/react-dom": "^18.3.5",
|
|
135
|
-
"@types/react-table": "^7.7.15",
|
|
136
|
-
"@types/recharts": "^1.8.29",
|
|
137
|
-
"@types/tinycolor2": "^1.4.4",
|
|
138
|
-
"@types/uuid": "^9.0.4",
|
|
139
|
-
"autoprefixer": "^10.4.15",
|
|
140
|
-
"css-loader": "^6.8.1",
|
|
141
|
-
"html-webpack-plugin": "^5.5.0",
|
|
142
|
-
"postcss": "^8.4.29",
|
|
143
|
-
"react-what-changed": "^1.1.2",
|
|
144
|
-
"style-loader": "^3.3.2",
|
|
112
|
+
"next": "^15.5.9",
|
|
145
113
|
"swr": "^2.2.5"
|
|
146
114
|
},
|
|
147
115
|
"peerDependencies": {
|
|
116
|
+
"next": "^15.5.9",
|
|
148
117
|
"react": "^18.3.1",
|
|
149
118
|
"react-dom": "^18.3.1",
|
|
150
119
|
"tailwindcss": "^3.4.18"
|
|
151
120
|
},
|
|
152
|
-
"
|
|
153
|
-
"dist"
|
|
154
|
-
],
|
|
155
|
-
"gitHead": "868bcbb03f937453d64980b7b50bfcb1f5ec20ca"
|
|
121
|
+
"gitHead": "9807ce76c97977628a1618e18b511e4cd6f56244"
|
|
156
122
|
}
|