Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 1x 1x 1x 1x 413x 413x | import { DEFAULT_COGNITO_REGION } from '../_defaultConfig'
import { extractSDKVersion } from '../_helpers'
import { KeyStorageApiService } from '@affinidi/internal-api-clients'
import { UserManagementService } from '@affinidi/user-management'
import type { CognitoIdentityProviderClient } from '@affinidi/user-management'
type CreateUserManagementServiceOptions = {
region?: string
shouldDisableNameNormalisation?: boolean
accessApiKey: string
basicOptions: {
keyStorageUrl: string
clientId: string
userPoolId: string
}
otherOptions?: {
cognitoProviderClient?: CognitoIdentityProviderClient
}
}
export const createUserManagementService = (options: CreateUserManagementServiceOptions): UserManagementService => {
const keyStorageApiService = new KeyStorageApiService({
keyStorageUrl: options.basicOptions.keyStorageUrl,
accessApiKey: options.accessApiKey,
sdkVersion: extractSDKVersion(),
})
return new UserManagementService(
{
region: options.region ?? DEFAULT_COGNITO_REGION,
shouldDisableNameNormalisation: options.shouldDisableNameNormalisation,
...options.basicOptions,
},
{ keyStorageApiService, cognitoProviderClient: options.otherOptions?.cognitoProviderClient },
)
}
|