@amityco/ts-sdk 6.5.0 → 6.5.1-3cc5731.0
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/communityRepository/observers/getCommunities.d.ts.map +1 -1
- package/dist/core/query/filtering.d.ts +1 -0
- package/dist/core/query/filtering.d.ts.map +1 -1
- package/dist/index.cjs.js +10 -1
- package/dist/index.esm.js +10 -2
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
- package/src/communityRepository/observers/getCommunities.ts +5 -4
- package/src/core/query/filtering.ts +14 -0
- package/src/core/query/tests/filtering.test.ts +17 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCommunities.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/observers/getCommunities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCommunities.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/observers/getCommunities.ts"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,WACjB,MAAM,uBAAuB,YAC3B,MAAM,sBAAsB,CAAC,MAAM,SAAS,CAAC,WAC9C,MAAM,oBAAoB,eA0IpC,CAAC"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @hidden
|
|
10
10
|
*/
|
|
11
11
|
export declare const filterByPropEquality: <T = Record<string, unknown>>(collection: T[], key: keyof T, value: any) => T[];
|
|
12
|
+
export declare const filterByStringComparePartially: <T = Record<string, unknown>>(collection: T[], key: keyof T, value: any) => T[];
|
|
12
13
|
export declare const filterByPropInclusion: <T = Record<string, unknown>>(collection: T[], key: keyof T, value: any[] | undefined) => T[];
|
|
13
14
|
export declare const filterByPropIntersection: <T extends Record<string, unknown>>(collection: T[], key: keyof T, values: any[] | undefined) => T[];
|
|
14
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filtering.d.ts","sourceRoot":"","sources":["../../../src/core/query/fil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E,GAAG,SAAS,QAQ1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,eACxB,MAAM,OAAO,EAAE,cACf,MAAM,qBAAqB,CAAC,YAAY,CAAC,UAC7C,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAC5C,MAAM,OAAO,EAyBf,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,yDAEjB,MAAM,IAAI,CAAC,UAAU,CAAC,QAgBjC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,2DAE1B,MAAM,uBAAuB,CAAC,YAAY,CAAC,UAC/C,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,QA0BhD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,0DAErB,MAAM,kBAAkB,CAAC,WAAW,CAAC,QAyBjD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB;YAAwB,MAAM,IAAI,CAAC,QAAQ,CAAC;;gCAE7D,MAAM,QAanB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1084,6 +1084,14 @@ const dropFromCache = (key, exact = false) => {
|
|
|
1084
1084
|
const filterByPropEquality = (collection, key, value) => value !== undefined
|
|
1085
1085
|
? collection.filter(item => JSON.stringify(item[key]) === JSON.stringify(value))
|
|
1086
1086
|
: collection;
|
|
1087
|
+
const filterByStringComparePartially = (collection, key, value) => value !== undefined
|
|
1088
|
+
? collection.filter(item => {
|
|
1089
|
+
if (typeof item[key] === 'string' && typeof value === 'string') {
|
|
1090
|
+
return String(item[key]).toLowerCase().match(value.toLowerCase());
|
|
1091
|
+
}
|
|
1092
|
+
return false;
|
|
1093
|
+
})
|
|
1094
|
+
: collection;
|
|
1087
1095
|
const filterByPropInclusion = (collection, key, value) => (value !== undefined ? collection.filter(item => value.includes(item[key])) : collection);
|
|
1088
1096
|
const filterByPropIntersection = (collection, key, values) => {
|
|
1089
1097
|
if (!(values === null || values === void 0 ? void 0 : values.length))
|
|
@@ -30425,7 +30433,7 @@ const getCommunities = (params, callback, config) => {
|
|
|
30425
30433
|
.map(communityId => pullFromCache(['community', 'get', communityId]))
|
|
30426
30434
|
.filter(Boolean)
|
|
30427
30435
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
30428
|
-
communities =
|
|
30436
|
+
communities = filterByStringComparePartially(communities, 'displayName', params.displayName);
|
|
30429
30437
|
if (!params.includeDeleted) {
|
|
30430
30438
|
communities = filterByPropEquality(communities, 'isDeleted', false);
|
|
30431
30439
|
}
|
|
@@ -33946,6 +33954,7 @@ exports.filterByPropEquality = filterByPropEquality;
|
|
|
33946
33954
|
exports.filterByPropInclusion = filterByPropInclusion;
|
|
33947
33955
|
exports.filterByPropIntersection = filterByPropIntersection;
|
|
33948
33956
|
exports.filterBySearchTerm = filterBySearchTerm;
|
|
33957
|
+
exports.filterByStringComparePartially = filterByStringComparePartially;
|
|
33949
33958
|
exports.getChannelMarkers = getChannelMarkers;
|
|
33950
33959
|
exports.getChannelTopic = getChannelTopic;
|
|
33951
33960
|
exports.getCommentTopic = getCommentTopic;
|
package/dist/index.esm.js
CHANGED
|
@@ -1070,6 +1070,14 @@ const dropFromCache = (key, exact = false) => {
|
|
|
1070
1070
|
const filterByPropEquality = (collection, key, value) => value !== undefined
|
|
1071
1071
|
? collection.filter(item => JSON.stringify(item[key]) === JSON.stringify(value))
|
|
1072
1072
|
: collection;
|
|
1073
|
+
const filterByStringComparePartially = (collection, key, value) => value !== undefined
|
|
1074
|
+
? collection.filter(item => {
|
|
1075
|
+
if (typeof item[key] === 'string' && typeof value === 'string') {
|
|
1076
|
+
return String(item[key]).toLowerCase().match(value.toLowerCase());
|
|
1077
|
+
}
|
|
1078
|
+
return false;
|
|
1079
|
+
})
|
|
1080
|
+
: collection;
|
|
1073
1081
|
const filterByPropInclusion = (collection, key, value) => (value !== undefined ? collection.filter(item => value.includes(item[key])) : collection);
|
|
1074
1082
|
const filterByPropIntersection = (collection, key, values) => {
|
|
1075
1083
|
if (!(values === null || values === void 0 ? void 0 : values.length))
|
|
@@ -30411,7 +30419,7 @@ const getCommunities = (params, callback, config) => {
|
|
|
30411
30419
|
.map(communityId => pullFromCache(['community', 'get', communityId]))
|
|
30412
30420
|
.filter(Boolean)
|
|
30413
30421
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
30414
|
-
communities =
|
|
30422
|
+
communities = filterByStringComparePartially(communities, 'displayName', params.displayName);
|
|
30415
30423
|
if (!params.includeDeleted) {
|
|
30416
30424
|
communities = filterByPropEquality(communities, 'isDeleted', false);
|
|
30417
30425
|
}
|
|
@@ -33890,4 +33898,4 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
33890
33898
|
return { accessToken: data.accessToken };
|
|
33891
33899
|
};
|
|
33892
33900
|
|
|
33893
|
-
export { API_REGIONS, index$5 as CategoryRepository, index$g as ChannelRepository, index$f as Client, index$2 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$6 as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$4 as FeedRepository, index$c as FileRepository, FileType, MessageContentType, index$a as MessageRepository, index as PollRepository, PostContentType, index$3 as PostRepository, index$b as ReactionRepository, index$1 as StreamRepository, index$9 as SubChannelRepository, SubscriptionLevels, index$d as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, getChannelMarkers, getChannelTopic, getCommentTopic, getCommunityTopic, getMarkedMessageTopic, getMessageMarkers, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getSubChannelMarkers, getSubChannelTopic, getUserMarker, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|
|
33901
|
+
export { API_REGIONS, index$5 as CategoryRepository, index$g as ChannelRepository, index$f as Client, index$2 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$6 as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$4 as FeedRepository, index$c as FileRepository, FileType, MessageContentType, index$a as MessageRepository, index as PollRepository, PostContentType, index$3 as PostRepository, index$b as ReactionRepository, index$1 as StreamRepository, index$9 as SubChannelRepository, SubscriptionLevels, index$d as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelMarkers, getChannelTopic, getCommentTopic, getCommunityTopic, getMarkedMessageTopic, getMessageMarkers, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getSubChannelMarkers, getSubChannelTopic, getUserMarker, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|