@esri/hub-common 16.3.2 → 16.3.3
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/esm/search/_internal/hubDiscussionsHelpers/processChannelFilters.js +27 -5
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processChannelFilters.js.map +1 -1
- package/dist/esm/search/_internal/hubEventsHelpers/processAttendeeFilters.js +0 -2
- package/dist/esm/search/_internal/hubEventsHelpers/processAttendeeFilters.js.map +1 -1
- package/dist/esm/search/_internal/hubEventsHelpers/processFilters.js +106 -129
- package/dist/esm/search/_internal/hubEventsHelpers/processFilters.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchEvents.js +4 -7
- package/dist/esm/search/_internal/hubSearchEvents.js.map +1 -1
- package/dist/node/search/_internal/hubDiscussionsHelpers/processChannelFilters.js +28 -5
- package/dist/node/search/_internal/hubDiscussionsHelpers/processChannelFilters.js.map +1 -1
- package/dist/node/search/_internal/hubEventsHelpers/processAttendeeFilters.js +0 -2
- package/dist/node/search/_internal/hubEventsHelpers/processAttendeeFilters.js.map +1 -1
- package/dist/node/search/_internal/hubEventsHelpers/processFilters.js +106 -129
- package/dist/node/search/_internal/hubEventsHelpers/processFilters.js.map +1 -1
- package/dist/node/search/_internal/hubSearchEvents.js +4 -7
- package/dist/node/search/_internal/hubSearchEvents.js.map +1 -1
- package/dist/types/search/_internal/hubDiscussionsHelpers/processChannelFilters.d.ts +22 -0
- package/dist/types/search/_internal/hubEventsHelpers/processFilters.d.ts +1 -2
- package/dist/types/search/_internal/hubSearchEvents.d.ts +3 -6
- package/package.json +1 -1
- package/dist/esm/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.js +0 -6
- package/dist/esm/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.js.map +0 -1
- package/dist/node/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.js +0 -9
- package/dist/node/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.js.map +0 -1
- package/dist/types/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.d.ts +0 -2
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { unique } from "../../../util";
|
|
2
|
+
/**
|
|
3
|
+
* Flattens an array of IFilter objects into a map of key/value pairs where the key is the name of the
|
|
4
|
+
* predicate and the value is a unique array of all values for that predicate name spanning all collections
|
|
5
|
+
* and predicates. Uniqueness is only guaranteed for primitives (i.e. strings, boolean, number, etc). E.g.
|
|
6
|
+
*
|
|
7
|
+
* const x = flattenFilters([{
|
|
8
|
+
* predicates: [{
|
|
9
|
+
* access: 'public',
|
|
10
|
+
* }, {
|
|
11
|
+
* access: 'org',
|
|
12
|
+
* }],
|
|
13
|
+
* }, {
|
|
14
|
+
* predicates: [{
|
|
15
|
+
* access: ['private', 'org]
|
|
16
|
+
* }]
|
|
17
|
+
* }]);
|
|
18
|
+
*
|
|
19
|
+
* x // => { access: ['public', 'org', 'private']}
|
|
20
|
+
* @param filters An array of IFilter objects
|
|
21
|
+
* @returns an object containing key/value pairs of parameter values
|
|
22
|
+
*/
|
|
23
|
+
export function flattenFilters(filters) {
|
|
2
24
|
return filters.reduce((acc1, filter) => filter.predicates.reduce((acc2, predicate) => Object.keys(predicate).reduce((acc3, predicateKey) => {
|
|
3
|
-
const
|
|
4
|
-
values.push(...(Array.isArray(predicate[predicateKey])
|
|
25
|
+
const valuesToAdd = Array.isArray(predicate[predicateKey])
|
|
5
26
|
? predicate[predicateKey]
|
|
6
|
-
: [predicate[predicateKey]]
|
|
27
|
+
: [predicate[predicateKey]];
|
|
28
|
+
const values = valuesToAdd.reduce((acc4, valueToAdd) => acc4.includes(valueToAdd) ? acc4 : [...acc4, valueToAdd], acc3[predicateKey] || []);
|
|
7
29
|
return Object.assign(Object.assign({}, acc3), { [predicateKey]: values });
|
|
8
30
|
}, acc2), acc1), {});
|
|
9
31
|
}
|
|
@@ -37,7 +59,7 @@ export function processChannelFilters(filters) {
|
|
|
37
59
|
channelOptions.ids = ids;
|
|
38
60
|
}
|
|
39
61
|
if (notIds.length) {
|
|
40
|
-
channelOptions.notIds = notIds;
|
|
62
|
+
channelOptions.notIds = notIds.filter(unique);
|
|
41
63
|
}
|
|
42
64
|
}
|
|
43
65
|
return channelOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processChannelFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubDiscussionsHelpers/processChannelFilters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"processChannelFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubDiscussionsHelpers/processChannelFilters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,cAAc,CAAC,OAAkB;IAC/C,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CACf,MAAM,CAAC,UAAU,CAAC,MAAM,CACtB,CAAC,IAAI,EAAE,SAAqB,EAAE,EAAE,CAC9B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE;QACrB,MAAM,WAAW,GAAU,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC/D,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC;YACzB,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CACnB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,EAC1D,IAAI,CAAC,YAAY,CAAC,IAAK,EAAY,CACpC,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AAE,CACxB,CAAC;QACF,IAAI,GAAG,CAAC,MAAM,EAAE;YACd,cAAc,CAAC,GAAG,GAAG,GAAG,CAAC;SAC1B;QACD,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -12,8 +12,6 @@ export function processAttendeeFilters(query) {
|
|
|
12
12
|
}
|
|
13
13
|
const term = getPredicateValuesByKey(query.filters, "term");
|
|
14
14
|
if (term.length) {
|
|
15
|
-
// TODO: remove ts-ignore once GetEventsParams supports filtering by username, firstName, lastName https://devtopia.esri.com/dc/hub/issues/10153
|
|
16
|
-
// @ts-ignore
|
|
17
15
|
processedFilters.name = term[0];
|
|
18
16
|
}
|
|
19
17
|
processedFilters.type = useElseJoin(getOptionalPredicateStringsByKey(query.filters, "attendanceType"), [EventAttendanceType.VIRTUAL, EventAttendanceType.IN_PERSON]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processAttendeeFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processAttendeeFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,UAAU,sBAAsB,CACpC,KAAa;IAEb,MAAM,gBAAgB,GAAoC;QACxD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO;KAClC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,QAAkB,EAAU,EAAE,CAChE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,gCAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;QAClB,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;KAClC;IAED,MAAM,IAAI,GAAG,uBAAuB,
|
|
1
|
+
{"version":3,"file":"processAttendeeFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processAttendeeFilters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,UAAU,sBAAsB,CACpC,KAAa;IAEb,MAAM,gBAAgB,GAAoC;QACxD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO;KAClC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,QAAkB,EAAU,EAAE,CAChE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,gCAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;QAClB,gBAAgB,CAA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|
@@ -1,162 +1,127 @@
|
|
|
1
1
|
import { EventAccess, EventAssociationEntityType, EventAttendanceType, EventStatus, } from "../../../events/api/orval/api/orval-events";
|
|
2
|
-
import { getPredicateValuesByKey } from "./getPredicateValuesByKey";
|
|
3
|
-
import { getUniquePredicateValuesByKey } from "./getUniquePredicateValuesByKey";
|
|
4
|
-
import { searchGroups } from "@esri/arcgis-rest-portal";
|
|
5
|
-
import { isUpdateGroup } from "../../../utils/is-update-group";
|
|
6
2
|
import { toEnums } from "./toEnumConverters";
|
|
3
|
+
import { flattenFilters } from "../hubDiscussionsHelpers/processChannelFilters";
|
|
4
|
+
import { unique } from "../../../util";
|
|
7
5
|
/**
|
|
8
6
|
* Builds a Partial<ISearchEvents> given an Array of IFilter objects
|
|
9
7
|
* @param filters An Array of IFilter
|
|
10
8
|
* @returns a Partial<ISearchEvents> for the given Array of IFilter objects
|
|
11
9
|
*/
|
|
12
|
-
export
|
|
10
|
+
export function processFilters(filters) {
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
12
|
+
const flattenedFilters = flattenFilters(filters);
|
|
13
13
|
const processedFilters = {};
|
|
14
|
-
|
|
15
|
-
if (access.length) {
|
|
16
|
-
processedFilters.access = toEnums(access, EventAccess);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (canEdit.length) {
|
|
20
|
-
processedFilters.canEdit = canEdit[0];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
processedFilters.entityIds =
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
-
processedFilters.entityTypes = toEnums(
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
processedFilters.eventIds =
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (term.length) {
|
|
36
|
-
processedFilters.title = term[0];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (orgId.length) {
|
|
40
|
-
processedFilters.orgId = orgId[0];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (categories.length) {
|
|
44
|
-
processedFilters.categories = categories;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (tags.length) {
|
|
48
|
-
processedFilters.tags = tags;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const readGroupIds = getUniquePredicateValuesByKey(filters, "readGroupId");
|
|
60
|
-
if (readGroupIds.length) {
|
|
61
|
-
processedFilters.readGroups = readGroupIds;
|
|
62
|
-
}
|
|
63
|
-
const editGroupIds = getUniquePredicateValuesByKey(filters, "editGroupId");
|
|
64
|
-
if (editGroupIds.length) {
|
|
65
|
-
processedFilters.editGroups = editGroupIds;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// NOTE: previously notGroup was an inverse of group, but now they are subtly different
|
|
69
|
-
// We do not yet have an inverse of sharedToGroups.
|
|
70
|
-
const notGroupIds = getUniquePredicateValuesByKey(filters, "notGroup");
|
|
71
|
-
// if a notGroup was provided, we prioritize that over individual notReadGroupId or notEditGroupId
|
|
72
|
-
// filters to prevent collisions
|
|
73
|
-
if (notGroupIds.length) {
|
|
74
|
-
const { results } = await searchGroups(Object.assign({ q: `id:(${notGroupIds.join(" OR ")})`, num: notGroupIds.length }, requestOptions));
|
|
75
|
-
const { notReadGroupIds, notEditGroupIds } = results.reduce((acc, group) => {
|
|
76
|
-
const key = isUpdateGroup(group)
|
|
77
|
-
? "notEditGroupIds"
|
|
78
|
-
: "notReadGroupIds";
|
|
79
|
-
return Object.assign(Object.assign({}, acc), { [key]: [...acc[key], group.id] });
|
|
80
|
-
}, { notReadGroupIds: [], notEditGroupIds: [] });
|
|
81
|
-
if (notReadGroupIds.length) {
|
|
82
|
-
processedFilters.withoutReadGroups = notReadGroupIds;
|
|
14
|
+
// access
|
|
15
|
+
if ((_a = flattenedFilters.access) === null || _a === void 0 ? void 0 : _a.length) {
|
|
16
|
+
processedFilters.access = toEnums(flattenedFilters.access, EventAccess);
|
|
17
|
+
}
|
|
18
|
+
// canEdit
|
|
19
|
+
if ((_b = flattenedFilters.canEdit) === null || _b === void 0 ? void 0 : _b.length) {
|
|
20
|
+
processedFilters.canEdit = flattenedFilters.canEdit[0];
|
|
21
|
+
}
|
|
22
|
+
// entityId
|
|
23
|
+
if ((_c = flattenedFilters.entityId) === null || _c === void 0 ? void 0 : _c.length) {
|
|
24
|
+
processedFilters.entityIds = flattenedFilters.entityId;
|
|
25
|
+
}
|
|
26
|
+
// entityType
|
|
27
|
+
if ((_d = flattenedFilters.entityType) === null || _d === void 0 ? void 0 : _d.length) {
|
|
28
|
+
processedFilters.entityTypes = toEnums(flattenedFilters.entityType, EventAssociationEntityType);
|
|
29
|
+
}
|
|
30
|
+
// id
|
|
31
|
+
if ((_e = flattenedFilters.id) === null || _e === void 0 ? void 0 : _e.length) {
|
|
32
|
+
processedFilters.eventIds = flattenedFilters.id;
|
|
33
|
+
}
|
|
34
|
+
// term
|
|
35
|
+
if ((_f = flattenedFilters.term) === null || _f === void 0 ? void 0 : _f.length) {
|
|
36
|
+
processedFilters.title = flattenedFilters.term[0];
|
|
37
|
+
}
|
|
38
|
+
// orgId
|
|
39
|
+
if ((_g = flattenedFilters.orgId) === null || _g === void 0 ? void 0 : _g.length) {
|
|
40
|
+
processedFilters.orgId = flattenedFilters.orgId[0];
|
|
41
|
+
}
|
|
42
|
+
// categories
|
|
43
|
+
if ((_h = flattenedFilters.categories) === null || _h === void 0 ? void 0 : _h.length) {
|
|
44
|
+
processedFilters.categories = flattenedFilters.categories;
|
|
45
|
+
}
|
|
46
|
+
// tags
|
|
47
|
+
if ((_j = flattenedFilters.tags) === null || _j === void 0 ? void 0 : _j.length) {
|
|
48
|
+
processedFilters.tags = flattenedFilters.tags;
|
|
49
|
+
}
|
|
50
|
+
// group
|
|
51
|
+
if ((_k = flattenedFilters.group) === null || _k === void 0 ? void 0 : _k.length) {
|
|
52
|
+
const { ids, notIds } = flattenedFilters.group.reduce((acc, id) => id.not
|
|
53
|
+
? Object.assign(Object.assign({}, acc), { notIds: [
|
|
54
|
+
...acc.notIds,
|
|
55
|
+
...(Array.isArray(id.not) ? id.not : [id.not]),
|
|
56
|
+
] }) : Object.assign(Object.assign({}, acc), { ids: [...acc.ids, id] }), { ids: [], notIds: [] });
|
|
57
|
+
if (ids.length) {
|
|
58
|
+
processedFilters.sharedToGroups = ids;
|
|
83
59
|
}
|
|
84
|
-
if (
|
|
85
|
-
|
|
60
|
+
if (notIds.length) {
|
|
61
|
+
const uniqueIds = notIds.filter(unique);
|
|
62
|
+
// we do not currently have an inverse parameter for `sharedToGroups` at this time. instead, we have separate
|
|
63
|
+
// params for `withoutEditGroups` and `withoutReadGroups`. rather than trying to reconcile whether
|
|
64
|
+
// any given group ID belongs to a view or update group (which would require additional HTTP requests),
|
|
65
|
+
// we simply pass all the ids to both `withoutEditGroups` and `withoutReadGroups`.
|
|
66
|
+
processedFilters.withoutEditGroups = uniqueIds;
|
|
67
|
+
processedFilters.withoutReadGroups = uniqueIds;
|
|
86
68
|
}
|
|
87
69
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (notReadGroupIds.length) {
|
|
92
|
-
processedFilters.withoutReadGroups = notReadGroupIds;
|
|
93
|
-
}
|
|
94
|
-
const notEditGroupIds = getUniquePredicateValuesByKey(filters, "notEditGroupId");
|
|
95
|
-
if (notEditGroupIds.length) {
|
|
96
|
-
processedFilters.withoutEditGroups = notEditGroupIds;
|
|
97
|
-
}
|
|
70
|
+
// attendanceType
|
|
71
|
+
if ((_l = flattenedFilters.attendanceType) === null || _l === void 0 ? void 0 : _l.length) {
|
|
72
|
+
processedFilters.attendanceTypes = toEnums(flattenedFilters.attendanceType, EventAttendanceType);
|
|
98
73
|
}
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
processedFilters.
|
|
74
|
+
// owner
|
|
75
|
+
if ((_m = flattenedFilters.owner) === null || _m === void 0 ? void 0 : _m.length) {
|
|
76
|
+
processedFilters.createdByIds = flattenedFilters.owner;
|
|
102
77
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
processedFilters.createdByIds = createdByIds;
|
|
106
|
-
}
|
|
107
|
-
const status = getUniquePredicateValuesByKey(filters, "status");
|
|
108
|
-
processedFilters.status = status.length
|
|
109
|
-
? toEnums(status, EventStatus)
|
|
78
|
+
// status
|
|
79
|
+
processedFilters.status = ((_o = flattenedFilters.status) === null || _o === void 0 ? void 0 : _o.length) ? toEnums(flattenedFilters.status, EventStatus)
|
|
110
80
|
: [EventStatus.PLANNED, EventStatus.CANCELED];
|
|
111
|
-
const startDateRange = getPredicateValuesByKey(filters, "startDateRange");
|
|
112
81
|
// if a startDateRange was provided, we prioritize that over individual startDateBefore or startDateAfter
|
|
113
82
|
// filters to prevent collisions
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
startDateRange[0].to &&
|
|
118
|
-
(processedFilters.startDateTimeBefore = new Date(startDateRange[0].to).toISOString());
|
|
119
|
-
startDateRange[0].from &&
|
|
120
|
-
(processedFilters.startDateTimeAfter = new Date(startDateRange[0].from).toISOString());
|
|
83
|
+
if ((_p = flattenedFilters.startDateRange) === null || _p === void 0 ? void 0 : _p.length) {
|
|
84
|
+
// We are explicitly checking if the to and from values are present
|
|
85
|
+
// Because w/ Occurrence, we can have just to or from values
|
|
86
|
+
flattenedFilters.startDateRange[0].to &&
|
|
87
|
+
(processedFilters.startDateTimeBefore = new Date(flattenedFilters.startDateRange[0].to).toISOString());
|
|
88
|
+
flattenedFilters.startDateRange[0].from &&
|
|
89
|
+
(processedFilters.startDateTimeAfter = new Date(flattenedFilters.startDateRange[0].from).toISOString());
|
|
121
90
|
}
|
|
122
91
|
else {
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
processedFilters.startDateTimeBefore = new Date(startDateBefore[0]).toISOString();
|
|
92
|
+
// startDateBefore
|
|
93
|
+
if ((_q = flattenedFilters.startDateBefore) === null || _q === void 0 ? void 0 : _q.length) {
|
|
94
|
+
processedFilters.startDateTimeBefore = new Date(flattenedFilters.startDateBefore[0]).toISOString();
|
|
127
95
|
}
|
|
128
|
-
|
|
129
|
-
if (startDateAfter.length) {
|
|
130
|
-
processedFilters.startDateTimeAfter = new Date(startDateAfter[0]).toISOString();
|
|
96
|
+
// startDateAfter
|
|
97
|
+
if ((_r = flattenedFilters.startDateAfter) === null || _r === void 0 ? void 0 : _r.length) {
|
|
98
|
+
processedFilters.startDateTimeAfter = new Date(flattenedFilters.startDateAfter[0]).toISOString();
|
|
131
99
|
}
|
|
132
100
|
}
|
|
133
|
-
const endDateRange = getPredicateValuesByKey(filters, "endDateRange");
|
|
134
101
|
// if a endDateRange was provided, we prioritize that over individual endDateBefore or endDateAfter
|
|
135
102
|
// filters to prevent collisions
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
endDateRange[0].to &&
|
|
140
|
-
(processedFilters.endDateTimeBefore = new Date(endDateRange[0].to).toISOString());
|
|
141
|
-
endDateRange[0].from &&
|
|
142
|
-
(processedFilters.endDateTimeAfter = new Date(endDateRange[0].from).toISOString());
|
|
103
|
+
if ((_s = flattenedFilters.endDateRange) === null || _s === void 0 ? void 0 : _s.length) {
|
|
104
|
+
// We are explicitly checking if the to and from values are present
|
|
105
|
+
// Because w/ Occurrence, we can have just to or from values
|
|
106
|
+
flattenedFilters.endDateRange[0].to &&
|
|
107
|
+
(processedFilters.endDateTimeBefore = new Date(flattenedFilters.endDateRange[0].to).toISOString());
|
|
108
|
+
flattenedFilters.endDateRange[0].from &&
|
|
109
|
+
(processedFilters.endDateTimeAfter = new Date(flattenedFilters.endDateRange[0].from).toISOString());
|
|
143
110
|
}
|
|
144
111
|
else {
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
processedFilters.endDateTimeBefore = new Date(endDateBefore[0]).toISOString();
|
|
112
|
+
// endDateBefore
|
|
113
|
+
if ((_t = flattenedFilters.endDateBefore) === null || _t === void 0 ? void 0 : _t.length) {
|
|
114
|
+
processedFilters.endDateTimeBefore = new Date(flattenedFilters.endDateBefore[0]).toISOString();
|
|
149
115
|
}
|
|
150
|
-
|
|
151
|
-
if (endDateAfter.length) {
|
|
152
|
-
processedFilters.endDateTimeAfter = new Date(endDateAfter[0]).toISOString();
|
|
116
|
+
// endDateAfter
|
|
117
|
+
if ((_u = flattenedFilters.endDateAfter) === null || _u === void 0 ? void 0 : _u.length) {
|
|
118
|
+
processedFilters.endDateTimeAfter = new Date(flattenedFilters.endDateAfter[0]).toISOString();
|
|
153
119
|
}
|
|
154
120
|
}
|
|
155
121
|
// If there's an occurrence filter, we need to adjust the startDateTimeBefore, startDateTimeAfter
|
|
156
122
|
// Depending on the occurrence.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
occurrence.forEach((o) => {
|
|
123
|
+
if ((_v = flattenedFilters.occurrence) === null || _v === void 0 ? void 0 : _v.length) {
|
|
124
|
+
flattenedFilters.occurrence.forEach((o) => {
|
|
160
125
|
switch (o) {
|
|
161
126
|
case "upcoming":
|
|
162
127
|
processedFilters.startDateTimeAfter = new Date().toISOString();
|
|
@@ -171,6 +136,18 @@ export async function processFilters(filters, requestOptions) {
|
|
|
171
136
|
}
|
|
172
137
|
});
|
|
173
138
|
}
|
|
139
|
+
// modified
|
|
140
|
+
if (((_w = flattenedFilters.modified) === null || _w === void 0 ? void 0 : _w.length) &&
|
|
141
|
+
flattenedFilters.modified[0].to &&
|
|
142
|
+
flattenedFilters.modified[0].from) {
|
|
143
|
+
// range
|
|
144
|
+
// TODO: remove ts-ignore once ISearchEvents supports filtering by updatedAtBefore https://devtopia.esri.com/dc/hub/issues/12925
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
processedFilters.updatedAtBefore = new Date(flattenedFilters.modified[0].to).toISOString();
|
|
147
|
+
// TODO: remove ts-ignore once ISearchEvents supports filtering by updatedAtAfter https://devtopia.esri.com/dc/hub/issues/12925
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
processedFilters.updatedAtAfter = new Date(flattenedFilters.modified[0].from).toISOString();
|
|
150
|
+
}
|
|
174
151
|
return processedFilters;
|
|
175
152
|
}
|
|
176
153
|
//# sourceMappingURL=processFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processFilters.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,GAEZ,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"processFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processFilters.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,GAEZ,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAkB;;IAC/C,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,gBAAgB,GAA2B,EAAE,CAAC;IAEpD,SAAS;IACT,UAAI,gBAAgB,CAAC,MAAM,0CAAE,MAAM,EAAE;QACnC,gBAAgB,CAAC,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;KACzE;IAED,UAAU;IACV,UAAI,gBAAgB,CAAC,OAAO,0CAAE,MAAM,EAAE;QACpC,g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AC;oBAC7D,MAAM;aACT;QACH,CAAC,CAAC,CAAC;KACJ;IAED,WAAW;IACX,IACE,OAAA,gBAAgB,CAAC,QAAQ,0CAAE,MAAM;QACjC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;QAC/B,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EACjC;QACA,QAAQ;QACR,gIAAgI;QAChI,aAAa;QACb,gBAAgB,CAAC,eAAe,GAAG,IAAI,IAAI,CACzC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAChC,CAAC,WAAW,EAAE,CAAC;QAChB,+HAA+H;QAC/H,aAAa;QACb,gBAAgB,CAAC,cAAc,GAAG,IAAI,IAAI,CACxC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAClC,CAAC,WAAW,EAAE,CAAC;KACjB;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -14,13 +14,9 @@ import { processFilters } from "./hubEventsHelpers/processFilters";
|
|
|
14
14
|
* - term: string;
|
|
15
15
|
* - categories: string | string[];
|
|
16
16
|
* - tags: string | string[];
|
|
17
|
-
* - group: string | string[];
|
|
18
|
-
* - notGroup: string | string[];
|
|
19
|
-
* - readGroupId: string | string[];
|
|
20
|
-
* - notReadGroupId: string | string[];
|
|
21
|
-
* - editGroupId: string | string[];
|
|
22
|
-
* - notEditGroupId: string | string[];
|
|
17
|
+
* - group: string | string[] | { not: string } | { not: string[] };
|
|
23
18
|
* - attendanceType: 'virtual' | 'in_person' | Array<'virtual' | 'in_person'>;
|
|
19
|
+
* - occurrence: 'upcoming' | 'past' | 'inProgress'
|
|
24
20
|
* - owner: string | string[];
|
|
25
21
|
* - status: 'planned' | 'canceled' | 'removed' | Array<'planned' | 'canceled' | 'removed'>;
|
|
26
22
|
* - startDateBefore: string | number;
|
|
@@ -30,6 +26,7 @@ import { processFilters } from "./hubEventsHelpers/processFilters";
|
|
|
30
26
|
* - endDateBefore: string | number;
|
|
31
27
|
* - endDateAfter: string | number;
|
|
32
28
|
* - orgId: string;
|
|
29
|
+
* - modified: IDateRange<string | number>;
|
|
33
30
|
* Currently supported sort fields include:
|
|
34
31
|
* - created
|
|
35
32
|
* - modified
|
|
@@ -40,7 +37,7 @@ import { processFilters } from "./hubEventsHelpers/processFilters";
|
|
|
40
37
|
* @returns a promise that resolves a <IHubSearchResponse<IHubSearchResult> object
|
|
41
38
|
*/
|
|
42
39
|
export async function hubSearchEvents(query, options) {
|
|
43
|
-
const processedFilters =
|
|
40
|
+
const processedFilters = processFilters(query.filters);
|
|
44
41
|
const processedOptions = processOptions(options);
|
|
45
42
|
const data = Object.assign(Object.assign(Object.assign({}, processedFilters), processedOptions), { include: [GetEventsInclude.creator, GetEventsInclude.location] });
|
|
46
43
|
const { items, nextStart, total } = await searchEvents(Object.assign(Object.assign({}, options.requestOptions), { data }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubSearchEvents.js","sourceRoot":"","sources":["../../../../src/search/_internal/hubSearchEvents.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,gBAAgB,GAEjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE
|
|
1
|
+
{"version":3,"file":"hubSearchEvents.js","sourceRoot":"","sources":["../../../../src/search/_internal/hubSearchEvents.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,gBAAgB,GAEjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAa,EACb,OAA0B;IAE1B,MAAM,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,IAAI,iDACL,gBAAgB,GAChB,gBAAgB,KACnB,OAAO,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAC/D,CAAC;IACF,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,YAAY,iCACjD,OAAO,CAAC,cAAc,KACzB,IAAI,IACJ,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAC1D,CAAC;IACF,MAAM,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC;IAC/B,OAAO;QACL,KAAK;QACL,OAAO;QACP,OAAO;QACP,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;aACvE;YACD,OAAO,eAAe,CAAC,KAAK,kCACvB,OAAO,KACV,KAAK,EAAE,SAAS,IAChB,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processChannelFilters = void 0;
|
|
3
|
+
exports.processChannelFilters = exports.flattenFilters = void 0;
|
|
4
|
+
const util_1 = require("../../../util");
|
|
5
|
+
/**
|
|
6
|
+
* Flattens an array of IFilter objects into a map of key/value pairs where the key is the name of the
|
|
7
|
+
* predicate and the value is a unique array of all values for that predicate name spanning all collections
|
|
8
|
+
* and predicates. Uniqueness is only guaranteed for primitives (i.e. strings, boolean, number, etc). E.g.
|
|
9
|
+
*
|
|
10
|
+
* const x = flattenFilters([{
|
|
11
|
+
* predicates: [{
|
|
12
|
+
* access: 'public',
|
|
13
|
+
* }, {
|
|
14
|
+
* access: 'org',
|
|
15
|
+
* }],
|
|
16
|
+
* }, {
|
|
17
|
+
* predicates: [{
|
|
18
|
+
* access: ['private', 'org]
|
|
19
|
+
* }]
|
|
20
|
+
* }]);
|
|
21
|
+
*
|
|
22
|
+
* x // => { access: ['public', 'org', 'private']}
|
|
23
|
+
* @param filters An array of IFilter objects
|
|
24
|
+
* @returns an object containing key/value pairs of parameter values
|
|
25
|
+
*/
|
|
4
26
|
function flattenFilters(filters) {
|
|
5
27
|
return filters.reduce((acc1, filter) => filter.predicates.reduce((acc2, predicate) => Object.keys(predicate).reduce((acc3, predicateKey) => {
|
|
6
|
-
const
|
|
7
|
-
values.push(...(Array.isArray(predicate[predicateKey])
|
|
28
|
+
const valuesToAdd = Array.isArray(predicate[predicateKey])
|
|
8
29
|
? predicate[predicateKey]
|
|
9
|
-
: [predicate[predicateKey]]
|
|
30
|
+
: [predicate[predicateKey]];
|
|
31
|
+
const values = valuesToAdd.reduce((acc4, valueToAdd) => acc4.includes(valueToAdd) ? acc4 : [...acc4, valueToAdd], acc3[predicateKey] || []);
|
|
10
32
|
return Object.assign(Object.assign({}, acc3), { [predicateKey]: values });
|
|
11
33
|
}, acc2), acc1), {});
|
|
12
34
|
}
|
|
35
|
+
exports.flattenFilters = flattenFilters;
|
|
13
36
|
/**
|
|
14
37
|
* @private
|
|
15
38
|
* Converts an IFilter array into a partial ISearchChannels
|
|
@@ -40,7 +63,7 @@ function processChannelFilters(filters) {
|
|
|
40
63
|
channelOptions.ids = ids;
|
|
41
64
|
}
|
|
42
65
|
if (notIds.length) {
|
|
43
|
-
channelOptions.notIds = notIds;
|
|
66
|
+
channelOptions.notIds = notIds.filter(util_1.unique);
|
|
44
67
|
}
|
|
45
68
|
}
|
|
46
69
|
return channelOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processChannelFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubDiscussionsHelpers/processChannelFilters.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"processChannelFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubDiscussionsHelpers/processChannelFilters.ts"],"names":[],"mappings":";;;AACA,wCAAuC;AAGvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,cAAc,CAAC,OAAkB;IAC/C,OAAO,OAAO,CAAC,MAAM,CACnB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CACf,MAAM,CAAC,UAAU,CAAC,MAAM,CACtB,CAAC,IAAI,EAAE,SAAqB,EAAE,EAAE,CAC9B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAC3B,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE;QACrB,MAAM,WAAW,GAAU,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC/D,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC;YACzB,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAC/B,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,CACnB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,EAC1D,IAAI,CAAC,YAAY,CAAC,IAAK,EAAY,CACpC,CAAC;QACF,uCACK,IAAI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CAAC;QACF,IAAI,GAAG,CAAC,MAAM,EAAE;YACd,cAAc,CAAC,GAAG,GAAG,GAAG,CAAC;SAC1B;QACD,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,CAAC;SAC/C;KACF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAvCD,sDAuCC"}
|
|
@@ -15,8 +15,6 @@ function processAttendeeFilters(query) {
|
|
|
15
15
|
}
|
|
16
16
|
const term = getPredicateValuesByKey_1.getPredicateValuesByKey(query.filters, "term");
|
|
17
17
|
if (term.length) {
|
|
18
|
-
// TODO: remove ts-ignore once GetEventsParams supports filtering by username, firstName, lastName https://devtopia.esri.com/dc/hub/issues/10153
|
|
19
|
-
// @ts-ignore
|
|
20
18
|
processedFilters.name = term[0];
|
|
21
19
|
}
|
|
22
20
|
processedFilters.type = useElseJoin(getOptionalPredicateStringsByKey_1.getOptionalPredicateStringsByKey(query.filters, "attendanceType"), [types_1.EventAttendanceType.VIRTUAL, types_1.EventAttendanceType.IN_PERSON]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processAttendeeFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processAttendeeFilters.ts"],"names":[],"mappings":";;;AAAA,qDAKmC;AAEnC,yFAAsF;AACtF,uEAAoE;AAEpE,SAAgB,sBAAsB,CACpC,KAAa;IAEb,MAAM,gBAAgB,GAAoC;QACxD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO;KAClC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,QAAkB,EAAU,EAAE,CAChE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,mEAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;QAClB,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;KAClC;IAED,MAAM,IAAI,GAAG,iDAAuB,
|
|
1
|
+
{"version":3,"file":"processAttendeeFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processAttendeeFilters.ts"],"names":[],"mappings":";;;AAAA,qDAKmC;AAEnC,yFAAsF;AACtF,uEAAoE;AAEpE,SAAgB,sBAAsB,CACpC,KAAa;IAEb,MAAM,gBAAgB,GAAoC;QACxD,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO;KAClC,CAAC;IACF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,QAAkB,EAAU,EAAE,CAChE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,mEAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzE,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;QAClB,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC;KAClC;IAED,MAAM,IAAI,GAAG,iDAAuB,CAAS,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpE,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,gBAAgB,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;KACjC;IAED,gBAAgB,CAAC,IAAI,GAAG,WAAW,CACjC,mEAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,gBAAgB,CAAC,EACjE,CAAC,2BAAmB,CAAC,OAAO,EAAE,2BAAmB,CAAC,SAAS,CAAC,CAC7D,CAAC;IAEF,gBAAgB,CAAC,IAAI,GAAG,WAAW,CACjC,mEAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EACvD;QACE,wBAAgB,CAAC,KAAK;QACtB,wBAAgB,CAAC,SAAS;QAC1B,wBAAgB,CAAC,QAAQ;KAC1B,CACF,CAAC;IAEF,gBAAgB,CAAC,MAAM,GAAG,WAAW,CACnC,mEAAgC,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,EACzD;QACE,0BAAkB,CAAC,OAAO;QAC1B,0BAAkB,CAAC,QAAQ;QAC3B,0BAAkB,CAAC,QAAQ;QAC3B,0BAAkB,CAAC,OAAO;KAC3B,CACF,CAAC;IAEF,MAAM,gBAAgB,GAAG,iDAAuB,CAC9C,KAAK,CAAC,OAAO,EACb,kBAAkB,CACnB,CAAC;IACF,IAAI,gBAAgB,CAAC,MAAM,EAAE;QAC3B,gBAAgB,CAAC,eAAe,GAAG,IAAI,IAAI,CACzC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CACvB,CAAC,WAAW,EAAE,CAAC;QAChB,gBAAgB,CAAC,cAAc,GAAG,IAAI,IAAI,CACxC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CACzB,CAAC,WAAW,EAAE,CAAC;KACjB;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAzDD,wDAyDC"}
|
|
@@ -2,164 +2,129 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processFilters = void 0;
|
|
4
4
|
const orval_events_1 = require("../../../events/api/orval/api/orval-events");
|
|
5
|
-
const getPredicateValuesByKey_1 = require("./getPredicateValuesByKey");
|
|
6
|
-
const getUniquePredicateValuesByKey_1 = require("./getUniquePredicateValuesByKey");
|
|
7
|
-
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
8
|
-
const is_update_group_1 = require("../../../utils/is-update-group");
|
|
9
5
|
const toEnumConverters_1 = require("./toEnumConverters");
|
|
6
|
+
const processChannelFilters_1 = require("../hubDiscussionsHelpers/processChannelFilters");
|
|
7
|
+
const util_1 = require("../../../util");
|
|
10
8
|
/**
|
|
11
9
|
* Builds a Partial<ISearchEvents> given an Array of IFilter objects
|
|
12
10
|
* @param filters An Array of IFilter
|
|
13
11
|
* @returns a Partial<ISearchEvents> for the given Array of IFilter objects
|
|
14
12
|
*/
|
|
15
|
-
|
|
13
|
+
function processFilters(filters) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
15
|
+
const flattenedFilters = processChannelFilters_1.flattenFilters(filters);
|
|
16
16
|
const processedFilters = {};
|
|
17
|
-
|
|
18
|
-
if (access.length) {
|
|
19
|
-
processedFilters.access = toEnumConverters_1.toEnums(access, orval_events_1.EventAccess);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (canEdit.length) {
|
|
23
|
-
processedFilters.canEdit = canEdit[0];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
processedFilters.entityIds =
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
processedFilters.entityTypes = toEnumConverters_1.toEnums(
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
processedFilters.eventIds =
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (term.length) {
|
|
39
|
-
processedFilters.title = term[0];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (orgId.length) {
|
|
43
|
-
processedFilters.orgId = orgId[0];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (categories.length) {
|
|
47
|
-
processedFilters.categories = categories;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (tags.length) {
|
|
51
|
-
processedFilters.tags = tags;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const readGroupIds = getUniquePredicateValuesByKey_1.getUniquePredicateValuesByKey(filters, "readGroupId");
|
|
63
|
-
if (readGroupIds.length) {
|
|
64
|
-
processedFilters.readGroups = readGroupIds;
|
|
65
|
-
}
|
|
66
|
-
const editGroupIds = getUniquePredicateValuesByKey_1.getUniquePredicateValuesByKey(filters, "editGroupId");
|
|
67
|
-
if (editGroupIds.length) {
|
|
68
|
-
processedFilters.editGroups = editGroupIds;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// NOTE: previously notGroup was an inverse of group, but now they are subtly different
|
|
72
|
-
// We do not yet have an inverse of sharedToGroups.
|
|
73
|
-
const notGroupIds = getUniquePredicateValuesByKey_1.getUniquePredicateValuesByKey(filters, "notGroup");
|
|
74
|
-
// if a notGroup was provided, we prioritize that over individual notReadGroupId or notEditGroupId
|
|
75
|
-
// filters to prevent collisions
|
|
76
|
-
if (notGroupIds.length) {
|
|
77
|
-
const { results } = await arcgis_rest_portal_1.searchGroups(Object.assign({ q: `id:(${notGroupIds.join(" OR ")})`, num: notGroupIds.length }, requestOptions));
|
|
78
|
-
const { notReadGroupIds, notEditGroupIds } = results.reduce((acc, group) => {
|
|
79
|
-
const key = is_update_group_1.isUpdateGroup(group)
|
|
80
|
-
? "notEditGroupIds"
|
|
81
|
-
: "notReadGroupIds";
|
|
82
|
-
return Object.assign(Object.assign({}, acc), { [key]: [...acc[key], group.id] });
|
|
83
|
-
}, { notReadGroupIds: [], notEditGroupIds: [] });
|
|
84
|
-
if (notReadGroupIds.length) {
|
|
85
|
-
processedFilters.withoutReadGroups = notReadGroupIds;
|
|
17
|
+
// access
|
|
18
|
+
if ((_a = flattenedFilters.access) === null || _a === void 0 ? void 0 : _a.length) {
|
|
19
|
+
processedFilters.access = toEnumConverters_1.toEnums(flattenedFilters.access, orval_events_1.EventAccess);
|
|
20
|
+
}
|
|
21
|
+
// canEdit
|
|
22
|
+
if ((_b = flattenedFilters.canEdit) === null || _b === void 0 ? void 0 : _b.length) {
|
|
23
|
+
processedFilters.canEdit = flattenedFilters.canEdit[0];
|
|
24
|
+
}
|
|
25
|
+
// entityId
|
|
26
|
+
if ((_c = flattenedFilters.entityId) === null || _c === void 0 ? void 0 : _c.length) {
|
|
27
|
+
processedFilters.entityIds = flattenedFilters.entityId;
|
|
28
|
+
}
|
|
29
|
+
// entityType
|
|
30
|
+
if ((_d = flattenedFilters.entityType) === null || _d === void 0 ? void 0 : _d.length) {
|
|
31
|
+
processedFilters.entityTypes = toEnumConverters_1.toEnums(flattenedFilters.entityType, orval_events_1.EventAssociationEntityType);
|
|
32
|
+
}
|
|
33
|
+
// id
|
|
34
|
+
if ((_e = flattenedFilters.id) === null || _e === void 0 ? void 0 : _e.length) {
|
|
35
|
+
processedFilters.eventIds = flattenedFilters.id;
|
|
36
|
+
}
|
|
37
|
+
// term
|
|
38
|
+
if ((_f = flattenedFilters.term) === null || _f === void 0 ? void 0 : _f.length) {
|
|
39
|
+
processedFilters.title = flattenedFilters.term[0];
|
|
40
|
+
}
|
|
41
|
+
// orgId
|
|
42
|
+
if ((_g = flattenedFilters.orgId) === null || _g === void 0 ? void 0 : _g.length) {
|
|
43
|
+
processedFilters.orgId = flattenedFilters.orgId[0];
|
|
44
|
+
}
|
|
45
|
+
// categories
|
|
46
|
+
if ((_h = flattenedFilters.categories) === null || _h === void 0 ? void 0 : _h.length) {
|
|
47
|
+
processedFilters.categories = flattenedFilters.categories;
|
|
48
|
+
}
|
|
49
|
+
// tags
|
|
50
|
+
if ((_j = flattenedFilters.tags) === null || _j === void 0 ? void 0 : _j.length) {
|
|
51
|
+
processedFilters.tags = flattenedFilters.tags;
|
|
52
|
+
}
|
|
53
|
+
// group
|
|
54
|
+
if ((_k = flattenedFilters.group) === null || _k === void 0 ? void 0 : _k.length) {
|
|
55
|
+
const { ids, notIds } = flattenedFilters.group.reduce((acc, id) => id.not
|
|
56
|
+
? Object.assign(Object.assign({}, acc), { notIds: [
|
|
57
|
+
...acc.notIds,
|
|
58
|
+
...(Array.isArray(id.not) ? id.not : [id.not]),
|
|
59
|
+
] }) : Object.assign(Object.assign({}, acc), { ids: [...acc.ids, id] }), { ids: [], notIds: [] });
|
|
60
|
+
if (ids.length) {
|
|
61
|
+
processedFilters.sharedToGroups = ids;
|
|
86
62
|
}
|
|
87
|
-
if (
|
|
88
|
-
|
|
63
|
+
if (notIds.length) {
|
|
64
|
+
const uniqueIds = notIds.filter(util_1.unique);
|
|
65
|
+
// we do not currently have an inverse parameter for `sharedToGroups` at this time. instead, we have separate
|
|
66
|
+
// params for `withoutEditGroups` and `withoutReadGroups`. rather than trying to reconcile whether
|
|
67
|
+
// any given group ID belongs to a view or update group (which would require additional HTTP requests),
|
|
68
|
+
// we simply pass all the ids to both `withoutEditGroups` and `withoutReadGroups`.
|
|
69
|
+
processedFilters.withoutEditGroups = uniqueIds;
|
|
70
|
+
processedFilters.withoutReadGroups = uniqueIds;
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (notReadGroupIds.length) {
|
|
95
|
-
processedFilters.withoutReadGroups = notReadGroupIds;
|
|
96
|
-
}
|
|
97
|
-
const notEditGroupIds = getUniquePredicateValuesByKey_1.getUniquePredicateValuesByKey(filters, "notEditGroupId");
|
|
98
|
-
if (notEditGroupIds.length) {
|
|
99
|
-
processedFilters.withoutEditGroups = notEditGroupIds;
|
|
100
|
-
}
|
|
73
|
+
// attendanceType
|
|
74
|
+
if ((_l = flattenedFilters.attendanceType) === null || _l === void 0 ? void 0 : _l.length) {
|
|
75
|
+
processedFilters.attendanceTypes = toEnumConverters_1.toEnums(flattenedFilters.attendanceType, orval_events_1.EventAttendanceType);
|
|
101
76
|
}
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
processedFilters.
|
|
77
|
+
// owner
|
|
78
|
+
if ((_m = flattenedFilters.owner) === null || _m === void 0 ? void 0 : _m.length) {
|
|
79
|
+
processedFilters.createdByIds = flattenedFilters.owner;
|
|
105
80
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
processedFilters.createdByIds = createdByIds;
|
|
109
|
-
}
|
|
110
|
-
const status = getUniquePredicateValuesByKey_1.getUniquePredicateValuesByKey(filters, "status");
|
|
111
|
-
processedFilters.status = status.length
|
|
112
|
-
? toEnumConverters_1.toEnums(status, orval_events_1.EventStatus)
|
|
81
|
+
// status
|
|
82
|
+
processedFilters.status = ((_o = flattenedFilters.status) === null || _o === void 0 ? void 0 : _o.length) ? toEnumConverters_1.toEnums(flattenedFilters.status, orval_events_1.EventStatus)
|
|
113
83
|
: [orval_events_1.EventStatus.PLANNED, orval_events_1.EventStatus.CANCELED];
|
|
114
|
-
const startDateRange = getPredicateValuesByKey_1.getPredicateValuesByKey(filters, "startDateRange");
|
|
115
84
|
// if a startDateRange was provided, we prioritize that over individual startDateBefore or startDateAfter
|
|
116
85
|
// filters to prevent collisions
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
startDateRange[0].to &&
|
|
121
|
-
(processedFilters.startDateTimeBefore = new Date(startDateRange[0].to).toISOString());
|
|
122
|
-
startDateRange[0].from &&
|
|
123
|
-
(processedFilters.startDateTimeAfter = new Date(startDateRange[0].from).toISOString());
|
|
86
|
+
if ((_p = flattenedFilters.startDateRange) === null || _p === void 0 ? void 0 : _p.length) {
|
|
87
|
+
// We are explicitly checking if the to and from values are present
|
|
88
|
+
// Because w/ Occurrence, we can have just to or from values
|
|
89
|
+
flattenedFilters.startDateRange[0].to &&
|
|
90
|
+
(processedFilters.startDateTimeBefore = new Date(flattenedFilters.startDateRange[0].to).toISOString());
|
|
91
|
+
flattenedFilters.startDateRange[0].from &&
|
|
92
|
+
(processedFilters.startDateTimeAfter = new Date(flattenedFilters.startDateRange[0].from).toISOString());
|
|
124
93
|
}
|
|
125
94
|
else {
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
processedFilters.startDateTimeBefore = new Date(startDateBefore[0]).toISOString();
|
|
95
|
+
// startDateBefore
|
|
96
|
+
if ((_q = flattenedFilters.startDateBefore) === null || _q === void 0 ? void 0 : _q.length) {
|
|
97
|
+
processedFilters.startDateTimeBefore = new Date(flattenedFilters.startDateBefore[0]).toISOString();
|
|
130
98
|
}
|
|
131
|
-
|
|
132
|
-
if (startDateAfter.length) {
|
|
133
|
-
processedFilters.startDateTimeAfter = new Date(startDateAfter[0]).toISOString();
|
|
99
|
+
// startDateAfter
|
|
100
|
+
if ((_r = flattenedFilters.startDateAfter) === null || _r === void 0 ? void 0 : _r.length) {
|
|
101
|
+
processedFilters.startDateTimeAfter = new Date(flattenedFilters.startDateAfter[0]).toISOString();
|
|
134
102
|
}
|
|
135
103
|
}
|
|
136
|
-
const endDateRange = getPredicateValuesByKey_1.getPredicateValuesByKey(filters, "endDateRange");
|
|
137
104
|
// if a endDateRange was provided, we prioritize that over individual endDateBefore or endDateAfter
|
|
138
105
|
// filters to prevent collisions
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
endDateRange[0].to &&
|
|
143
|
-
(processedFilters.endDateTimeBefore = new Date(endDateRange[0].to).toISOString());
|
|
144
|
-
endDateRange[0].from &&
|
|
145
|
-
(processedFilters.endDateTimeAfter = new Date(endDateRange[0].from).toISOString());
|
|
106
|
+
if ((_s = flattenedFilters.endDateRange) === null || _s === void 0 ? void 0 : _s.length) {
|
|
107
|
+
// We are explicitly checking if the to and from values are present
|
|
108
|
+
// Because w/ Occurrence, we can have just to or from values
|
|
109
|
+
flattenedFilters.endDateRange[0].to &&
|
|
110
|
+
(processedFilters.endDateTimeBefore = new Date(flattenedFilters.endDateRange[0].to).toISOString());
|
|
111
|
+
flattenedFilters.endDateRange[0].from &&
|
|
112
|
+
(processedFilters.endDateTimeAfter = new Date(flattenedFilters.endDateRange[0].from).toISOString());
|
|
146
113
|
}
|
|
147
114
|
else {
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
processedFilters.endDateTimeBefore = new Date(endDateBefore[0]).toISOString();
|
|
115
|
+
// endDateBefore
|
|
116
|
+
if ((_t = flattenedFilters.endDateBefore) === null || _t === void 0 ? void 0 : _t.length) {
|
|
117
|
+
processedFilters.endDateTimeBefore = new Date(flattenedFilters.endDateBefore[0]).toISOString();
|
|
152
118
|
}
|
|
153
|
-
|
|
154
|
-
if (endDateAfter.length) {
|
|
155
|
-
processedFilters.endDateTimeAfter = new Date(endDateAfter[0]).toISOString();
|
|
119
|
+
// endDateAfter
|
|
120
|
+
if ((_u = flattenedFilters.endDateAfter) === null || _u === void 0 ? void 0 : _u.length) {
|
|
121
|
+
processedFilters.endDateTimeAfter = new Date(flattenedFilters.endDateAfter[0]).toISOString();
|
|
156
122
|
}
|
|
157
123
|
}
|
|
158
124
|
// If there's an occurrence filter, we need to adjust the startDateTimeBefore, startDateTimeAfter
|
|
159
125
|
// Depending on the occurrence.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
occurrence.forEach((o) => {
|
|
126
|
+
if ((_v = flattenedFilters.occurrence) === null || _v === void 0 ? void 0 : _v.length) {
|
|
127
|
+
flattenedFilters.occurrence.forEach((o) => {
|
|
163
128
|
switch (o) {
|
|
164
129
|
case "upcoming":
|
|
165
130
|
processedFilters.startDateTimeAfter = new Date().toISOString();
|
|
@@ -174,6 +139,18 @@ async function processFilters(filters, requestOptions) {
|
|
|
174
139
|
}
|
|
175
140
|
});
|
|
176
141
|
}
|
|
142
|
+
// modified
|
|
143
|
+
if (((_w = flattenedFilters.modified) === null || _w === void 0 ? void 0 : _w.length) &&
|
|
144
|
+
flattenedFilters.modified[0].to &&
|
|
145
|
+
flattenedFilters.modified[0].from) {
|
|
146
|
+
// range
|
|
147
|
+
// TODO: remove ts-ignore once ISearchEvents supports filtering by updatedAtBefore https://devtopia.esri.com/dc/hub/issues/12925
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
processedFilters.updatedAtBefore = new Date(flattenedFilters.modified[0].to).toISOString();
|
|
150
|
+
// TODO: remove ts-ignore once ISearchEvents supports filtering by updatedAtAfter https://devtopia.esri.com/dc/hub/issues/12925
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
processedFilters.updatedAtAfter = new Date(flattenedFilters.modified[0].from).toISOString();
|
|
153
|
+
}
|
|
177
154
|
return processedFilters;
|
|
178
155
|
}
|
|
179
156
|
exports.processFilters = processFilters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processFilters.ts"],"names":[],"mappings":";;;AACA,6EAMoD;AACpD,
|
|
1
|
+
{"version":3,"file":"processFilters.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/processFilters.ts"],"names":[],"mappings":";;;AACA,6EAMoD;AACpD,yDAA6C;AAC7C,0FAAgF;AAChF,wCAAuC;AAEvC;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAkB;;IAC/C,MAAM,gBAAgB,GAAG,sCAAc,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,gBAAgB,GAA2B,EAAE,CAAC;IAEpD,SAAS;IACT,UAAI,gBAAgB,CAAC,MAAM,0CAAE,MAAM,EAAE;QACnC,gBAAgB,CAAC,MAAM,GAAG,0BAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE,0BAAW,CAAC,CAAC;KACzE;IAED,UAAU;IACV,UAAI,gBAAgB,CAAC,OAAO,0CAAE,MAAM,EAAE;QACpC,gBAAgB,CAAC,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;KACxD;IAED,WAAW;IACX,UAAI,gBAAgB,CAAC,QAAQ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AM;QACjC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;QAC/B,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EACjC;QACA,QAAQ;QACR,gIAAgI;QAChI,aAAa;QACb,gBAAgB,CAAC,eAAe,GAAG,IAAI,IAAI,CACzC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAChC,CAAC,WAAW,EAAE,CAAC;QAChB,+HAA+H;QAC/H,aAAa;QACb,gBAAgB,CAAC,cAAc,GAAG,IAAI,IAAI,CACxC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAClC,CAAC,WAAW,EAAE,CAAC;KACjB;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAvMD,wCAuMC"}
|
|
@@ -17,13 +17,9 @@ const processFilters_1 = require("./hubEventsHelpers/processFilters");
|
|
|
17
17
|
* - term: string;
|
|
18
18
|
* - categories: string | string[];
|
|
19
19
|
* - tags: string | string[];
|
|
20
|
-
* - group: string | string[];
|
|
21
|
-
* - notGroup: string | string[];
|
|
22
|
-
* - readGroupId: string | string[];
|
|
23
|
-
* - notReadGroupId: string | string[];
|
|
24
|
-
* - editGroupId: string | string[];
|
|
25
|
-
* - notEditGroupId: string | string[];
|
|
20
|
+
* - group: string | string[] | { not: string } | { not: string[] };
|
|
26
21
|
* - attendanceType: 'virtual' | 'in_person' | Array<'virtual' | 'in_person'>;
|
|
22
|
+
* - occurrence: 'upcoming' | 'past' | 'inProgress'
|
|
27
23
|
* - owner: string | string[];
|
|
28
24
|
* - status: 'planned' | 'canceled' | 'removed' | Array<'planned' | 'canceled' | 'removed'>;
|
|
29
25
|
* - startDateBefore: string | number;
|
|
@@ -33,6 +29,7 @@ const processFilters_1 = require("./hubEventsHelpers/processFilters");
|
|
|
33
29
|
* - endDateBefore: string | number;
|
|
34
30
|
* - endDateAfter: string | number;
|
|
35
31
|
* - orgId: string;
|
|
32
|
+
* - modified: IDateRange<string | number>;
|
|
36
33
|
* Currently supported sort fields include:
|
|
37
34
|
* - created
|
|
38
35
|
* - modified
|
|
@@ -43,7 +40,7 @@ const processFilters_1 = require("./hubEventsHelpers/processFilters");
|
|
|
43
40
|
* @returns a promise that resolves a <IHubSearchResponse<IHubSearchResult> object
|
|
44
41
|
*/
|
|
45
42
|
async function hubSearchEvents(query, options) {
|
|
46
|
-
const processedFilters =
|
|
43
|
+
const processedFilters = processFilters_1.processFilters(query.filters);
|
|
47
44
|
const processedOptions = processOptions_1.processOptions(options);
|
|
48
45
|
const data = Object.assign(Object.assign(Object.assign({}, processedFilters), processedOptions), { include: [orval_events_1.GetEventsInclude.creator, orval_events_1.GetEventsInclude.location] });
|
|
49
46
|
const { items, nextStart, total } = await events_1.searchEvents(Object.assign(Object.assign({}, options.requestOptions), { data }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubSearchEvents.js","sourceRoot":"","sources":["../../../../src/search/_internal/hubSearchEvents.ts"],"names":[],"mappings":";;;AAIA,oDAAuD;AACvD,0EAGiD;AACjD,gFAA6E;AAC7E,sEAAmE;AACnE,sEAAmE;AAEnE
|
|
1
|
+
{"version":3,"file":"hubSearchEvents.js","sourceRoot":"","sources":["../../../../src/search/_internal/hubSearchEvents.ts"],"names":[],"mappings":";;;AAIA,oDAAuD;AACvD,0EAGiD;AACjD,gFAA6E;AAC7E,sEAAmE;AACnE,sEAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACI,KAAK,UAAU,eAAe,CACnC,KAAa,EACb,OAA0B;IAE1B,MAAM,gBAAgB,GAAG,+BAAc,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,+BAAc,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,IAAI,iDACL,gBAAgB,GAChB,gBAAgB,KACnB,OAAO,EAAE,CAAC,+BAAgB,CAAC,OAAO,EAAE,+BAAgB,CAAC,QAAQ,CAAC,GAC/D,CAAC;IACF,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,qBAAY,iCACjD,OAAO,CAAC,cAAc,KACzB,IAAI,IACJ,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yCAAmB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAC1D,CAAC;IACF,MAAM,OAAO,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC;IAC/B,OAAO;QACL,KAAK;QACL,OAAO;QACP,OAAO;QACP,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;aACvE;YACD,OAAO,eAAe,CAAC,KAAK,kCACvB,OAAO,KACV,KAAK,EAAE,SAAS,IAChB,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAjCD,0CAiCC"}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { ISearchChannels } from "../../../discussions/api/types";
|
|
2
2
|
import { IFilter } from "../../types/IHubCatalog";
|
|
3
|
+
/**
|
|
4
|
+
* Flattens an array of IFilter objects into a map of key/value pairs where the key is the name of the
|
|
5
|
+
* predicate and the value is a unique array of all values for that predicate name spanning all collections
|
|
6
|
+
* and predicates. Uniqueness is only guaranteed for primitives (i.e. strings, boolean, number, etc). E.g.
|
|
7
|
+
*
|
|
8
|
+
* const x = flattenFilters([{
|
|
9
|
+
* predicates: [{
|
|
10
|
+
* access: 'public',
|
|
11
|
+
* }, {
|
|
12
|
+
* access: 'org',
|
|
13
|
+
* }],
|
|
14
|
+
* }, {
|
|
15
|
+
* predicates: [{
|
|
16
|
+
* access: ['private', 'org]
|
|
17
|
+
* }]
|
|
18
|
+
* }]);
|
|
19
|
+
*
|
|
20
|
+
* x // => { access: ['public', 'org', 'private']}
|
|
21
|
+
* @param filters An array of IFilter objects
|
|
22
|
+
* @returns an object containing key/value pairs of parameter values
|
|
23
|
+
*/
|
|
24
|
+
export declare function flattenFilters(filters: IFilter[]): Record<string, any[]>;
|
|
3
25
|
/**
|
|
4
26
|
* @private
|
|
5
27
|
* Converts an IFilter array into a partial ISearchChannels
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IFilter } from "../../types/IHubCatalog";
|
|
2
2
|
import { ISearchEvents } from "../../../events/api/orval/api/orval-events";
|
|
3
|
-
import { IHubRequestOptions } from "../../../hub-types";
|
|
4
3
|
/**
|
|
5
4
|
* Builds a Partial<ISearchEvents> given an Array of IFilter objects
|
|
6
5
|
* @param filters An Array of IFilter
|
|
7
6
|
* @returns a Partial<ISearchEvents> for the given Array of IFilter objects
|
|
8
7
|
*/
|
|
9
|
-
export declare function processFilters(filters: IFilter[]
|
|
8
|
+
export declare function processFilters(filters: IFilter[]): Partial<ISearchEvents>;
|
|
@@ -13,13 +13,9 @@ import { IHubSearchResult } from "../types/IHubSearchResult";
|
|
|
13
13
|
* - term: string;
|
|
14
14
|
* - categories: string | string[];
|
|
15
15
|
* - tags: string | string[];
|
|
16
|
-
* - group: string | string[];
|
|
17
|
-
* - notGroup: string | string[];
|
|
18
|
-
* - readGroupId: string | string[];
|
|
19
|
-
* - notReadGroupId: string | string[];
|
|
20
|
-
* - editGroupId: string | string[];
|
|
21
|
-
* - notEditGroupId: string | string[];
|
|
16
|
+
* - group: string | string[] | { not: string } | { not: string[] };
|
|
22
17
|
* - attendanceType: 'virtual' | 'in_person' | Array<'virtual' | 'in_person'>;
|
|
18
|
+
* - occurrence: 'upcoming' | 'past' | 'inProgress'
|
|
23
19
|
* - owner: string | string[];
|
|
24
20
|
* - status: 'planned' | 'canceled' | 'removed' | Array<'planned' | 'canceled' | 'removed'>;
|
|
25
21
|
* - startDateBefore: string | number;
|
|
@@ -29,6 +25,7 @@ import { IHubSearchResult } from "../types/IHubSearchResult";
|
|
|
29
25
|
* - endDateBefore: string | number;
|
|
30
26
|
* - endDateAfter: string | number;
|
|
31
27
|
* - orgId: string;
|
|
28
|
+
* - modified: IDateRange<string | number>;
|
|
32
29
|
* Currently supported sort fields include:
|
|
33
30
|
* - created
|
|
34
31
|
* - modified
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { unique } from "../../../util";
|
|
2
|
-
import { getPredicateValuesByKey } from "./getPredicateValuesByKey";
|
|
3
|
-
export const getUniquePredicateValuesByKey = (filters, predicateKey) => {
|
|
4
|
-
return getPredicateValuesByKey(filters, predicateKey).filter(unique);
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=getUniquePredicateValuesByKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUniquePredicateValuesByKey.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,OAAkB,EAClB,YAAoB,EACf,EAAE;IACP,OAAO,uBAAuB,CAAI,OAAO,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUniquePredicateValuesByKey = void 0;
|
|
4
|
-
const util_1 = require("../../../util");
|
|
5
|
-
const getPredicateValuesByKey_1 = require("./getPredicateValuesByKey");
|
|
6
|
-
exports.getUniquePredicateValuesByKey = (filters, predicateKey) => {
|
|
7
|
-
return getPredicateValuesByKey_1.getPredicateValuesByKey(filters, predicateKey).filter(util_1.unique);
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=getUniquePredicateValuesByKey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUniquePredicateValuesByKey.js","sourceRoot":"","sources":["../../../../../src/search/_internal/hubEventsHelpers/getUniquePredicateValuesByKey.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AAEvC,uEAAoE;AAEvD,QAAA,6BAA6B,GAAG,CAC3C,OAAkB,EAClB,YAAoB,EACf,EAAE;IACP,OAAO,iDAAuB,CAAI,OAAO,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,aAAM,CAAC,CAAC;AAC1E,CAAC,CAAC"}
|