synapse-react-client 4.0.20 → 4.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SWC.index.d.ts +1 -0
- package/dist/SWC.index.d.ts.map +1 -1
- package/dist/SWC.index.js +2 -1
- package/dist/SWC.index.js.map +1 -1
- package/dist/components/CardContainer/CardConfiguration.d.ts +2 -0
- package/dist/components/CardContainer/CardConfiguration.d.ts.map +1 -1
- package/dist/components/CardContainer/CardContainer.d.ts.map +1 -1
- package/dist/components/CardContainer/CardContainer.js +44 -50
- package/dist/components/CardContainer/CardContainer.js.map +1 -1
- package/dist/components/CardContainerLogic/CardContainerLogic.d.ts +14 -0
- package/dist/components/CardContainerLogic/CardContainerLogic.d.ts.map +1 -1
- package/dist/components/CardContainerLogic/CardContainerLogic.js +64 -40
- package/dist/components/CardContainerLogic/CardContainerLogic.js.map +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js +1 -1
- package/dist/components/ChallengeSubmission/ChallengeSubmissionStepper.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.css +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.js +16 -16
- package/dist/components/DataExplorer/DataExplorer.module.js.map +1 -1
- package/dist/components/DataExplorer/DataExplorer.module.scss +26 -7
- package/dist/components/DataGrid/DataGrid.d.ts +1 -0
- package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +72 -72
- package/dist/components/DataGrid/DataGrid.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +209 -206
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts +6 -3
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts.map +1 -1
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js +54 -46
- package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js.map +1 -1
- package/dist/components/DataGrid/hooks/useColumnResizeHandles.d.ts.map +1 -1
- package/dist/components/DataGrid/hooks/useColumnResizeHandles.js +1 -1
- package/dist/components/DataGrid/hooks/useColumnResizeHandles.js.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.d.ts.map +1 -1
- package/dist/components/DataGrid/useDataGridWebsocket.js +68 -67
- package/dist/components/DataGrid/useDataGridWebsocket.js.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.d.ts +1 -0
- package/dist/components/DataGrid/utils/columnFactory.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/columnFactory.js +5 -3
- package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/modelColsToGrid.js +15 -14
- package/dist/components/DataGrid/utils/modelColsToGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts +7 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.js +8 -0
- package/dist/components/DataGrid/utils/normalizeWebsocketError.js.map +1 -0
- package/dist/components/GenericCard/GenericCard.d.ts +2 -0
- package/dist/components/GenericCard/GenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/GenericCard.js +76 -64
- package/dist/components/GenericCard/GenericCard.js.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.d.ts.map +1 -1
- package/dist/components/GenericCard/TableRowGenericCard.js +33 -25
- package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
- package/dist/components/Goals/Goals.d.ts +8 -0
- package/dist/components/Goals/Goals.d.ts.map +1 -1
- package/dist/components/Goals/Goals.js +54 -40
- package/dist/components/Goals/Goals.js.map +1 -1
- package/dist/components/Plot/SynapseSankeyPlot.css +1 -0
- package/dist/components/Plot/SynapseSankeyPlot.d.ts +44 -2
- package/dist/components/Plot/SynapseSankeyPlot.d.ts.map +1 -1
- package/dist/components/Plot/SynapseSankeyPlot.js +343 -38
- package/dist/components/Plot/SynapseSankeyPlot.js.map +1 -1
- package/dist/components/Plot/SynapseSankeyPlot.module.js +15 -0
- package/dist/components/Plot/SynapseSankeyPlot.module.js.map +1 -0
- package/dist/components/Plot/SynapseSankeyPlot.module.scss +63 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts +9 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js +69 -0
- package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js.map +1 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts +13 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js +11 -0
- package/dist/components/ProjectVisibilityChip/getProjectVisibilityFromACL.js.map +1 -0
- package/dist/components/ProjectVisibilityChip/index.d.ts +5 -0
- package/dist/components/ProjectVisibilityChip/index.d.ts.map +1 -0
- package/dist/components/ProjectVisibilityChip/index.js +7 -0
- package/dist/components/ProjectVisibilityChip/index.js.map +1 -0
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.d.ts.map +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js +1 -1
- package/dist/components/QueryVisualizationWrapper/QueryVisualizationWrapper.js.map +1 -1
- package/dist/components/QueryWrapperPlotNav/RowSetView.d.ts.map +1 -1
- package/dist/components/QueryWrapperPlotNav/RowSetView.js +9 -12
- package/dist/components/QueryWrapperPlotNav/RowSetView.js.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.d.ts +7 -15
- package/dist/components/RssFeedCards/RssFeedCards.d.ts.map +1 -1
- package/dist/components/RssFeedCards/RssFeedCards.js +114 -123
- package/dist/components/RssFeedCards/RssFeedCards.js.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts +13 -12
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.d.ts.map +1 -1
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js +88 -77
- package/dist/components/SearchQueryWrapper/SearchQueryUseQueryOptions.js.map +1 -1
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.d.ts.map +1 -1
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js +63 -74
- package/dist/components/SynapseTable/TopLevelControls/TopLevelControls.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/ColumnModelForm.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js +72 -68
- package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts +27 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.js +47 -36
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormReducer.d.ts +12 -12
- package/dist/components/TableColumnSchemaEditor/Validators/BooleanSchema.d.ts +4 -1
- package/dist/components/TableColumnSchemaEditor/Validators/BooleanSchema.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.d.ts +167 -517
- package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.js +65 -65
- package/dist/components/TableColumnSchemaEditor/Validators/ColumnModelValidator.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/DatetimeSchema.d.ts +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/DatetimeSchema.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.d.ts +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.js +6 -13
- package/dist/components/TableColumnSchemaEditor/Validators/DoubleSchema.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/EntityIdSchema.d.ts +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/EntityIdSchema.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.d.ts +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.js +2 -2
- package/dist/components/TableColumnSchemaEditor/Validators/IntegerSchema.js.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/OptionalStringSchema.d.ts +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/OptionalStringSchema.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.d.ts +2 -2
- package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.d.ts.map +1 -1
- package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.js +15 -16
- package/dist/components/TableColumnSchemaEditor/Validators/getZodSchemaForColumnType.js.map +1 -1
- package/dist/components/UserCardList/UserCardList.d.ts +2 -20
- package/dist/components/UserCardList/UserCardList.d.ts.map +1 -1
- package/dist/components/UserCardList/UserCardList.js +49 -72
- package/dist/components/UserCardList/UserCardList.js.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.d.ts +13 -0
- package/dist/components/UserCardList/UserCardListRotate.d.ts.map +1 -1
- package/dist/components/UserCardList/UserCardListRotate.js +82 -57
- package/dist/components/UserCardList/UserCardListRotate.js.map +1 -1
- package/dist/mocks/mockSearchQueryData.js +2 -2
- package/dist/mocks/mockSearchQueryData.js.map +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/searchQueryHandlers.js +6 -3
- package/dist/mocks/msw/handlers/searchQueryHandlers.js.map +1 -1
- package/dist/mocks/query/mockUserCardTableQueryResultBundle.d.ts +13 -0
- package/dist/mocks/query/mockUserCardTableQueryResultBundle.d.ts.map +1 -1
- package/dist/mocks/query/mockUserCardTableQueryResultBundle.js +27 -0
- package/dist/mocks/query/mockUserCardTableQueryResultBundle.js.map +1 -1
- package/dist/style/abstracts/_cssVariables.scss +1 -0
- package/dist/style/components/_cards.scss +10 -0
- package/dist/style/components/_data-grid-extra.css +1 -1
- package/dist/style/components/_data-grid-extra.scss +7 -1
- package/dist/style/main.css +1 -1
- package/dist/synapse-client/SynapseClient.d.ts.map +1 -1
- package/dist/synapse-client/SynapseClient.js +497 -495
- package/dist/synapse-client/SynapseClient.js.map +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +1 -0
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +3 -0
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/index.js +46 -44
- package/dist/synapse-queries/user/index.js +3 -3
- package/dist/synapse-queries/user/useUserBundle.d.ts +12 -0
- package/dist/synapse-queries/user/useUserBundle.d.ts.map +1 -1
- package/dist/synapse-queries/user/useUserBundle.js +50 -36
- package/dist/synapse-queries/user/useUserBundle.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts +10 -5
- package/dist/utils/AppUtils/session/SessionInitializedGuard.d.ts.map +1 -1
- package/dist/utils/AppUtils/session/SessionInitializedGuard.js +13 -9
- package/dist/utils/AppUtils/session/SessionInitializedGuard.js.map +1 -1
- package/dist/utils/functions/SqlFunctions.d.ts +1 -1
- package/dist/utils/functions/SqlFunctions.d.ts.map +1 -1
- package/dist/utils/functions/SqlFunctions.js +1 -1
- package/dist/utils/functions/SqlFunctions.js.map +1 -1
- package/package.json +7 -5
|
@@ -1,135 +1,126 @@
|
|
|
1
1
|
import e from "../../assets/icons/NoData.js";
|
|
2
2
|
import { LargeButton as t } from "../styled/LargeButton.js";
|
|
3
3
|
import { ForwardRef as n } from "../../assets/icons/subscribe_plus.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useState as r } from "react";
|
|
5
5
|
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
-
import s from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import { queryOptions as s, useQuery as c } from "@tanstack/react-query";
|
|
7
|
+
import l from "dayjs";
|
|
8
|
+
import u from "react-mailchimp-subscribe";
|
|
9
|
+
import d from "rss-parser";
|
|
9
10
|
//#region src/components/RssFeedCards/RssFeedCards.tsx
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
isShowingSubscribeUI: !1
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
componentDidMount() {
|
|
20
|
-
this._isMounted = !0;
|
|
21
|
-
let { url: e, filter: t } = this.props, n = t?.value, r = t?.type, i = `${e}${n ? `/${r ?? "tag"}/${n.replace(" ", "-")}` : ""}`, a = `${i}/?feed=rss2`;
|
|
22
|
-
fetch(a).then((e) => e.text()).then((e) => u.parseString(e)).then((e) => {
|
|
23
|
-
this._isMounted && this.setState({
|
|
24
|
-
rssFeed: e,
|
|
25
|
-
allItemsUrl: i
|
|
26
|
-
});
|
|
27
|
-
}).catch((e) => {
|
|
28
|
-
this._isMounted && this.setState({ isLoadingError: !0 });
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
componentWillUnmount() {
|
|
32
|
-
this._isMounted = !1;
|
|
33
|
-
}
|
|
34
|
-
onClickSubscribe = () => {
|
|
35
|
-
this.setState({ isShowingSubscribeUI: !0 });
|
|
11
|
+
var f = new d();
|
|
12
|
+
function p(e, t) {
|
|
13
|
+
let n = t?.value, r = t?.type, i = `${e}${n ? `/${r ?? "tag"}/${n.replace(" ", "-")}` : ""}`;
|
|
14
|
+
return {
|
|
15
|
+
allItemsUrl: i,
|
|
16
|
+
feedUrl: `${i}/?feed=rss2`
|
|
36
17
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/* @__PURE__ */ a("div", {
|
|
64
|
-
className: "SRC-marginBottomTop",
|
|
65
|
-
children: /* @__PURE__ */ a(c, { url: this.props.mailChimpUrl })
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})]
|
|
69
|
-
}), /* @__PURE__ */ o("div", {
|
|
70
|
-
className: "Feed",
|
|
18
|
+
}
|
|
19
|
+
function m(e) {
|
|
20
|
+
return s({
|
|
21
|
+
queryKey: ["rssFeed", e],
|
|
22
|
+
queryFn: () => fetch(e).then((e) => e.text()).then((e) => f.parseString(e))
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function h(s) {
|
|
26
|
+
let { url: d, filter: f, itemsToShow: h, allowCategories: g, mailChimpListName: _, mailChimpUrl: v, viewAllNewsButtonText: y } = s, { allItemsUrl: b, feedUrl: x } = p(d, f), { data: S, isError: C } = c(m(x)), [w, T] = r(!1);
|
|
27
|
+
return S?.items?.length === 0 ? /* @__PURE__ */ o("div", {
|
|
28
|
+
className: "text-center SRCBorderedPanel SRCBorderedPanel--padded2x",
|
|
29
|
+
children: [e, /* @__PURE__ */ a("div", {
|
|
30
|
+
style: {
|
|
31
|
+
marginTop: "20px",
|
|
32
|
+
fontStyle: "italic"
|
|
33
|
+
},
|
|
34
|
+
children: "There are no items currently available"
|
|
35
|
+
})]
|
|
36
|
+
}) : /* @__PURE__ */ o(i, { children: [v && /* @__PURE__ */ o("div", {
|
|
37
|
+
className: "FeedSubscribe",
|
|
38
|
+
children: [!w && /* @__PURE__ */ o("a", {
|
|
39
|
+
className: "FeedSubscribeToNewsLink SRC-no-border-bottom-imp",
|
|
40
|
+
onClick: () => T(!0),
|
|
41
|
+
children: [/* @__PURE__ */ a(n, { title: "Subscribe to News" }), "Subscribe to News"]
|
|
42
|
+
}), w && /* @__PURE__ */ o("div", {
|
|
43
|
+
className: "MailchimpSubscribeContainer",
|
|
71
44
|
children: [
|
|
45
|
+
/* @__PURE__ */ a(n, { title: "Subscribe to News" }),
|
|
46
|
+
/* @__PURE__ */ o("p", { children: [
|
|
47
|
+
"Subscribe to receive the ",
|
|
48
|
+
_,
|
|
49
|
+
" by e-mail, which provides information and updates related to the Portal. You can opt out at any time by using the unsubscribe link within the e-mail. We will not share your information with any third parties or use it for any other purposes."
|
|
50
|
+
] }),
|
|
72
51
|
/* @__PURE__ */ a("div", {
|
|
73
|
-
className: "
|
|
74
|
-
children:
|
|
75
|
-
|
|
76
|
-
className: "FeedItem",
|
|
77
|
-
children: /* @__PURE__ */ o("div", { children: [
|
|
78
|
-
this.props.allowCategories && this.props.allowCategories.length > 0 && /* @__PURE__ */ a("div", {
|
|
79
|
-
className: "FeedItemCategories",
|
|
80
|
-
children: e.categories.map((t) => {
|
|
81
|
-
let n = t.toLowerCase();
|
|
82
|
-
return this.props.allowCategories?.findIndex((e) => n === e.toLowerCase()) === -1 ? /* @__PURE__ */ a(i, {}) : /* @__PURE__ */ a("a", {
|
|
83
|
-
href: `${this.state.rssFeed.link}/tag/${t.replace(" ", "-")}`,
|
|
84
|
-
className: "SRC-no-border-bottom-imp",
|
|
85
|
-
target: "_blank",
|
|
86
|
-
rel: "noopener noreferrer",
|
|
87
|
-
children: /* @__PURE__ */ a("div", {
|
|
88
|
-
className: "FeedItemCategory",
|
|
89
|
-
children: t
|
|
90
|
-
})
|
|
91
|
-
}, `${e.guid}_${t}`);
|
|
92
|
-
})
|
|
93
|
-
}),
|
|
94
|
-
/* @__PURE__ */ a("p", {
|
|
95
|
-
className: "FeedItemDate",
|
|
96
|
-
children: s(e.isoDate).format("MMMM YYYY")
|
|
97
|
-
}),
|
|
98
|
-
/* @__PURE__ */ a("p", {
|
|
99
|
-
className: "FeedItemTitle",
|
|
100
|
-
children: e.title
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ a("div", {
|
|
103
|
-
className: "FeedItemDescription",
|
|
104
|
-
children: e.contentSnippet.replace(/\[...\]|\[…\]/gm, "…")
|
|
105
|
-
}),
|
|
106
|
-
/* @__PURE__ */ a("a", {
|
|
107
|
-
className: "FeedItemLink",
|
|
108
|
-
href: e.link,
|
|
109
|
-
target: "_blank",
|
|
110
|
-
rel: "noopener noreferrer",
|
|
111
|
-
children: "Continue reading"
|
|
112
|
-
})
|
|
113
|
-
] })
|
|
114
|
-
}, e.guid);
|
|
115
|
-
})
|
|
116
|
-
}),
|
|
117
|
-
this.state.rssFeed.items && this.state.rssFeed.items.length > this.props.itemsToShow && this.state.allItemsUrl && /* @__PURE__ */ a("div", {
|
|
118
|
-
className: "FeedViewAllNewsButtonContainer",
|
|
119
|
-
children: /* @__PURE__ */ a(t, {
|
|
120
|
-
color: "secondary",
|
|
121
|
-
variant: "contained",
|
|
122
|
-
onClick: () => window.open(this.state.allItemsUrl, "_blank", "noopener"),
|
|
123
|
-
target: "_blank",
|
|
124
|
-
children: r ?? "View All News"
|
|
125
|
-
})
|
|
126
|
-
}),
|
|
127
|
-
this.state.isLoadingError && /* @__PURE__ */ o("div", { children: ["Unable to load feed: ", this.props.url] })
|
|
52
|
+
className: "SRC-marginBottomTop",
|
|
53
|
+
children: /* @__PURE__ */ a(u, { url: v })
|
|
54
|
+
})
|
|
128
55
|
]
|
|
129
|
-
})]
|
|
130
|
-
}
|
|
131
|
-
|
|
56
|
+
})]
|
|
57
|
+
}), /* @__PURE__ */ o("div", {
|
|
58
|
+
className: "Feed",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ a("div", {
|
|
61
|
+
className: "FeedItems",
|
|
62
|
+
children: S?.items && S.items.map((e, t) => {
|
|
63
|
+
if (!(t >= h)) return /* @__PURE__ */ a("div", {
|
|
64
|
+
className: "FeedItem",
|
|
65
|
+
children: /* @__PURE__ */ o("div", { children: [
|
|
66
|
+
g && g.length > 0 && /* @__PURE__ */ a("div", {
|
|
67
|
+
className: "FeedItemCategories",
|
|
68
|
+
children: e.categories?.map((t) => {
|
|
69
|
+
let n = t.toLowerCase();
|
|
70
|
+
return g?.findIndex((e) => n === e.toLowerCase()) === -1 ? null : /* @__PURE__ */ a("a", {
|
|
71
|
+
href: `${S.link}/tag/${t.replace(" ", "-")}`,
|
|
72
|
+
className: "SRC-no-border-bottom-imp",
|
|
73
|
+
target: "_blank",
|
|
74
|
+
rel: "noopener noreferrer",
|
|
75
|
+
children: /* @__PURE__ */ a("div", {
|
|
76
|
+
className: "FeedItemCategory",
|
|
77
|
+
children: t
|
|
78
|
+
})
|
|
79
|
+
}, `${e.guid}_${t}`);
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ a("p", {
|
|
83
|
+
className: "FeedItemDate",
|
|
84
|
+
children: l(e.isoDate).format("MMMM YYYY")
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ a("p", {
|
|
87
|
+
className: "FeedItemTitle",
|
|
88
|
+
children: e.title
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ a("div", {
|
|
91
|
+
className: "FeedItemDescription",
|
|
92
|
+
children: e.contentSnippet?.replace(/\[...\]|\[…\]/gm, "…")
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ a("a", {
|
|
95
|
+
className: "FeedItemLink",
|
|
96
|
+
href: e.link,
|
|
97
|
+
target: "_blank",
|
|
98
|
+
rel: "noopener noreferrer",
|
|
99
|
+
children: "Continue reading"
|
|
100
|
+
})
|
|
101
|
+
] })
|
|
102
|
+
}, e.guid);
|
|
103
|
+
})
|
|
104
|
+
}),
|
|
105
|
+
S?.items && S.items.length > h && b && /* @__PURE__ */ a("div", {
|
|
106
|
+
className: "FeedViewAllNewsButtonContainer",
|
|
107
|
+
children: /* @__PURE__ */ a(t, {
|
|
108
|
+
color: "secondary",
|
|
109
|
+
variant: "contained",
|
|
110
|
+
onClick: () => window.open(b, "_blank", "noopener"),
|
|
111
|
+
target: "_blank",
|
|
112
|
+
children: y ?? "View All News"
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
C && /* @__PURE__ */ o("div", { children: ["Unable to load feed: ", d] })
|
|
116
|
+
]
|
|
117
|
+
})] });
|
|
118
|
+
}
|
|
119
|
+
async function g(e, t, n) {
|
|
120
|
+
let { feedUrl: r } = p(t, n);
|
|
121
|
+
await e.prefetchQuery(m(r));
|
|
122
|
+
}
|
|
132
123
|
//#endregion
|
|
133
|
-
export {
|
|
124
|
+
export { h as RssFeedCards, h as default, g as prefetchRssFeed };
|
|
134
125
|
|
|
135
126
|
//# sourceMappingURL=RssFeedCards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RssFeedCards.js","names":[],"sources":["../../../src/components/RssFeedCards/RssFeedCards.tsx"],"sourcesContent":["import NoData from '@/assets/icons/NoData'\nimport { ReactComponent as SubscribePlus } from '@/assets/icons/subscribe_plus.svg'\nimport LargeButton from '@/components/styled/LargeButton'\nimport dayjs from 'dayjs'\nimport { Component } from 'react'\nimport MailchimpSubscribe from 'react-mailchimp-subscribe'\nimport Parser from 'rss-parser'\n\nconst rssParser = new Parser()\ntype RssState = {\n rssFeed: any\n isLoadingError: boolean\n isShowingSubscribeUI: boolean\n allItemsUrl?: string\n}\n\nexport type RssFilter = {\n type?: 'tag' | 'category'\n value: string\n}\n\nexport type RssFeedCardsProps = {\n url: string\n filter?: RssFilter // optional tag or category to use as a filter\n itemsToShow: number\n allowCategories?: string[]\n mailChimpListName?: string\n mailChimpUrl?: string\n viewAllNewsButtonText?: string\n}\nexport class RssFeedCards extends Component<RssFeedCardsProps, RssState> {\n // only update the state if this component is mounted\n _isMounted = false\n\n constructor(props: RssFeedCardsProps) {\n super(props)\n this.state = {\n rssFeed: {},\n isLoadingError: false,\n isShowingSubscribeUI: false,\n }\n }\n\n componentDidMount() {\n this._isMounted = true\n const { url, filter } = this.props\n const filterValue = filter?.value\n const filterType = filter?.type\n const tagPath = filterValue\n ? `/${filterType ?? 'tag'}/${filterValue.replace(' ', '-')}`\n : ''\n const allItems = `${url}${tagPath}`\n const feedUrl = `${allItems}/?feed=rss2`\n fetch(feedUrl)\n .then(response => response.text())\n .then(responseData => rssParser.parseString(responseData))\n .then(rss => {\n if (this._isMounted) {\n this.setState({ rssFeed: rss, allItemsUrl: allItems })\n }\n })\n .catch(err => {\n if (this._isMounted) {\n this.setState({ isLoadingError: true })\n }\n })\n }\n\n componentWillUnmount() {\n this._isMounted = false\n }\n\n public onClickSubscribe = () => {\n this.setState({ isShowingSubscribeUI: true })\n }\n\n render() {\n const { viewAllNewsButtonText } = this.props\n\n if (this.state.rssFeed.items?.length === 0) {\n return (\n <div className=\"text-center SRCBorderedPanel SRCBorderedPanel--padded2x\">\n {NoData}\n <div style={{ marginTop: '20px', fontStyle: 'italic' }}>\n There are no items currently available\n </div>\n </div>\n )\n }\n return (\n <>\n {this.props.mailChimpUrl && (\n <div className=\"FeedSubscribe\">\n {!this.state.isShowingSubscribeUI && (\n <a\n className=\"FeedSubscribeToNewsLink SRC-no-border-bottom-imp\"\n onClick={this.onClickSubscribe}\n >\n <SubscribePlus title=\"Subscribe to News\" />\n Subscribe to News\n </a>\n )}\n {this.state.isShowingSubscribeUI && (\n <div className=\"MailchimpSubscribeContainer\">\n <SubscribePlus title=\"Subscribe to News\" />\n <p>\n Subscribe to receive the {this.props.mailChimpListName} by\n e-mail, which provides information and updates related to the\n Portal. You can opt out at any time by using the unsubscribe\n link within the e-mail. We will not share your information\n with any third parties or use it for any other purposes.\n </p>\n <div className=\"SRC-marginBottomTop\">\n <MailchimpSubscribe url={this.props.mailChimpUrl} />\n </div>\n </div>\n )}\n </div>\n )}\n <div className=\"Feed\">\n <div className=\"FeedItems\">\n {this.state.rssFeed.items &&\n this.state.rssFeed.items.map((item: any, index: any) => {\n // The other is to hide the large number of items in a particular feed (usually a max of 10 are returned). See state.isShowingMoreItems\n if (index >= this.props.itemsToShow) {\n return\n }\n\n return (\n <div key={item.guid} className={`FeedItem`}>\n <div>\n {this.props.allowCategories &&\n this.props.allowCategories.length > 0 && (\n <div className=\"FeedItemCategories\">\n {item['categories'].map((categoryName: string) => {\n // are we allowed to show this category/tag?\n const categoryNameLowerCase =\n categoryName.toLowerCase()\n const allowCategories = this.props.allowCategories\n if (\n allowCategories?.findIndex(\n item =>\n categoryNameLowerCase ===\n item.toLowerCase(),\n ) === -1\n )\n return <></>\n // else\n return (\n <a\n href={`${\n this.state.rssFeed.link\n }/tag/${categoryName.replace(' ', '-')}`}\n className=\"SRC-no-border-bottom-imp\"\n key={`${item.guid}_${categoryName}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <div className=\"FeedItemCategory\">\n {categoryName}\n </div>\n </a>\n )\n })}\n </div>\n )}\n <p className=\"FeedItemDate\">\n {dayjs(item['isoDate']).format('MMMM YYYY')}\n </p>\n <p className=\"FeedItemTitle\">{item['title']}</p>\n <div className=\"FeedItemDescription\">\n {item['contentSnippet'].replace(/\\[...\\]|\\[…\\]/gm, '…')}\n </div>\n <a\n className=\"FeedItemLink\"\n href={item['link']}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Continue reading\n </a>\n </div>\n </div>\n )\n })}\n </div>\n {this.state.rssFeed.items &&\n this.state.rssFeed.items.length > this.props.itemsToShow &&\n this.state.allItemsUrl && (\n <div className=\"FeedViewAllNewsButtonContainer\">\n <LargeButton\n color=\"secondary\"\n variant=\"contained\"\n onClick={() =>\n window.open(this.state.allItemsUrl, '_blank', 'noopener')\n }\n // @ts-expect-error - target prop exists, but TS doesn't recognize on styled component\n target=\"_blank\"\n >\n {viewAllNewsButtonText ?? 'View All News'}\n </LargeButton>\n </div>\n )}\n {this.state.isLoadingError && (\n <div>Unable to load feed: {this.props.url}</div>\n )}\n </div>\n </>\n )\n }\n}\n\nexport default RssFeedCards\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"RssFeedCards.js","names":[],"sources":["../../../src/components/RssFeedCards/RssFeedCards.tsx"],"sourcesContent":["import NoData from '@/assets/icons/NoData'\nimport { ReactComponent as SubscribePlus } from '@/assets/icons/subscribe_plus.svg'\nimport LargeButton from '@/components/styled/LargeButton'\nimport dayjs from 'dayjs'\nimport MailchimpSubscribe from 'react-mailchimp-subscribe'\nimport Parser from 'rss-parser'\nimport { QueryClient, queryOptions, useQuery } from '@tanstack/react-query'\nimport { useState } from 'react'\n\nconst rssParser = new Parser()\n\nexport type RssFilter = {\n type?: 'tag' | 'category'\n value: string\n}\n\nexport type RssFeedCardsProps = {\n url: string\n filter?: RssFilter // optional tag or category to use as a filter\n itemsToShow: number\n allowCategories?: string[]\n mailChimpListName?: string\n mailChimpUrl?: string\n viewAllNewsButtonText?: string\n}\n\nfunction buildRssFeedUrl(url: string, filter?: RssFilter) {\n const filterValue = filter?.value\n const filterType = filter?.type\n const tagPath = filterValue\n ? `/${filterType ?? 'tag'}/${filterValue.replace(' ', '-')}`\n : ''\n const allItemsUrl = `${url}${tagPath}`\n const feedUrl = `${allItemsUrl}/?feed=rss2`\n return { allItemsUrl, feedUrl }\n}\n\nfunction getRssFeedQueryOptions(feedUrl: string) {\n return queryOptions({\n queryKey: ['rssFeed', feedUrl],\n queryFn: () =>\n fetch(feedUrl)\n .then(response => response.text())\n .then(responseData => rssParser.parseString(responseData)),\n })\n}\n\nexport function RssFeedCards(props: RssFeedCardsProps) {\n const {\n url,\n filter,\n itemsToShow,\n allowCategories,\n mailChimpListName,\n mailChimpUrl,\n viewAllNewsButtonText,\n } = props\n\n const { allItemsUrl, feedUrl } = buildRssFeedUrl(url, filter)\n\n const { data: rssFeed, isError } = useQuery(getRssFeedQueryOptions(feedUrl))\n\n const [isShowingSubscribeUI, setIsShowingSubscribeUI] = useState(false)\n\n if (rssFeed?.items?.length === 0) {\n return (\n <div className=\"text-center SRCBorderedPanel SRCBorderedPanel--padded2x\">\n {NoData}\n <div style={{ marginTop: '20px', fontStyle: 'italic' }}>\n There are no items currently available\n </div>\n </div>\n )\n }\n return (\n <>\n {mailChimpUrl && (\n <div className=\"FeedSubscribe\">\n {!isShowingSubscribeUI && (\n <a\n className=\"FeedSubscribeToNewsLink SRC-no-border-bottom-imp\"\n onClick={() => setIsShowingSubscribeUI(true)}\n >\n <SubscribePlus title=\"Subscribe to News\" />\n Subscribe to News\n </a>\n )}\n {isShowingSubscribeUI && (\n <div className=\"MailchimpSubscribeContainer\">\n <SubscribePlus title=\"Subscribe to News\" />\n <p>\n Subscribe to receive the {mailChimpListName} by e-mail, which\n provides information and updates related to the Portal. You can\n opt out at any time by using the unsubscribe link within the\n e-mail. We will not share your information with any third\n parties or use it for any other purposes.\n </p>\n <div className=\"SRC-marginBottomTop\">\n <MailchimpSubscribe url={mailChimpUrl} />\n </div>\n </div>\n )}\n </div>\n )}\n <div className=\"Feed\">\n <div className=\"FeedItems\">\n {rssFeed?.items &&\n rssFeed.items.map((item, index) => {\n // The other is to hide the large number of items in a particular feed (usually a max of 10 are returned). See state.isShowingMoreItems\n if (index >= itemsToShow) {\n return\n }\n\n return (\n <div key={item.guid} className={`FeedItem`}>\n <div>\n {allowCategories && allowCategories.length > 0 && (\n <div className=\"FeedItemCategories\">\n {item.categories?.map((categoryName: string) => {\n // are we allowed to show this category/tag?\n const categoryNameLowerCase =\n categoryName.toLowerCase()\n if (\n allowCategories?.findIndex(\n item =>\n categoryNameLowerCase === item.toLowerCase(),\n ) === -1\n )\n return null\n // else\n return (\n <a\n href={`${rssFeed.link}/tag/${categoryName.replace(\n ' ',\n '-',\n )}`}\n className=\"SRC-no-border-bottom-imp\"\n key={`${item.guid}_${categoryName}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <div className=\"FeedItemCategory\">\n {categoryName}\n </div>\n </a>\n )\n })}\n </div>\n )}\n <p className=\"FeedItemDate\">\n {dayjs(item.isoDate).format('MMMM YYYY')}\n </p>\n <p className=\"FeedItemTitle\">{item.title}</p>\n <div className=\"FeedItemDescription\">\n {item.contentSnippet?.replace(/\\[...\\]|\\[…\\]/gm, '…')}\n </div>\n <a\n className=\"FeedItemLink\"\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Continue reading\n </a>\n </div>\n </div>\n )\n })}\n </div>\n {rssFeed?.items &&\n rssFeed.items.length > itemsToShow &&\n allItemsUrl && (\n <div className=\"FeedViewAllNewsButtonContainer\">\n <LargeButton\n color=\"secondary\"\n variant=\"contained\"\n onClick={() => window.open(allItemsUrl, '_blank', 'noopener')}\n // @ts-expect-error - target prop exists, but TS doesn't recognize on styled component\n target=\"_blank\"\n >\n {viewAllNewsButtonText ?? 'View All News'}\n </LargeButton>\n </div>\n )}\n {isError && <div>Unable to load feed: {url}</div>}\n </div>\n </>\n )\n}\n\nexport default RssFeedCards\n\n/**\n * Prefetches the RSS feed into a QueryClient for use with HydrationBoundary.\n * Uses the same query key as the RssFeedCards component.\n */\nexport async function prefetchRssFeed(\n queryClient: QueryClient,\n url: string,\n filter?: RssFilter,\n): Promise<void> {\n const { feedUrl } = buildRssFeedUrl(url, filter)\n await queryClient.prefetchQuery(getRssFeedQueryOptions(feedUrl))\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsynchronousJobStatus, ColumnModel, QueryBundleRequest, QueryResultBundle, RowSet } from '@sage-bionetworks/synapse-types';
|
|
1
|
+
import { AsynchronousJobStatus, ColumnModel, FacetColumnRangeRequest, FacetColumnValuesRequest, QueryBundleRequest, QueryResultBundle, RowSet } from '@sage-bionetworks/synapse-types';
|
|
2
2
|
import type { SearchIndexQuery, SearchQueryResults, SynapseClientError } from '@sage-bionetworks/synapse-client';
|
|
3
3
|
import { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseSuspenseQueryOptions } from '@tanstack/react-query';
|
|
4
4
|
import { KeyFactory } from '@/synapse-queries/KeyFactory';
|
|
@@ -13,17 +13,19 @@ export type SearchTableQueryUseQueryOptions = {
|
|
|
13
13
|
rowDataInfiniteQueryOptions: UseInfiniteQueryOptions<AsynchronousJobStatus<SearchIndexQuery, QueryResultBundle>, SynapseClientError, InfiniteData<AsynchronousJobStatus<SearchIndexQuery, QueryResultBundle>>, QueryKey, string | number | undefined>;
|
|
14
14
|
queryMetadataQueryOptions: UseSuspenseQueryOptions<AsynchronousJobStatus<SearchIndexQuery, QueryResultBundle>, SynapseClientError, Omit<QueryResultBundle, 'queryResult'>>;
|
|
15
15
|
};
|
|
16
|
+
export declare function getNextPageParamForSearchQueryResults(lastPage: AsynchronousJobStatus<SearchIndexQuery, QueryResultBundle>, allPages: AsynchronousJobStatus<SearchIndexQuery, QueryResultBundle>[]): number | string | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* Converts a QueryBundleRequest (used internally for state management) into a SearchIndexQuery
|
|
18
19
|
* that can be sent to the SearchQueryServicesApi.
|
|
19
20
|
*
|
|
20
21
|
* Mapping:
|
|
21
|
-
* - columnModels (facetType
|
|
22
|
-
* - query.selectedFacets (enumeration) →
|
|
23
|
-
* - query.selectedFacets (range) →
|
|
24
|
-
* - query.
|
|
25
|
-
* - query.
|
|
26
|
-
* - query.
|
|
22
|
+
* - columnModels (facetType 'enumeration') → aggregations (OpenSearch terms aggregations)
|
|
23
|
+
* - query.selectedFacets (enumeration) → query.bool.filter terms clauses
|
|
24
|
+
* - query.selectedFacets (range) → query.bool.filter range clauses
|
|
25
|
+
* - query.additionalFilters (TextMatchesQueryFilter) → multi_match query clause
|
|
26
|
+
* - query.sort → sort (SortItem { column, direction } → [{ column: 'asc'|'desc' }])
|
|
27
|
+
* - query.limit → size
|
|
28
|
+
* - query.offset → from
|
|
27
29
|
* - partMask → dropped (SearchIndexQuery has no bitmask concept)
|
|
28
30
|
*/
|
|
29
31
|
export declare function toSearchIndexQuery(queryBundleRequest: QueryBundleRequest, searchIndexId: string, columnModels?: ColumnModel[]): SearchIndexQuery;
|
|
@@ -34,18 +36,17 @@ export declare function toSearchIndexQuery(queryBundleRequest: QueryBundleReques
|
|
|
34
36
|
* Mapping:
|
|
35
37
|
* - totalHits → queryCount
|
|
36
38
|
* - hits → queryResult.queryResults (rows derived from hit.rowId/rowVersion/fields)
|
|
37
|
-
* -
|
|
39
|
+
* - aggregationResults → facets (parsed from opaque OpenSearch aggregation JSON)
|
|
38
40
|
*/
|
|
39
|
-
export declare function searchQueryResultsToQueryResultBundle(results: SearchQueryResults | undefined, query: SearchIndexQuery, columnModels?: ColumnModel[]): QueryResultBundle;
|
|
41
|
+
export declare function searchQueryResultsToQueryResultBundle(results: SearchQueryResults | undefined, query: SearchIndexQuery, columnModels?: ColumnModel[], selectedFacets?: (FacetColumnValuesRequest | FacetColumnRangeRequest)[]): QueryResultBundle;
|
|
40
42
|
export declare function getSearchQueryUseQueryOptions(queryBundleRequest: QueryBundleRequest, keyFactory: KeyFactory, accessToken: string | undefined, searchIndexId: string, columnModels?: ColumnModel[]): SearchTableQueryUseQueryOptions;
|
|
41
43
|
/**
|
|
42
44
|
* Returns a stable callback that fetches autocomplete suggestions for a search input
|
|
43
45
|
* using the synchronous `POST /search/autocomplete` endpoint.
|
|
44
46
|
*
|
|
45
47
|
* The query is built from the current `searchIndexId` and `autocompleteFieldName`:
|
|
46
|
-
* - `searchQuery.
|
|
47
|
-
* - `searchQuery.
|
|
48
|
-
* only returns values for that single field
|
|
48
|
+
* - `searchQuery.query` is a `match_bool_prefix` clause scoped to `autocompleteFieldName`
|
|
49
|
+
* - `searchQuery._source` is set to `[autocompleteFieldName]` so only that field is returned
|
|
49
50
|
*
|
|
50
51
|
* When `autocompleteFieldName` is undefined, the returned callback immediately returns `[]`.
|
|
51
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchQueryUseQueryOptions.d.ts","sourceRoot":"","sources":["../../../src/components/SearchQueryWrapper/SearchQueryUseQueryOptions.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,EACrB,WAAW,
|
|
1
|
+
{"version":3,"file":"SearchQueryUseQueryOptions.d.ts","sourceRoot":"","sources":["../../../src/components/SearchQueryWrapper/SearchQueryUseQueryOptions.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,EACrB,WAAW,EAEX,uBAAuB,EAIvB,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,EAIP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAGV,gBAAgB,EAChB,kBAAkB,EAElB,kBAAkB,EAEnB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uBAAuB,CAAA;AAI9B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AA6BzD;;;;;GAKG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,mBAAmB,EAAE,uBAAuB,CAC1C,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,EAC1D,kBAAkB,EAClB,MAAM,GAAG,SAAS,CACnB,CAAA;IACD,2BAA2B,EAAE,uBAAuB,CAClD,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,EAC1D,kBAAkB,EAClB,YAAY,CAAC,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,EACxE,QAAQ,EACR,MAAM,GAAG,MAAM,GAAG,SAAS,CAC5B,CAAA;IACD,yBAAyB,EAAE,uBAAuB,CAChD,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,EAC1D,kBAAkB,EAClB,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CACvC,CAAA;CACF,CAAA;AAED,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,EACpE,QAAQ,EAAE,qBAAqB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,EAAE,GACrE,MAAM,GAAG,MAAM,GAAG,SAAS,CAyB7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,WAAW,EAAE,GAC3B,gBAAgB,CAmHlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,KAAK,EAAE,gBAAgB,EACvB,YAAY,CAAC,EAAE,WAAW,EAAE,EAC5B,cAAc,CAAC,EAAE,CAAC,wBAAwB,GAAG,uBAAuB,CAAC,EAAE,GACtE,iBAAiB,CA6InB;AAED,wBAAgB,6BAA6B,CAC3C,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,WAAW,EAAE,GAC3B,+BAA+B,CAwIjC;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,MAAM,EACrB,qBAAqB,EAAE,MAAM,GAAG,SAAS,GACxC,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAoC3C;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,+BAA+B,CAmBjC"}
|
|
@@ -6,131 +6,144 @@ import "../../synapse-queries/index.js";
|
|
|
6
6
|
import { useCallback as i, useMemo as a } from "react";
|
|
7
7
|
import { omit as o } from "lodash-es";
|
|
8
8
|
import { FACET_COLUMN_RANGE_REQUEST_CONCRETE_TYPE_VALUE as s, FACET_COLUMN_VALUES_REQUEST_CONCRETE_TYPE_VALUE as c, TEXT_MATCHES_QUERY_FILTER_CONCRETE_TYPE_VALUE as l } from "@sage-bionetworks/synapse-types";
|
|
9
|
-
import
|
|
10
|
-
import f from "dayjs";
|
|
9
|
+
import u from "dayjs";
|
|
11
10
|
//#region src/components/SearchQueryWrapper/SearchQueryUseQueryOptions.ts
|
|
12
|
-
function
|
|
11
|
+
function d(e, t) {
|
|
12
|
+
let n = e.responseBody?.queryResult?.queryResults.rows?.length ?? 0, r = e.requestBody?.searchQuery?.size, i = e.responseBody?.queryCount, a = t.reduce((e, t) => e + (t.responseBody?.queryResult?.queryResults.rows?.length ?? 0), 0);
|
|
13
|
+
if (n !== 0 && !(r != null && n < r) && !(i != null && a >= i)) return a;
|
|
14
|
+
}
|
|
15
|
+
function f(e, t, n) {
|
|
13
16
|
let r = n?.filter((e) => e.facetType === "enumeration").map((e) => {
|
|
14
17
|
let t = {
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
field: e.name,
|
|
19
|
+
size: 100
|
|
17
20
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
if (e.facetSortConfig?.property != null) {
|
|
22
|
+
let n = e.facetSortConfig.property === "VALUE" ? "_key" : "_count", r = e.facetSortConfig.direction === "DESC" ? "desc" : "asc";
|
|
23
|
+
t.order = { [n]: r };
|
|
24
|
+
}
|
|
25
|
+
return [e.name, { terms: t }];
|
|
26
|
+
}), i = r && r.length > 0 ? Object.fromEntries(r) : void 0, a = [];
|
|
27
|
+
e.query.selectedFacets?.filter((e) => e.concreteType === c).forEach((e) => {
|
|
28
|
+
a.push({ terms: { [e.columnName]: e.facetValues ?? [] } });
|
|
29
|
+
}), e.query.selectedFacets?.filter((e) => e.concreteType === s).forEach((e) => {
|
|
30
|
+
let t = n?.find((t) => t.name === e.columnName)?.columnType, r = (e) => !e || t !== "DATE" ? e : /^\d{4}-\d{2}-\d{2}$/.test(e) ? String(u(e).valueOf()) : e, i = {}, o = r(e.min), s = r(e.max);
|
|
31
|
+
o !== void 0 && (i.gte = o), s !== void 0 && (i.lte = s), a.push({ range: { [e.columnName]: i } });
|
|
32
|
+
});
|
|
33
|
+
let o = e.query.additionalFilters?.filter((e) => e.concreteType === l).map((e) => e.searchExpression).filter((e) => e != null && e.length > 0), d = o && o.length > 0 ? o.join(" ") : void 0, f;
|
|
34
|
+
f = d && a.length > 0 ? { bool: {
|
|
35
|
+
must: [{ multi_match: {
|
|
36
|
+
query: d,
|
|
37
|
+
fuzziness: "AUTO"
|
|
38
|
+
} }],
|
|
39
|
+
filter: a
|
|
40
|
+
} } : d ? { multi_match: {
|
|
41
|
+
query: d,
|
|
42
|
+
fuzziness: "AUTO"
|
|
43
|
+
} } : a.length > 0 ? { bool: { filter: a } } : { match_all: {} };
|
|
44
|
+
let p = e.query.sort?.filter((e) => e.direction === "ASC" || e.direction === "DESC").map((e) => ({ [e.column]: e.direction.toLowerCase() }));
|
|
33
45
|
return {
|
|
34
46
|
concreteType: "org.sagebionetworks.repo.model.search.table.SearchIndexQuery",
|
|
35
47
|
searchIndexId: t,
|
|
36
48
|
searchQuery: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
fuzziness: "AUTO",
|
|
43
|
-
sort: m?.length ? m : void 0,
|
|
44
|
-
limit: e.query.limit,
|
|
45
|
-
offset: e.query.offset
|
|
49
|
+
query: f,
|
|
50
|
+
aggregations: i,
|
|
51
|
+
sort: p?.length ? p : void 0,
|
|
52
|
+
size: e.query.limit,
|
|
53
|
+
from: e.query.offset
|
|
46
54
|
}
|
|
47
55
|
};
|
|
48
56
|
}
|
|
49
|
-
function
|
|
57
|
+
function p(e, t, n, r) {
|
|
50
58
|
if (!e) return { concreteType: "org.sagebionetworks.repo.model.table.QueryResultBundle" };
|
|
51
|
-
let
|
|
59
|
+
let i = e.selectColumns?.map((e) => e.name).filter((e) => !!e) ?? [], a = i.map((e) => ({
|
|
52
60
|
name: e,
|
|
53
61
|
columnType: n?.find((t) => t.name === e)?.columnType ?? "STRING"
|
|
54
|
-
})),
|
|
62
|
+
})), o = (e.hits ?? []).map((e) => ({
|
|
55
63
|
rowId: e.rowId,
|
|
56
64
|
versionNumber: e.rowVersion,
|
|
57
|
-
values:
|
|
58
|
-
})),
|
|
65
|
+
values: i.map((t) => e.fields?.find((e) => e.name === t)?.value ?? null)
|
|
66
|
+
})), l = a.length > 0 || o.length > 0 ? {
|
|
59
67
|
concreteType: "org.sagebionetworks.repo.model.table.QueryResult",
|
|
60
68
|
queryResults: {
|
|
61
69
|
concreteType: "org.sagebionetworks.repo.model.table.RowSet",
|
|
62
70
|
tableId: t.searchIndexId ?? "",
|
|
63
71
|
etag: "",
|
|
64
|
-
headers:
|
|
65
|
-
rows:
|
|
72
|
+
headers: a,
|
|
73
|
+
rows: o
|
|
66
74
|
}
|
|
67
|
-
} : void 0,
|
|
68
|
-
let n =
|
|
75
|
+
} : void 0, u = e.aggregationResults, d = Object.entries(u ?? {}).map(([e, t]) => {
|
|
76
|
+
let n = r?.filter((t) => t.concreteType === c && t.columnName === e).flatMap((e) => e.facetValues ?? []) ?? [];
|
|
77
|
+
return {
|
|
78
|
+
concreteType: "org.sagebionetworks.repo.model.table.FacetColumnResultValues",
|
|
79
|
+
facetType: "enumeration",
|
|
80
|
+
columnName: e,
|
|
81
|
+
facetValues: (t.buckets ?? []).map((e) => ({
|
|
82
|
+
value: String(e.key),
|
|
83
|
+
count: e.doc_count,
|
|
84
|
+
isSelected: n.includes(String(e.key))
|
|
85
|
+
}))
|
|
86
|
+
};
|
|
87
|
+
}), f = (n ?? []).filter((e) => e.facetType === "range" && (e.columnType === "DATE" || e.columnType === "DOUBLE" || e.columnType === "INTEGER") && !d.some((t) => t.columnName === e.name)).map((e) => {
|
|
88
|
+
let t = r?.find((t) => t.concreteType === s && t.columnName === e.name);
|
|
69
89
|
return {
|
|
70
90
|
concreteType: "org.sagebionetworks.repo.model.table.FacetColumnResultRange",
|
|
71
91
|
facetType: "range",
|
|
72
92
|
columnName: e.name,
|
|
73
93
|
columnMin: "",
|
|
74
94
|
columnMax: "",
|
|
75
|
-
selectedMin:
|
|
76
|
-
selectedMax:
|
|
95
|
+
selectedMin: t?.min,
|
|
96
|
+
selectedMax: t?.max
|
|
77
97
|
};
|
|
78
|
-
}),
|
|
98
|
+
}), p = [...d ?? [], ...f], m = n ? [...p.filter((e) => n.some((t) => t.name === e.columnName)).sort((e, t) => n.findIndex((t) => t.name === e.columnName) - n.findIndex((e) => e.name === t.columnName)), ...p.filter((e) => !n.some((t) => t.name === e.columnName))] : p;
|
|
79
99
|
return {
|
|
80
100
|
concreteType: "org.sagebionetworks.repo.model.table.QueryResultBundle",
|
|
81
101
|
queryCount: e.totalHits,
|
|
82
|
-
selectColumns:
|
|
83
|
-
queryResult:
|
|
84
|
-
facets:
|
|
102
|
+
selectColumns: a,
|
|
103
|
+
queryResult: l,
|
|
104
|
+
facets: m
|
|
85
105
|
};
|
|
86
106
|
}
|
|
87
|
-
function
|
|
88
|
-
let c =
|
|
107
|
+
function m(t, n, i, a, s) {
|
|
108
|
+
let c = f(t, a, s), l = {
|
|
89
109
|
...c,
|
|
90
110
|
searchQuery: {
|
|
91
111
|
...c.searchQuery,
|
|
92
|
-
|
|
112
|
+
aggregations: void 0
|
|
93
113
|
},
|
|
94
114
|
responseParts: new Set(["HITS", "SELECT_COLUMNS"])
|
|
95
115
|
}, u = {
|
|
96
116
|
...c,
|
|
97
|
-
responseParts: new Set([
|
|
98
|
-
|
|
99
|
-
"SELECT_COLUMNS",
|
|
100
|
-
"FACETS"
|
|
101
|
-
])
|
|
102
|
-
}, d = (e) => ({
|
|
117
|
+
responseParts: new Set(["TOTAL_HITS", "SELECT_COLUMNS"])
|
|
118
|
+
}, m = (e) => ({
|
|
103
119
|
...e,
|
|
104
120
|
responseParts: e.responseParts ? [...e.responseParts].sort() : void 0
|
|
105
|
-
}),
|
|
106
|
-
let
|
|
121
|
+
}), h = async (n) => {
|
|
122
|
+
let r = await e(n, i);
|
|
107
123
|
return {
|
|
108
|
-
...
|
|
109
|
-
responseBody:
|
|
124
|
+
...r,
|
|
125
|
+
responseBody: p(r.responseBody, n, s, t.query.selectedFacets)
|
|
110
126
|
};
|
|
111
127
|
};
|
|
112
128
|
return {
|
|
113
129
|
rowDataQueryOptions: {
|
|
114
130
|
...r,
|
|
115
|
-
queryKey: n.getSearchQueryResultWithAsyncStatusQueryKey(
|
|
116
|
-
queryFn: () =>
|
|
131
|
+
queryKey: n.getSearchQueryResultWithAsyncStatusQueryKey(m(l), !1),
|
|
132
|
+
queryFn: () => h(l),
|
|
117
133
|
select: (e) => e.responseBody?.queryResult?.queryResults
|
|
118
134
|
},
|
|
119
135
|
rowDataInfiniteQueryOptions: {
|
|
120
136
|
...r,
|
|
121
|
-
queryKey: n.getSearchQueryResultWithAsyncStatusQueryKey(
|
|
137
|
+
queryKey: n.getSearchQueryResultWithAsyncStatusQueryKey(m(l), !0),
|
|
122
138
|
initialPageParam: 0,
|
|
123
|
-
getNextPageParam: (e, t) =>
|
|
124
|
-
let n = e.responseBody?.queryCount, r = t.reduce((e, t) => e + (t.responseBody?.queryResult?.queryResults.rows?.length ?? 0), 0);
|
|
125
|
-
if (!(n != null && r >= n)) return r;
|
|
126
|
-
},
|
|
139
|
+
getNextPageParam: (e, t) => d(e, t),
|
|
127
140
|
queryFn: (e) => {
|
|
128
141
|
let t = typeof e.pageParam == "string" ? parseInt(e.pageParam) : e.pageParam ?? 0;
|
|
129
|
-
return
|
|
142
|
+
return h({
|
|
130
143
|
...l,
|
|
131
144
|
searchQuery: {
|
|
132
145
|
...l.searchQuery,
|
|
133
|
-
|
|
146
|
+
from: t
|
|
134
147
|
}
|
|
135
148
|
});
|
|
136
149
|
},
|
|
@@ -138,8 +151,8 @@ function h(t, n, i, a, s) {
|
|
|
138
151
|
},
|
|
139
152
|
queryMetadataQueryOptions: {
|
|
140
153
|
...r,
|
|
141
|
-
queryKey: n.getSearchQueryResultWithAsyncStatusQueryKey(
|
|
142
|
-
queryFn: () =>
|
|
154
|
+
queryKey: n.getSearchQueryResultWithAsyncStatusQueryKey(m(u), !1),
|
|
155
|
+
queryFn: () => h(u),
|
|
143
156
|
select: (e) => {
|
|
144
157
|
let t = o(e.responseBody ?? {}, "queryResult");
|
|
145
158
|
return s ? {
|
|
@@ -150,19 +163,17 @@ function h(t, n, i, a, s) {
|
|
|
150
163
|
}
|
|
151
164
|
};
|
|
152
165
|
}
|
|
153
|
-
function
|
|
166
|
+
function h(e, n) {
|
|
154
167
|
let { synapseClient: r } = t();
|
|
155
168
|
return i(async (t) => {
|
|
156
169
|
if (!n) return [];
|
|
157
170
|
let i = t.trim();
|
|
158
171
|
if (!i) return [];
|
|
159
|
-
let a = await r.searchManagementServicesClient.postRepoV1SearchAutocomplete({
|
|
160
|
-
concreteType: "org.sagebionetworks.repo.model.search.table.SearchIndexQuery",
|
|
172
|
+
let a = await r.searchManagementServicesClient.postRepoV1SearchAutocomplete({ searchAutocompleteRequest: {
|
|
161
173
|
searchIndexId: e,
|
|
162
174
|
searchQuery: {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
returnFields: [n]
|
|
175
|
+
query: { match_bool_prefix: { [n]: { query: i } } },
|
|
176
|
+
_source: { includes: [n] }
|
|
166
177
|
}
|
|
167
178
|
} }), o = [];
|
|
168
179
|
for (let e of a.hits ?? []) for (let t of e.fields ?? []) t.value && o.push(t.value);
|
|
@@ -173,9 +184,9 @@ function g(e, n) {
|
|
|
173
184
|
n
|
|
174
185
|
]);
|
|
175
186
|
}
|
|
176
|
-
function
|
|
187
|
+
function g(e, r, i) {
|
|
177
188
|
let { keyFactory: o, accessToken: s } = t(), { data: c } = n(i, void 0, { includeTableBundle: !0 }), l = c?.tableBundle?.columnModels;
|
|
178
|
-
return a(() =>
|
|
189
|
+
return a(() => m(e, o, s, r, l), [
|
|
179
190
|
o,
|
|
180
191
|
s,
|
|
181
192
|
e,
|
|
@@ -184,6 +195,6 @@ function _(e, r, i) {
|
|
|
184
195
|
]);
|
|
185
196
|
}
|
|
186
197
|
//#endregion
|
|
187
|
-
export {
|
|
198
|
+
export { d as getNextPageParamForSearchQueryResults, m as getSearchQueryUseQueryOptions, p as searchQueryResultsToQueryResultBundle, f as toSearchIndexQuery, h as useGetSuggestionsForSearchIndex, g as useSearchQueryUseQueryOptions };
|
|
188
199
|
|
|
189
200
|
//# sourceMappingURL=SearchQueryUseQueryOptions.js.map
|