66 */
77
88import {
9- IGraph ,
10- prepScopes ,
9+ BatchResponse ,
1110 CacheItem ,
1211 CacheService ,
1312 CacheStore ,
14- BatchResponse ,
15- CollectionResponse
13+ CollectionResponse ,
14+ IGraph ,
15+ prepScopes
1616} from '@microsoft/mgt-element' ;
1717import { Group } from '@microsoft/microsoft-graph-types' ;
1818import { schemas } from './cacheStores' ;
@@ -26,8 +26,8 @@ const groupTypeValues = ['any', 'unified', 'security', 'mailenabledsecurity', 'd
2626 * @enum {string}
2727 */
2828export type GroupType = ( typeof groupTypeValues ) [ number ] ;
29- export const isGroupType = ( value : unknown ) : value is GroupType =>
30- typeof value === 'string' && groupTypeValues . includes ( value as GroupType ) ;
29+ export const isGroupType = ( groupType : string ) : groupType is ( typeof groupTypeValues ) [ number ] =>
30+ groupTypeValues . includes ( groupType as GroupType ) ;
3131export const groupTypeConverter = ( value : string , defaultValue : GroupType = 'any' ) : GroupType =>
3232 isGroupType ( value ) ? value : defaultValue ;
3333
@@ -99,8 +99,9 @@ export const findGroups = async (
9999 groupTypes : GroupType [ ] = [ 'any' ] ,
100100 groupFilters = ''
101101) : Promise < Group [ ] > => {
102+ const groupTypesString = Array . isArray ( groupTypes ) ? groupTypes . join ( '+' ) : JSON . stringify ( groupTypes ) ;
102103 let cache : CacheStore < CacheGroupQuery > ;
103- const key = `${ query ? query : '*' } *${ groupTypes . join ( '+' ) } *${ groupFilters } :${ top } ` ;
104+ const key = `${ query ? query : '*' } *${ groupTypesString } *${ groupFilters } :${ top } ` ;
104105
105106 if ( getIsGroupsCacheEnabled ( ) ) {
106107 cache = CacheService . getCache ( schemas . groups , schemas . groups . stores . groupsQuery ) ;
@@ -227,7 +228,8 @@ export const findGroupsFromGroup = async (
227228 groupTypes : GroupType [ ] = [ 'any' ]
228229) : Promise < Group [ ] > => {
229230 let cache : CacheStore < CacheGroupQuery > ;
230- const key = `${ groupId } :${ query || '*' } :${ groupTypes . join ( '+' ) } :${ transitive } ` ;
231+ const groupTypesString = Array . isArray ( groupTypes ) ? groupTypes . join ( '+' ) : JSON . stringify ( groupTypes ) ;
232+ const key = `${ groupId } :${ query || '*' } :${ groupTypesString } :${ transitive } ` ;
231233
232234 if ( getIsGroupsCacheEnabled ( ) ) {
233235 cache = CacheService . getCache ( schemas . groups , schemas . groups . stores . groupsQuery ) ;
0 commit comments