6
6
*/
7
7
8
8
import {
9
- IGraph ,
10
- prepScopes ,
9
+ BatchResponse ,
11
10
CacheItem ,
12
11
CacheService ,
13
12
CacheStore ,
14
- BatchResponse ,
15
- CollectionResponse
13
+ CollectionResponse ,
14
+ IGraph ,
15
+ prepScopes
16
16
} from '@microsoft/mgt-element' ;
17
17
import { Group } from '@microsoft/microsoft-graph-types' ;
18
18
import { schemas } from './cacheStores' ;
@@ -26,8 +26,8 @@ const groupTypeValues = ['any', 'unified', 'security', 'mailenabledsecurity', 'd
26
26
* @enum {string}
27
27
*/
28
28
export 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 ) ;
31
31
export const groupTypeConverter = ( value : string , defaultValue : GroupType = 'any' ) : GroupType =>
32
32
isGroupType ( value ) ? value : defaultValue ;
33
33
@@ -99,8 +99,9 @@ export const findGroups = async (
99
99
groupTypes : GroupType [ ] = [ 'any' ] ,
100
100
groupFilters = ''
101
101
) : Promise < Group [ ] > => {
102
+ const groupTypesString = Array . isArray ( groupTypes ) ? groupTypes . join ( '+' ) : JSON . stringify ( groupTypes ) ;
102
103
let cache : CacheStore < CacheGroupQuery > ;
103
- const key = `${ query ? query : '*' } *${ groupTypes . join ( '+' ) } *${ groupFilters } :${ top } ` ;
104
+ const key = `${ query ? query : '*' } *${ groupTypesString } *${ groupFilters } :${ top } ` ;
104
105
105
106
if ( getIsGroupsCacheEnabled ( ) ) {
106
107
cache = CacheService . getCache ( schemas . groups , schemas . groups . stores . groupsQuery ) ;
@@ -227,7 +228,8 @@ export const findGroupsFromGroup = async (
227
228
groupTypes : GroupType [ ] = [ 'any' ]
228
229
) : Promise < Group [ ] > => {
229
230
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 } ` ;
231
233
232
234
if ( getIsGroupsCacheEnabled ( ) ) {
233
235
cache = CacheService . getCache ( schemas . groups , schemas . groups . stores . groupsQuery ) ;
0 commit comments