{\n\t\tlet currUser;\n\n\t\ttry {\n\t\t\tcurrUser = await this.currentUserPoolUser();\n\t\t} catch (error) {\n\t\t\tlogger.debug('The user is not authenticated by the error', error);\n\t\t\tthrow new Error('The user is not authenticated');\n\t\t}\n\n\t\tcurrUser.getCachedDeviceKeyAndPassword();\n\t\treturn new Promise((res, rej) => {\n\t\t\tconst cb = {\n\t\t\t\tonSuccess(data) {\n\t\t\t\t\tconst deviceList: IAuthDevice[] = data.Devices.map(device => {\n\t\t\t\t\t\tconst deviceName =\n\t\t\t\t\t\t\tdevice.DeviceAttributes.find(\n\t\t\t\t\t\t\t\t({ Name }) => Name === 'device_name'\n\t\t\t\t\t\t\t) || {};\n\n\t\t\t\t\t\tconst deviceInfo: IAuthDevice = {\n\t\t\t\t\t\t\tid: device.DeviceKey,\n\t\t\t\t\t\t\tname: deviceName.Value,\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn deviceInfo;\n\t\t\t\t\t});\n\t\t\t\t\tres(deviceList);\n\t\t\t\t},\n\t\t\t\tonFailure: err => {\n\t\t\t\t\tif (err.code === 'InvalidParameterException') {\n\t\t\t\t\t\trej(new AuthError(AuthErrorTypes.DeviceConfig));\n\t\t\t\t\t} else if (err.code === 'NetworkError') {\n\t\t\t\t\t\trej(new AuthError(AuthErrorTypes.NetworkError));\n\t\t\t\t\t} else {\n\t\t\t\t\t\trej(err);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t};\n\t\t\tcurrUser.listDevices(MAX_DEVICES, null, cb);\n\t\t});\n\t}\n}\n\nexport const Auth = new AuthClass(null);\n\nAmplify.register(Auth);\n","/*\n * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { browserOrNode } from '@aws-amplify/core';\n\nexport default callback => {\n\tif (browserOrNode().isBrowser && window.location) {\n\t\tconst url = window.location.href;\n\n\t\tcallback({ url });\n\t} else if (browserOrNode().isNode) {\n\t\t// continue building on ssr\n\t\t() => {}; // noop\n\t} else {\n\t\tthrow new Error('Not supported');\n\t}\n};\n","/*\r\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\r\n * the License. A copy of the License is located at\r\n *\r\n * http://aws.amazon.com/apache2.0/\r\n *\r\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\r\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\r\n * and limitations under the License.\r\n */\r\n\r\nimport { CacheConfig, CacheItem, CacheItemOptions } from '../types';\r\nimport { StorageHelper } from '@aws-amplify/core';\r\n/**\r\n * Default cache config\r\n */\r\nexport const defaultConfig: CacheConfig = {\r\n\tkeyPrefix: 'aws-amplify-cache',\r\n\tcapacityInBytes: 1048576, // 1MB\r\n\titemMaxSize: 210000, // about 200kb\r\n\tdefaultTTL: 259200000, // about 3 days\r\n\tdefaultPriority: 5,\r\n\twarningThreshold: 0.8,\r\n\t// the storage helper will check if localStorage exists,\r\n\t// if not, will use a in-memory object instead\r\n\tstorage: new StorageHelper().getStorage(),\r\n};\r\n\r\n/**\r\n * return the byte size of the string\r\n * @param str\r\n */\r\nexport function getByteLength(str: string): number {\r\n\tlet ret: number = 0;\r\n\tret = str.length;\r\n\r\n\tfor (let i = str.length; i >= 0; i -= 1) {\r\n\t\tconst charCode: number = str.charCodeAt(i);\r\n\t\tif (charCode > 0x7f && charCode <= 0x7ff) {\r\n\t\t\tret += 1;\r\n\t\t} else if (charCode > 0x7ff && charCode <= 0xffff) {\r\n\t\t\tret += 2;\r\n\t\t}\r\n\t\t// trail surrogate\r\n\t\tif (charCode >= 0xdc00 && charCode <= 0xdfff) {\r\n\t\t\ti -= 1;\r\n\t\t}\r\n\t}\r\n\r\n\treturn ret;\r\n}\r\n\r\n/**\r\n * get current time\r\n */\r\nexport function getCurrTime(): number {\r\n\tconst currTime = new Date();\r\n\treturn currTime.getTime();\r\n}\r\n\r\n/**\r\n * check if passed value is an integer\r\n */\r\nexport function isInteger(value): boolean {\r\n\tif (Number.isInteger) {\r\n\t\treturn Number.isInteger(value);\r\n\t}\r\n\r\n\treturn _isInteger(value);\r\n}\r\n\r\nfunction _isInteger(value): boolean {\r\n\treturn (\r\n\t\ttypeof value === 'number' && isFinite(value) && Math.floor(value) === value\r\n\t);\r\n}\r\n\r\n/**\r\n * provide an object as the in-memory cache\r\n */\r\nlet store = {};\r\nexport class CacheObject {\r\n\tstatic clear(): void {\r\n\t\tstore = {};\r\n\t}\r\n\r\n\tstatic getItem(key: string): string | null {\r\n\t\treturn store[key] || null;\r\n\t}\r\n\r\n\tstatic setItem(key: string, value: string): void {\r\n\t\tstore[key] = value;\r\n\t}\r\n\r\n\tstatic removeItem(key: string): void {\r\n\t\tdelete store[key];\r\n\t}\r\n}\r\n","/*\r\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\r\n * the License. A copy of the License is located at\r\n *\r\n * http://aws.amazon.com/apache2.0/\r\n *\r\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\r\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\r\n * and limitations under the License.\r\n */\r\n\r\nimport { getCurrTime, getByteLength, defaultConfig, isInteger } from './Utils';\r\n\r\nimport { CacheConfig, CacheItem, CacheItemOptions } from './types';\r\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\r\n\r\nconst logger = new Logger('StorageCache');\r\n\r\n/**\r\n * Initialization of the cache\r\n *\r\n */\r\nexport class StorageCache {\r\n\tprotected cacheCurSizeKey: string;\r\n\tprotected config: CacheConfig;\r\n\r\n\t/**\r\n\t * Initialize the cache\r\n\t * @param config - the configuration of the cache\r\n\t */\r\n\tconstructor(config: CacheConfig) {\r\n\t\tthis.config = Object.assign({}, config);\r\n\t\tthis.cacheCurSizeKey = this.config.keyPrefix + 'CurSize';\r\n\t\tthis.checkConfig();\r\n\t}\r\n\r\n\tpublic getModuleName() {\r\n\t\treturn 'Cache';\r\n\t}\r\n\r\n\tprivate checkConfig(): void {\r\n\t\t// check configuration\r\n\t\tif (!isInteger(this.config.capacityInBytes)) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: capacityInBytes. It should be an Integer. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.capacityInBytes = defaultConfig.capacityInBytes;\r\n\t\t}\r\n\r\n\t\tif (!isInteger(this.config.itemMaxSize)) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: itemMaxSize. It should be an Integer. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.itemMaxSize = defaultConfig.itemMaxSize;\r\n\t\t}\r\n\r\n\t\tif (!isInteger(this.config.defaultTTL)) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: defaultTTL. It should be an Integer. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.defaultTTL = defaultConfig.defaultTTL;\r\n\t\t}\r\n\r\n\t\tif (!isInteger(this.config.defaultPriority)) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: defaultPriority. It should be an Integer. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.defaultPriority = defaultConfig.defaultPriority;\r\n\t\t}\r\n\r\n\t\tif (this.config.itemMaxSize > this.config.capacityInBytes) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: itemMaxSize. It should be smaller than capacityInBytes. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.itemMaxSize = defaultConfig.itemMaxSize;\r\n\t\t}\r\n\r\n\t\tif (this.config.defaultPriority > 5 || this.config.defaultPriority < 1) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: defaultPriority. It should be between 1 and 5. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.defaultPriority = defaultConfig.defaultPriority;\r\n\t\t}\r\n\r\n\t\tif (\r\n\t\t\tNumber(this.config.warningThreshold) > 1 ||\r\n\t\t\tNumber(this.config.warningThreshold) < 0\r\n\t\t) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Invalid parameter: warningThreshold. It should be between 0 and 1. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.warningThreshold = defaultConfig.warningThreshold;\r\n\t\t}\r\n\t\t// set 5MB limit\r\n\t\tconst cacheLimit: number = 5 * 1024 * 1024;\r\n\t\tif (this.config.capacityInBytes > cacheLimit) {\r\n\t\t\tlogger.error(\r\n\t\t\t\t'Cache Capacity should be less than 5MB. Setting back to default. Setting back to default.'\r\n\t\t\t);\r\n\t\t\tthis.config.capacityInBytes = defaultConfig.capacityInBytes;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * produce a JSON object with meta-data and data value\r\n\t * @param value - the value of the item\r\n\t * @param options - optional, the specified meta-data\r\n\t *\r\n\t * @return - the item which has the meta-data and the value\r\n\t */\r\n\tprotected fillCacheItem(\r\n\t\tkey: string,\r\n\t\tvalue: object | number | string | boolean,\r\n\t\toptions: CacheItemOptions\r\n\t): CacheItem {\r\n\t\tconst ret: CacheItem = {\r\n\t\t\tkey,\r\n\t\t\tdata: value,\r\n\t\t\ttimestamp: getCurrTime(),\r\n\t\t\tvisitedTime: getCurrTime(),\r\n\t\t\tpriority: options.priority,\r\n\t\t\texpires: options.expires,\r\n\t\t\ttype: typeof value,\r\n\t\t\tbyteSize: 0,\r\n\t\t};\r\n\r\n\t\tret.byteSize = getByteLength(JSON.stringify(ret));\r\n\r\n\t\t// for accurate size\r\n\t\tret.byteSize = getByteLength(JSON.stringify(ret));\r\n\t\treturn ret;\r\n\t}\r\n\r\n\t/**\r\n\t * set cache with customized configuration\r\n\t * @param config - customized configuration\r\n\t *\r\n\t * @return - the current configuration\r\n\t */\r\n\tpublic configure(config?: CacheConfig): CacheConfig {\r\n\t\tif (!config) {\r\n\t\t\treturn this.config;\r\n\t\t}\r\n\t\tif (config.keyPrefix) {\r\n\t\t\tlogger.warn(`Don't try to configure keyPrefix!`);\r\n\t\t}\r\n\r\n\t\tthis.config = Object.assign({}, this.config, config, config.Cache);\r\n\t\tthis.checkConfig();\r\n\t\treturn this.config;\r\n\t}\r\n}\r\n\r\n/**\r\n * @deprecated use named import\r\n */\r\nexport default StorageCache;\r\n","/*\r\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\r\n * the License. A copy of the License is located at\r\n *\r\n * http://aws.amazon.com/apache2.0/\r\n *\r\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\r\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\r\n * and limitations under the License.\r\n */\r\n\r\nimport { defaultConfig, getCurrTime } from './Utils';\r\n\r\nimport { StorageCache } from './StorageCache';\r\nimport { ICache, CacheConfig, CacheItem, CacheItemOptions } from './types';\r\nimport { ConsoleLogger as Logger } from '@aws-amplify/core';\r\n\r\nconst logger = new Logger('Cache');\r\n\r\n/**\r\n * Customized storage based on the SessionStorage or LocalStorage with LRU implemented\r\n */\r\nexport class BrowserStorageCacheClass extends StorageCache implements ICache {\r\n\t/**\r\n\t * initialize the cache\r\n\t * @param config - the configuration of the cache\r\n\t */\r\n\tconstructor(config?: CacheConfig) {\r\n\t\tconst cacheConfig = config\r\n\t\t\t? Object.assign({}, defaultConfig, config)\r\n\t\t\t: defaultConfig;\r\n\t\tsuper(cacheConfig);\r\n\t\tthis.config.storage = cacheConfig.storage;\r\n\t\tthis.getItem = this.getItem.bind(this);\r\n\t\tthis.setItem = this.setItem.bind(this);\r\n\t\tthis.removeItem = this.removeItem.bind(this);\r\n\t}\r\n\r\n\t/**\r\n\t * decrease current size of the cache\r\n\t *\r\n\t * @private\r\n\t * @param amount - the amount of the cache size which needs to be decreased\r\n\t */\r\n\tprivate _decreaseCurSizeInBytes(amount: number): void {\r\n\t\tconst curSize: number = this.getCacheCurSize();\r\n\t\tthis.config.storage.setItem(\r\n\t\t\tthis.cacheCurSizeKey,\r\n\t\t\t(curSize - amount).toString()\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * increase current size of the cache\r\n\t *\r\n\t * @private\r\n\t * @param amount - the amount of the cache szie which need to be increased\r\n\t */\r\n\tprivate _increaseCurSizeInBytes(amount: number): void {\r\n\t\tconst curSize: number = this.getCacheCurSize();\r\n\t\tthis.config.storage.setItem(\r\n\t\t\tthis.cacheCurSizeKey,\r\n\t\t\t(curSize + amount).toString()\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * update the visited time if item has been visited\r\n\t *\r\n\t * @private\r\n\t * @param item - the item which need to be refreshed\r\n\t * @param prefixedKey - the key of the item\r\n\t *\r\n\t * @return the refreshed item\r\n\t */\r\n\tprivate _refreshItem(item: CacheItem, prefixedKey: string): CacheItem {\r\n\t\titem.visitedTime = getCurrTime();\r\n\t\tthis.config.storage.setItem(prefixedKey, JSON.stringify(item));\r\n\t\treturn item;\r\n\t}\r\n\r\n\t/**\r\n\t * check wether item is expired\r\n\t *\r\n\t * @private\r\n\t * @param key - the key of the item\r\n\t *\r\n\t * @return true if the item is expired.\r\n\t */\r\n\tprivate _isExpired(key: string): boolean {\r\n\t\tconst text: string | null = this.config.storage.getItem(key);\r\n\t\tconst item: CacheItem = JSON.parse(text);\r\n\t\tif (getCurrTime() >= item.expires) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * delete item from cache\r\n\t *\r\n\t * @private\r\n\t * @param prefixedKey - the key of the item\r\n\t * @param size - optional, the byte size of the item\r\n\t */\r\n\tprivate _removeItem(prefixedKey: string, size?: number): void {\r\n\t\tconst itemSize: number = size\r\n\t\t\t? size\r\n\t\t\t: JSON.parse(this.config.storage.getItem(prefixedKey)).byteSize;\r\n\t\tthis._decreaseCurSizeInBytes(itemSize);\r\n\t\t// remove the cache item\r\n\t\tthis.config.storage.removeItem(prefixedKey);\r\n\t}\r\n\r\n\t/**\r\n\t * put item into cache\r\n\t *\r\n\t * @private\r\n\t * @param prefixedKey - the key of the item\r\n\t * @param itemData - the value of the item\r\n\t * @param itemSizeInBytes - the byte size of the item\r\n\t */\r\n\tprivate _setItem(prefixedKey: string, item: CacheItem): void {\r\n\t\t// update the cache size\r\n\t\tthis._increaseCurSizeInBytes(item.byteSize);\r\n\r\n\t\ttry {\r\n\t\t\tthis.config.storage.setItem(prefixedKey, JSON.stringify(item));\r\n\t\t} catch (setItemErr) {\r\n\t\t\t// if failed, we need to rollback the cache size\r\n\t\t\tthis._decreaseCurSizeInBytes(item.byteSize);\r\n\t\t\tlogger.error(`Failed to set item ${setItemErr}`);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * total space needed when poping out items\r\n\t *\r\n\t * @private\r\n\t * @param itemSize\r\n\t *\r\n\t * @return total space needed\r\n\t */\r\n\tprivate _sizeToPop(itemSize: number): number {\r\n\t\tconst spaceItemNeed =\r\n\t\t\tthis.getCacheCurSize() + itemSize - this.config.capacityInBytes;\r\n\t\tconst cacheThresholdSpace =\r\n\t\t\t(1 - this.config.warningThreshold) * this.config.capacityInBytes;\r\n\t\treturn spaceItemNeed > cacheThresholdSpace\r\n\t\t\t? spaceItemNeed\r\n\t\t\t: cacheThresholdSpace;\r\n\t}\r\n\r\n\t/**\r\n\t * see whether cache is full\r\n\t *\r\n\t * @private\r\n\t * @param itemSize\r\n\t *\r\n\t * @return true if cache is full\r\n\t */\r\n\tprivate _isCacheFull(itemSize: number): boolean {\r\n\t\treturn itemSize + this.getCacheCurSize() > this.config.capacityInBytes;\r\n\t}\r\n\r\n\t/**\r\n\t * scan the storage and find out all the keys owned by this cache\r\n\t * also clean the expired keys while scanning\r\n\t *\r\n\t * @private\r\n\t *\r\n\t * @return array of keys\r\n\t */\r\n\tprivate _findValidKeys(): string[] {\r\n\t\tconst keys: string[] = [];\r\n\t\tconst keyInCache: string[] = [];\r\n\t\t// get all keys in Storage\r\n\t\tfor (let i = 0; i < this.config.storage.length; i += 1) {\r\n\t\t\tkeyInCache.push(this.config.storage.key(i));\r\n\t\t}\r\n\r\n\t\t// find those items which belong to our cache and also clean those expired items\r\n\t\tfor (let i = 0; i < keyInCache.length; i += 1) {\r\n\t\t\tconst key: string = keyInCache[i];\r\n\t\t\tif (\r\n\t\t\t\tkey.indexOf(this.config.keyPrefix) === 0 &&\r\n\t\t\t\tkey !== this.cacheCurSizeKey\r\n\t\t\t) {\r\n\t\t\t\tif (this._isExpired(key)) {\r\n\t\t\t\t\tthis._removeItem(key);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tkeys.push(key);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn keys;\r\n\t}\r\n\r\n\t/**\r\n\t * get all the items we have, sort them by their priority,\r\n\t * if priority is same, sort them by their last visited time\r\n\t * pop out items from the low priority (5 is the lowest)\r\n\t *\r\n\t * @private\r\n\t * @param keys - all the keys in this cache\r\n\t * @param sizeToPop - the total size of the items which needed to be poped out\r\n\t */\r\n\tprivate _popOutItems(keys: string[], sizeToPop: number): void {\r\n\t\tconst items: CacheItem[] = [];\r\n\t\tlet remainedSize: number = sizeToPop;\r\n\t\t// get the items from Storage\r\n\t\tfor (let i = 0; i < keys.length; i += 1) {\r\n\t\t\tconst val: string | null = this.config.storage.getItem(keys[i]);\r\n\t\t\tif (val != null) {\r\n\t\t\t\tconst item: CacheItem = JSON.parse(val);\r\n\t\t\t\titems.push(item);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// first compare priority\r\n\t\t// then compare visited time\r\n\t\titems.sort((a, b) => {\r\n\t\t\tif (a.priority > b.priority) {\r\n\t\t\t\treturn -1;\r\n\t\t\t} else if (a.priority < b.priority) {\r\n\t\t\t\treturn 1;\r\n\t\t\t} else {\r\n\t\t\t\tif (a.visitedTime < b.visitedTime) {\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t} else return 1;\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfor (let i = 0; i < items.length; i += 1) {\r\n\t\t\t// pop out items until we have enough room for new item\r\n\t\t\tthis._removeItem(items[i].key, items[i].byteSize);\r\n\t\t\tremainedSize -= items[i].byteSize;\r\n\t\t\tif (remainedSize <= 0) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Set item into cache. You can put number, string, boolean or object.\r\n\t * The cache will first check whether has the same key.\r\n\t * If it has, it will delete the old item and then put the new item in\r\n\t * The cache will pop out items if it is full\r\n\t * You can specify the cache item options. The cache will abort and output a warning:\r\n\t * If the key is invalid\r\n\t * If the size of the item exceeds itemMaxSize.\r\n\t * If the value is undefined\r\n\t * If incorrect cache item configuration\r\n\t * If error happened with browser storage\r\n\t *\r\n\t * @param key - the key of the item\r\n\t * @param value - the value of the item\r\n\t * @param {Object} [options] - optional, the specified meta-data\r\n\t */\r\n\tpublic setItem(\r\n\t\tkey: string,\r\n\t\tvalue: object | number | string | boolean,\r\n\t\toptions?: CacheItemOptions\r\n\t): void {\r\n\t\tlogger.log(\r\n\t\t\t`Set item: key is ${key}, value is ${value} with options: ${options}`\r\n\t\t);\r\n\t\tconst prefixedKey: string = this.config.keyPrefix + key;\r\n\t\t// invalid keys\r\n\t\tif (\r\n\t\t\tprefixedKey === this.config.keyPrefix ||\r\n\t\t\tprefixedKey === this.cacheCurSizeKey\r\n\t\t) {\r\n\t\t\tlogger.warn(`Invalid key: should not be empty or 'CurSize'`);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (typeof value === 'undefined') {\r\n\t\t\tlogger.warn(`The value of item should not be undefined!`);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst cacheItemOptions: CacheItemOptions = {\r\n\t\t\tpriority:\r\n\t\t\t\toptions && options.priority !== undefined\r\n\t\t\t\t\t? options.priority\r\n\t\t\t\t\t: this.config.defaultPriority,\r\n\t\t\texpires:\r\n\t\t\t\toptions && options.expires !== undefined\r\n\t\t\t\t\t? options.expires\r\n\t\t\t\t\t: this.config.defaultTTL + getCurrTime(),\r\n\t\t};\r\n\r\n\t\tif (cacheItemOptions.priority < 1 || cacheItemOptions.priority > 5) {\r\n\t\t\tlogger.warn(\r\n\t\t\t\t`Invalid parameter: priority due to out or range. It should be within 1 and 5.`\r\n\t\t\t);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst item: CacheItem = this.fillCacheItem(\r\n\t\t\tprefixedKey,\r\n\t\t\tvalue,\r\n\t\t\tcacheItemOptions\r\n\t\t);\r\n\r\n\t\t// check wether this item is too big;\r\n\t\tif (item.byteSize > this.config.itemMaxSize) {\r\n\t\t\tlogger.warn(\r\n\t\t\t\t`Item with key: ${key} you are trying to put into is too big!`\r\n\t\t\t);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\t// first look into the storage, if it exists, delete it.\r\n\t\t\tconst val: string | null = this.config.storage.getItem(prefixedKey);\r\n\t\t\tif (val) {\r\n\t\t\t\tthis._removeItem(prefixedKey, JSON.parse(val).byteSize);\r\n\t\t\t}\r\n\r\n\t\t\t// check whether the cache is full\r\n\t\t\tif (this._isCacheFull(item.byteSize)) {\r\n\t\t\t\tconst validKeys: string[] = this._findValidKeys();\r\n\t\t\t\t// check again and then pop out items\r\n\t\t\t\tif (this._isCacheFull(item.byteSize)) {\r\n\t\t\t\t\tconst sizeToPop: number = this._sizeToPop(item.byteSize);\r\n\t\t\t\t\tthis._popOutItems(validKeys, sizeToPop);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// put item in the cache\r\n\t\t\t// may failed due to storage full\r\n\t\t\tthis._setItem(prefixedKey, item);\r\n\t\t} catch (e) {\r\n\t\t\tlogger.warn(`setItem failed! ${e}`);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Get item from cache. It will return null if item doesn’t exist or it has been expired.\r\n\t * If you specified callback function in the options,\r\n\t * then the function will be executed if no such item in the cache\r\n\t * and finally put the return value into cache.\r\n\t * Please make sure the callback function will return the value you want to put into the cache.\r\n\t * The cache will abort output a warning:\r\n\t * If the key is invalid\r\n\t * If error happened with browser storage\r\n\t *\r\n\t * @param key - the key of the item\r\n\t * @param {Object} [options] - the options of callback function\r\n\t *\r\n\t * @return - return the value of the item\r\n\t */\r\n\tpublic getItem(key: string, options?: CacheItemOptions): any {\r\n\t\tlogger.log(`Get item: key is ${key} with options ${options}`);\r\n\t\tlet ret: string | null = null;\r\n\t\tconst prefixedKey: string = this.config.keyPrefix + key;\r\n\r\n\t\tif (\r\n\t\t\tprefixedKey === this.config.keyPrefix ||\r\n\t\t\tprefixedKey === this.cacheCurSizeKey\r\n\t\t) {\r\n\t\t\tlogger.warn(`Invalid key: should not be empty or 'CurSize'`);\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tret = this.config.storage.getItem(prefixedKey);\r\n\t\t\tif (ret != null) {\r\n\t\t\t\tif (this._isExpired(prefixedKey)) {\r\n\t\t\t\t\t// if expired, remove that item and return null\r\n\t\t\t\t\tthis._removeItem(prefixedKey, JSON.parse(ret).byteSize);\r\n\t\t\t\t\tret = null;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// if not expired, great, return the value and refresh it\r\n\t\t\t\t\tlet item: CacheItem = JSON.parse(ret);\r\n\t\t\t\t\titem = this._refreshItem(item, prefixedKey);\r\n\t\t\t\t\treturn item.data;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (options && options.callback !== undefined) {\r\n\t\t\t\tconst val: object | string | number | boolean = options.callback();\r\n\t\t\t\tif (val !== null) {\r\n\t\t\t\t\tthis.setItem(key, val, options);\r\n\t\t\t\t}\r\n\t\t\t\treturn val;\r\n\t\t\t}\r\n\t\t\treturn null;\r\n\t\t} catch (e) {\r\n\t\t\tlogger.warn(`getItem failed! ${e}`);\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * remove item from the cache\r\n\t * The cache will abort output a warning:\r\n\t * If error happened with browser storage\r\n\t * @param key - the key of the item\r\n\t */\r\n\tpublic removeItem(key: string): void {\r\n\t\tlogger.log(`Remove item: key is ${key}`);\r\n\t\tconst prefixedKey: string = this.config.keyPrefix + key;\r\n\r\n\t\tif (\r\n\t\t\tprefixedKey === this.config.keyPrefix ||\r\n\t\t\tprefixedKey === this.cacheCurSizeKey\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tconst val: string | null = this.config.storage.getItem(prefixedKey);\r\n\t\t\tif (val) {\r\n\t\t\t\tthis._removeItem(prefixedKey, JSON.parse(val).byteSize);\r\n\t\t\t}\r\n\t\t} catch (e) {\r\n\t\t\tlogger.warn(`removeItem failed! ${e}`);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * clear the entire cache\r\n\t * The cache will abort output a warning:\r\n\t * If error happened with browser storage\r\n\t */\r\n\tpublic clear(): void {\r\n\t\tlogger.log(`Clear Cache`);\r\n\t\tconst keysToRemove: string[] = [];\r\n\r\n\t\tfor (let i = 0; i < this.config.storage.length; i += 1) {\r\n\t\t\tconst key = this.config.storage.key(i);\r\n\t\t\tif (key.indexOf(this.config.keyPrefix) === 0) {\r\n\t\t\t\tkeysToRemove.push(key);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\tfor (let i = 0; i < keysToRemove.length; i += 1) {\r\n\t\t\t\tthis.config.storage.removeItem(keysToRemove[i]);\r\n\t\t\t}\r\n\t\t} catch (e) {\r\n\t\t\tlogger.warn(`clear failed! ${e}`);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Return all the keys in the cache.\r\n\t *\r\n\t * @return - all keys in the cache\r\n\t */\r\n\tpublic getAllKeys(): string[] {\r\n\t\tconst keys: string[] = [];\r\n\t\tfor (let i = 0; i < this.config.storage.length; i += 1) {\r\n\t\t\tconst key = this.config.storage.key(i);\r\n\t\t\tif (\r\n\t\t\t\tkey.indexOf(this.config.keyPrefix) === 0 &&\r\n\t\t\t\tkey !== this.cacheCurSizeKey\r\n\t\t\t) {\r\n\t\t\t\tkeys.push(key.substring(this.config.keyPrefix.length));\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn keys;\r\n\t}\r\n\r\n\t/**\r\n\t * return the current size of the cache\r\n\t *\r\n\t * @return - current size of the cache\r\n\t */\r\n\tpublic getCacheCurSize(): number {\r\n\t\tlet ret: string | null = this.config.storage.getItem(this.cacheCurSizeKey);\r\n\t\tif (!ret) {\r\n\t\t\tthis.config.storage.setItem(this.cacheCurSizeKey, '0');\r\n\t\t\tret = '0';\r\n\t\t}\r\n\t\treturn Number(ret);\r\n\t}\r\n\r\n\t/**\r\n\t * Return a new instance of cache with customized configuration.\r\n\t * @param config - the customized configuration\r\n\t *\r\n\t * @return - new instance of Cache\r\n\t */\r\n\tpublic createInstance(config: CacheConfig): ICache {\r\n\t\tif (!config.keyPrefix || config.keyPrefix === defaultConfig.keyPrefix) {\r\n\t\t\tlogger.error('invalid keyPrefix, setting keyPrefix with timeStamp');\r\n\t\t\tconfig.keyPrefix = getCurrTime.toString();\r\n\t\t}\r\n\r\n\t\treturn new BrowserStorageCacheClass(config);\r\n\t}\r\n}\r\n\r\nexport const BrowserStorageCache: ICache = new BrowserStorageCacheClass();\r\n\r\n/**\r\n * @deprecated use named import\r\n */\r\nexport default BrowserStorageCache;\r\n","/*\r\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\r\n * the License. A copy of the License is located at\r\n *\r\n * http://aws.amazon.com/apache2.0/\r\n *\r\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\r\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\r\n * and limitations under the License.\r\n */\r\n\r\nimport { Amplify } from '@aws-amplify/core';\r\nimport { BrowserStorageCache } from './BrowserStorageCache';\r\nimport { InMemoryCache } from './InMemoryCache';\r\nimport { CacheConfig } from './types';\r\n\r\nexport { BrowserStorageCache, InMemoryCache, CacheConfig };\r\nexport { BrowserStorageCache as Cache };\r\n\r\n/**\r\n * @deprecated use named import\r\n */\r\nexport default BrowserStorageCache;\r\n\r\nAmplify.register(BrowserStorageCache);\r\n","import { ConsoleLogger as LoggerClass } from './Logger';\n\nconst logger = new LoggerClass('Amplify');\n\nexport class AmplifyClass {\n\t// Everything that is `register`ed is tracked here\n\tprivate _components = [];\n\tprivate _config = {};\n\n\t// All modules (with `getModuleName()`) are stored here for dependency injection\n\tprivate _modules = {};\n\n\t// for backward compatibility to avoid breaking change\n\t// if someone is using like Amplify.Auth\n\tAuth = null;\n\tAnalytics = null;\n\tAPI = null;\n\tCredentials = null;\n\tStorage = null;\n\tI18n = null;\n\tCache = null;\n\tPubSub = null;\n\tInteractions = null;\n\tPushnotification = null;\n\tUI = null;\n\tXR = null;\n\tPredictions = null;\n\tDataStore = null;\n\tGeo = null;\n\n\tLogger = LoggerClass;\n\tServiceWorker = null;\n\n\tregister(comp) {\n\t\tlogger.debug('component registered in amplify', comp);\n\t\tthis._components.push(comp);\n\t\tif (typeof comp.getModuleName === 'function') {\n\t\t\tthis._modules[comp.getModuleName()] = comp;\n\t\t\tthis[comp.getModuleName()] = comp;\n\t\t} else {\n\t\t\tlogger.debug('no getModuleName method for component', comp);\n\t\t}\n\n\t\t// Finally configure this new component(category) loaded\n\t\t// With the new modularization changes in Amplify V3, all the Amplify\n\t\t// component are not loaded/registered right away but when they are\n\t\t// imported (and hence instantiated) in the client's app. This ensures\n\t\t// that all new components imported get correctly configured with the\n\t\t// configuration that Amplify.configure() was called with.\n\t\tcomp.configure(this._config);\n\t}\n\n\tconfigure(config?) {\n\t\tif (!config) return this._config;\n\n\t\tthis._config = Object.assign(this._config, config);\n\t\tlogger.debug('amplify config', this._config);\n\n\t\t// Dependency Injection via property-setting.\n\t\t// This avoids introducing a public method/interface/setter that's difficult to remove later.\n\t\t// Plus, it reduces `if` statements within the `constructor` and `configure` of each module\n\t\tObject.entries(this._modules).forEach(([Name, comp]) => {\n\t\t\t// e.g. Auth.*\n\t\t\tObject.keys(comp).forEach(property => {\n\t\t\t\t// e.g. Auth[\"Credentials\"] = this._modules[\"Credentials\"] when set\n\t\t\t\tif (this._modules[property]) {\n\t\t\t\t\tcomp[property] = this._modules[property];\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis._components.map(comp => {\n\t\t\tcomp.configure(this._config);\n\t\t});\n\n\t\treturn this._config;\n\t}\n\n\taddPluggable(pluggable) {\n\t\tif (\n\t\t\tpluggable &&\n\t\t\tpluggable['getCategory'] &&\n\t\t\ttypeof pluggable['getCategory'] === 'function'\n\t\t) {\n\t\t\tthis._components.map(comp => {\n\t\t\t\tif (\n\t\t\t\t\tcomp['addPluggable'] &&\n\t\t\t\t\ttypeof comp['addPluggable'] === 'function'\n\t\t\t\t) {\n\t\t\t\t\tcomp.addPluggable(pluggable);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n}\n\nexport const Amplify = new AmplifyClass();\n\n/**\n * @deprecated use named import\n */\nexport default Amplify;\n","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { browserOrNode } from '../JS';\nimport { NonRetryableError } from '../Util';\n\nconst logger = new Logger('CognitoCredentials');\n\nconst waitForInit = new Promise((res, rej) => {\n\tif (!browserOrNode().isBrowser) {\n\t\tlogger.debug('not in the browser, directly resolved');\n\t\treturn res();\n\t}\n\tconst ga =\n\t\twindow['gapi'] && window['gapi'].auth2 ? window['gapi'].auth2 : null;\n\tif (ga) {\n\t\tlogger.debug('google api already loaded');\n\t\treturn res();\n\t} else {\n\t\tsetTimeout(() => {\n\t\t\treturn res();\n\t\t}, 2000);\n\t}\n});\n\nexport class GoogleOAuth {\n\tpublic initialized = false;\n\n\tconstructor() {\n\t\tthis.refreshGoogleToken = this.refreshGoogleToken.bind(this);\n\t\tthis._refreshGoogleTokenImpl = this._refreshGoogleTokenImpl.bind(this);\n\t}\n\n\tpublic async refreshGoogleToken() {\n\t\tif (!this.initialized) {\n\t\t\tlogger.debug('need to wait for the Google SDK loaded');\n\t\t\tawait waitForInit;\n\t\t\tthis.initialized = true;\n\t\t\tlogger.debug('finish waiting');\n\t\t}\n\n\t\treturn this._refreshGoogleTokenImpl();\n\t}\n\n\tprivate _refreshGoogleTokenImpl() {\n\t\tlet ga = null;\n\t\tif (browserOrNode().isBrowser)\n\t\t\tga = window['gapi'] && window['gapi'].auth2 ? window['gapi'].auth2 : null;\n\t\tif (!ga) {\n\t\t\tlogger.debug('no gapi auth2 available');\n\t\t\treturn Promise.reject('no gapi auth2 available');\n\t\t}\n\n\t\treturn new Promise((res, rej) => {\n\t\t\tga.getAuthInstance()\n\t\t\t\t.then(googleAuth => {\n\t\t\t\t\tif (!googleAuth) {\n\t\t\t\t\t\tlogger.debug('google Auth undefined');\n\t\t\t\t\t\trej(new NonRetryableError('google Auth undefined'));\n\t\t\t\t\t}\n\n\t\t\t\t\tconst googleUser = googleAuth.currentUser.get();\n\t\t\t\t\t// refresh the token\n\t\t\t\t\tif (googleUser.isSignedIn()) {\n\t\t\t\t\t\tlogger.debug('refreshing the google access token');\n\t\t\t\t\t\tgoogleUser\n\t\t\t\t\t\t\t.reloadAuthResponse()\n\t\t\t\t\t\t\t.then(authResponse => {\n\t\t\t\t\t\t\t\tconst { id_token, expires_at } = authResponse;\n\t\t\t\t\t\t\t\tres({ token: id_token, expires_at });\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.catch(err => {\n\t\t\t\t\t\t\t\tif (err && err.error === 'network_error') {\n\t\t\t\t\t\t\t\t\t// Not using NonRetryableError so handler will be retried\n\t\t\t\t\t\t\t\t\trej('Network error reloading google auth response');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\trej(\n\t\t\t\t\t\t\t\t\t\tnew NonRetryableError(\n\t\t\t\t\t\t\t\t\t\t\t'Failed to reload google auth response'\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\trej(new NonRetryableError('User is not signed in with Google'));\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch(err => {\n\t\t\t\t\tlogger.debug('Failed to refresh google token', err);\n\t\t\t\t\trej(new NonRetryableError('Failed to refresh google token'));\n\t\t\t\t});\n\t\t});\n\t}\n}\n\n/**\n * @deprecated use named import\n */\nexport default GoogleOAuth;\n","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { browserOrNode } from '../JS';\nimport { NonRetryableError } from '../Util';\n\nconst logger = new Logger('CognitoCredentials');\n\nconst waitForInit = new Promise((res, rej) => {\n\tif (!browserOrNode().isBrowser) {\n\t\tlogger.debug('not in the browser, directly resolved');\n\t\treturn res();\n\t}\n\tconst fb = window['FB'];\n\tif (fb) {\n\t\tlogger.debug('FB SDK already loaded');\n\t\treturn res();\n\t} else {\n\t\tsetTimeout(() => {\n\t\t\treturn res();\n\t\t}, 2000);\n\t}\n});\n\nexport class FacebookOAuth {\n\tpublic initialized = false;\n\n\tconstructor() {\n\t\tthis.refreshFacebookToken = this.refreshFacebookToken.bind(this);\n\t\tthis._refreshFacebookTokenImpl = this._refreshFacebookTokenImpl.bind(this);\n\t}\n\n\tpublic async refreshFacebookToken() {\n\t\tif (!this.initialized) {\n\t\t\tlogger.debug('need to wait for the Facebook SDK loaded');\n\t\t\tawait waitForInit;\n\t\t\tthis.initialized = true;\n\t\t\tlogger.debug('finish waiting');\n\t\t}\n\n\t\treturn this._refreshFacebookTokenImpl();\n\t}\n\n\tprivate _refreshFacebookTokenImpl() {\n\t\tlet fb = null;\n\t\tif (browserOrNode().isBrowser) fb = window['FB'];\n\t\tif (!fb) {\n\t\t\tconst errorMessage = 'no fb sdk available';\n\t\t\tlogger.debug(errorMessage);\n\t\t\treturn Promise.reject(new NonRetryableError(errorMessage));\n\t\t}\n\n\t\treturn new Promise((res, rej) => {\n\t\t\tfb.getLoginStatus(\n\t\t\t\tfbResponse => {\n\t\t\t\t\tif (!fbResponse || !fbResponse.authResponse) {\n\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t'no response from facebook when refreshing the jwt token';\n\t\t\t\t\t\tlogger.debug(errorMessage);\n\t\t\t\t\t\t// There is no definitive indication for a network error in\n\t\t\t\t\t\t// fbResponse, so we are treating it as an invalid token.\n\t\t\t\t\t\trej(new NonRetryableError(errorMessage));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst response = fbResponse.authResponse;\n\t\t\t\t\t\tconst { accessToken, expiresIn } = response;\n\t\t\t\t\t\tconst date = new Date();\n\t\t\t\t\t\tconst expires_at = expiresIn * 1000 + date.getTime();\n\t\t\t\t\t\tif (!accessToken) {\n\t\t\t\t\t\t\tconst errorMessage = 'the jwtToken is undefined';\n\t\t\t\t\t\t\tlogger.debug(errorMessage);\n\t\t\t\t\t\t\trej(new NonRetryableError(errorMessage));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tres({\n\t\t\t\t\t\t\ttoken: accessToken,\n\t\t\t\t\t\t\texpires_at,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ scope: 'public_profile,email' }\n\t\t\t);\n\t\t});\n\t}\n}\n\n/**\n * @deprecated use named import\n */\nexport default FacebookOAuth;\n","/*\n * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n * the License. A copy of the License is located at\n *\n * http://aws.amazon.com/apache2.0/\n *\n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\nimport { GoogleOAuth as GoogleOAuthClass } from './GoogleOAuth';\nimport { FacebookOAuth as FacebookOAuthClass } from './FacebookOAuth';\n\nexport const GoogleOAuth = new GoogleOAuthClass();\nexport const FacebookOAuth = new FacebookOAuthClass();\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { SmithyException as __SmithyException } from \"@aws-sdk/smithy-client\";\nimport { MetadataBearer as $MetadataBearer } from \"@aws-sdk/types\";\n\nexport enum AmbiguousRoleResolutionType {\n AUTHENTICATED_ROLE = \"AuthenticatedRole\",\n DENY = \"Deny\",\n}\n\n/**\n * A provider representing an Amazon Cognito user pool and its client ID.
\n */\nexport interface CognitoIdentityProvider {\n /**\n * The provider name for an Amazon Cognito user pool. For example,\n * cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789
.
\n */\n ProviderName?: string;\n\n /**\n * The client ID for the Amazon Cognito user pool.
\n */\n ClientId?: string;\n\n /**\n * TRUE if server-side token validation is enabled for the identity provider’s\n * token.
\n * Once you set ServerSideTokenCheck
to TRUE for an identity pool, that\n * identity pool will check with the integrated user pools to make sure that the user has not\n * been globally signed out or deleted before the identity pool provides an OIDC token or AWS\n * credentials for the user.
\n * If the user is signed out or deleted, the identity pool will return a 400 Not\n * Authorized error.
\n */\n ServerSideTokenCheck?: boolean;\n}\n\nexport namespace CognitoIdentityProvider {\n export const filterSensitiveLog = (obj: CognitoIdentityProvider): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the CreateIdentityPool action.
\n */\nexport interface CreateIdentityPoolInput {\n /**\n * A string that you provide.
\n */\n IdentityPoolName: string | undefined;\n\n /**\n * TRUE if the identity pool supports unauthenticated logins.
\n */\n AllowUnauthenticatedIdentities: boolean | undefined;\n\n /**\n * Enables or disables the Basic (Classic) authentication flow. For more information, see\n * Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.
\n */\n AllowClassicFlow?: boolean;\n\n /**\n * Optional key:value pairs mapping provider names to provider app IDs.
\n */\n SupportedLoginProviders?: { [key: string]: string };\n\n /**\n * The \"domain\" by which Cognito will refer to your users. This name acts as a\n * placeholder that allows your backend and the Cognito service to communicate about the\n * developer provider. For the DeveloperProviderName
, you can use letters as well\n * as period (.
), underscore (_
), and dash\n * (-
).
\n * Once you have set a developer provider name, you cannot change it. Please take care\n * in setting this parameter.
\n */\n DeveloperProviderName?: string;\n\n /**\n * A list of OpendID Connect provider ARNs.
\n */\n OpenIdConnectProviderARNs?: string[];\n\n /**\n * An array of Amazon Cognito user pools and their client IDs.
\n */\n CognitoIdentityProviders?: CognitoIdentityProvider[];\n\n /**\n * An array of Amazon Resource Names (ARNs) of the SAML provider for your identity\n * pool.
\n */\n SamlProviderARNs?: string[];\n\n /**\n * Tags to assign to the identity pool. A tag is a label that you can apply to identity\n * pools to categorize and manage them in different ways, such as by purpose, owner,\n * environment, or other criteria.
\n */\n IdentityPoolTags?: { [key: string]: string };\n}\n\nexport namespace CreateIdentityPoolInput {\n export const filterSensitiveLog = (obj: CreateIdentityPoolInput): any => ({\n ...obj,\n });\n}\n\n/**\n * An object representing an Amazon Cognito identity pool.
\n */\nexport interface IdentityPool {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * A string that you provide.
\n */\n IdentityPoolName: string | undefined;\n\n /**\n * TRUE if the identity pool supports unauthenticated logins.
\n */\n AllowUnauthenticatedIdentities: boolean | undefined;\n\n /**\n * Enables or disables the Basic (Classic) authentication flow. For more information, see\n * Identity Pools (Federated Identities) Authentication Flow in the Amazon Cognito Developer Guide.
\n */\n AllowClassicFlow?: boolean;\n\n /**\n * Optional key:value pairs mapping provider names to provider app IDs.
\n */\n SupportedLoginProviders?: { [key: string]: string };\n\n /**\n * The \"domain\" by which Cognito will refer to your users.
\n */\n DeveloperProviderName?: string;\n\n /**\n * A list of OpendID Connect provider ARNs.
\n */\n OpenIdConnectProviderARNs?: string[];\n\n /**\n * A list representing an Amazon Cognito user pool and its client ID.
\n */\n CognitoIdentityProviders?: CognitoIdentityProvider[];\n\n /**\n * An array of Amazon Resource Names (ARNs) of the SAML provider for your identity\n * pool.
\n */\n SamlProviderARNs?: string[];\n\n /**\n * The tags that are assigned to the identity pool. A tag is a label that you can apply to\n * identity pools to categorize and manage them in different ways, such as by purpose, owner,\n * environment, or other criteria.
\n */\n IdentityPoolTags?: { [key: string]: string };\n}\n\nexport namespace IdentityPool {\n export const filterSensitiveLog = (obj: IdentityPool): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown when the service encounters an error during processing the request.
\n */\nexport interface InternalErrorException extends __SmithyException, $MetadataBearer {\n name: \"InternalErrorException\";\n $fault: \"server\";\n /**\n * The message returned by an InternalErrorException.
\n */\n message?: string;\n}\n\nexport namespace InternalErrorException {\n export const filterSensitiveLog = (obj: InternalErrorException): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown for missing or bad input parameter(s).
\n */\nexport interface InvalidParameterException extends __SmithyException, $MetadataBearer {\n name: \"InvalidParameterException\";\n $fault: \"client\";\n /**\n * The message returned by an InvalidParameterException.
\n */\n message?: string;\n}\n\nexport namespace InvalidParameterException {\n export const filterSensitiveLog = (obj: InvalidParameterException): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown when the total number of user pools has exceeded a preset limit.
\n */\nexport interface LimitExceededException extends __SmithyException, $MetadataBearer {\n name: \"LimitExceededException\";\n $fault: \"client\";\n /**\n * The message returned by a LimitExceededException.
\n */\n message?: string;\n}\n\nexport namespace LimitExceededException {\n export const filterSensitiveLog = (obj: LimitExceededException): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown when a user is not authorized to access the requested resource.
\n */\nexport interface NotAuthorizedException extends __SmithyException, $MetadataBearer {\n name: \"NotAuthorizedException\";\n $fault: \"client\";\n /**\n * The message returned by a NotAuthorizedException
\n */\n message?: string;\n}\n\nexport namespace NotAuthorizedException {\n export const filterSensitiveLog = (obj: NotAuthorizedException): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown when a user tries to use a login which is already linked to another\n * account.
\n */\nexport interface ResourceConflictException extends __SmithyException, $MetadataBearer {\n name: \"ResourceConflictException\";\n $fault: \"client\";\n /**\n * The message returned by a ResourceConflictException.
\n */\n message?: string;\n}\n\nexport namespace ResourceConflictException {\n export const filterSensitiveLog = (obj: ResourceConflictException): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown when a request is throttled.
\n */\nexport interface TooManyRequestsException extends __SmithyException, $MetadataBearer {\n name: \"TooManyRequestsException\";\n $fault: \"client\";\n /**\n * Message returned by a TooManyRequestsException
\n */\n message?: string;\n}\n\nexport namespace TooManyRequestsException {\n export const filterSensitiveLog = (obj: TooManyRequestsException): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the DeleteIdentities
action.
\n */\nexport interface DeleteIdentitiesInput {\n /**\n * A list of 1-60 identities that you want to delete.
\n */\n IdentityIdsToDelete: string[] | undefined;\n}\n\nexport namespace DeleteIdentitiesInput {\n export const filterSensitiveLog = (obj: DeleteIdentitiesInput): any => ({\n ...obj,\n });\n}\n\nexport enum ErrorCode {\n ACCESS_DENIED = \"AccessDenied\",\n INTERNAL_SERVER_ERROR = \"InternalServerError\",\n}\n\n/**\n * An array of UnprocessedIdentityId objects, each of which contains an ErrorCode and\n * IdentityId.
\n */\nexport interface UnprocessedIdentityId {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * The error code indicating the type of error that occurred.
\n */\n ErrorCode?: ErrorCode | string;\n}\n\nexport namespace UnprocessedIdentityId {\n export const filterSensitiveLog = (obj: UnprocessedIdentityId): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful DeleteIdentities
\n * operation.
\n */\nexport interface DeleteIdentitiesResponse {\n /**\n * An array of UnprocessedIdentityId objects, each of which contains an ErrorCode and\n * IdentityId.
\n */\n UnprocessedIdentityIds?: UnprocessedIdentityId[];\n}\n\nexport namespace DeleteIdentitiesResponse {\n export const filterSensitiveLog = (obj: DeleteIdentitiesResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the DeleteIdentityPool action.
\n */\nexport interface DeleteIdentityPoolInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n}\n\nexport namespace DeleteIdentityPoolInput {\n export const filterSensitiveLog = (obj: DeleteIdentityPoolInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown when the requested resource (for example, a dataset or record) does not\n * exist.
\n */\nexport interface ResourceNotFoundException extends __SmithyException, $MetadataBearer {\n name: \"ResourceNotFoundException\";\n $fault: \"client\";\n /**\n * The message returned by a ResourceNotFoundException.
\n */\n message?: string;\n}\n\nexport namespace ResourceNotFoundException {\n export const filterSensitiveLog = (obj: ResourceNotFoundException): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the DescribeIdentity
action.
\n */\nexport interface DescribeIdentityInput {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId: string | undefined;\n}\n\nexport namespace DescribeIdentityInput {\n export const filterSensitiveLog = (obj: DescribeIdentityInput): any => ({\n ...obj,\n });\n}\n\n/**\n * A description of the identity.
\n */\nexport interface IdentityDescription {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * The provider names.
\n */\n Logins?: string[];\n\n /**\n * Date on which the identity was created.
\n */\n CreationDate?: Date;\n\n /**\n * Date on which the identity was last modified.
\n */\n LastModifiedDate?: Date;\n}\n\nexport namespace IdentityDescription {\n export const filterSensitiveLog = (obj: IdentityDescription): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the DescribeIdentityPool action.
\n */\nexport interface DescribeIdentityPoolInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n}\n\nexport namespace DescribeIdentityPoolInput {\n export const filterSensitiveLog = (obj: DescribeIdentityPoolInput): any => ({\n ...obj,\n });\n}\n\n/**\n * An exception thrown when a dependent service such as Facebook or Twitter is not\n * responding
\n */\nexport interface ExternalServiceException extends __SmithyException, $MetadataBearer {\n name: \"ExternalServiceException\";\n $fault: \"client\";\n /**\n * The message returned by an ExternalServiceException
\n */\n message?: string;\n}\n\nexport namespace ExternalServiceException {\n export const filterSensitiveLog = (obj: ExternalServiceException): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the GetCredentialsForIdentity
action.
\n */\nexport interface GetCredentialsForIdentityInput {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId: string | undefined;\n\n /**\n * A set of optional name-value pairs that map provider names to provider tokens. The\n * name-value pair will follow the syntax \"provider_name\":\n * \"provider_user_identifier\".
\n * Logins should not be specified when trying to get credentials for an unauthenticated\n * identity.
\n * The Logins parameter is required when using identities associated with external\n * identity providers such as FaceBook. For examples of Logins
maps, see the code\n * examples in the External Identity Providers section of the Amazon Cognito Developer\n * Guide.
\n */\n Logins?: { [key: string]: string };\n\n /**\n * The Amazon Resource Name (ARN) of the role to be assumed when multiple roles were\n * received in the token from the identity provider. For example, a SAML-based identity\n * provider. This parameter is optional for identity providers that do not support role\n * customization.
\n */\n CustomRoleArn?: string;\n}\n\nexport namespace GetCredentialsForIdentityInput {\n export const filterSensitiveLog = (obj: GetCredentialsForIdentityInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Credentials for the provided identity ID.
\n */\nexport interface Credentials {\n /**\n * The Access Key portion of the credentials.
\n */\n AccessKeyId?: string;\n\n /**\n * The Secret Access Key portion of the credentials
\n */\n SecretKey?: string;\n\n /**\n * The Session Token portion of the credentials
\n */\n SessionToken?: string;\n\n /**\n * The date at which these credentials will expire.
\n */\n Expiration?: Date;\n}\n\nexport namespace Credentials {\n export const filterSensitiveLog = (obj: Credentials): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful GetCredentialsForIdentity
\n * operation.
\n */\nexport interface GetCredentialsForIdentityResponse {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * Credentials for the provided identity ID.
\n */\n Credentials?: Credentials;\n}\n\nexport namespace GetCredentialsForIdentityResponse {\n export const filterSensitiveLog = (obj: GetCredentialsForIdentityResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown if the identity pool has no role associated for the given auth type\n * (auth/unauth) or if the AssumeRole fails.
\n */\nexport interface InvalidIdentityPoolConfigurationException extends __SmithyException, $MetadataBearer {\n name: \"InvalidIdentityPoolConfigurationException\";\n $fault: \"client\";\n /**\n * The message returned for an InvalidIdentityPoolConfigurationException
\n *
\n */\n message?: string;\n}\n\nexport namespace InvalidIdentityPoolConfigurationException {\n export const filterSensitiveLog = (obj: InvalidIdentityPoolConfigurationException): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the GetId action.
\n */\nexport interface GetIdInput {\n /**\n * A standard AWS account ID (9+ digits).
\n */\n AccountId?: string;\n\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * A set of optional name-value pairs that map provider names to provider tokens. The\n * available provider names for Logins
are as follows:
\n * \n * - \n *
Facebook: graph.facebook.com
\n *
\n * \n * - \n *
Amazon Cognito user pool:\n * cognito-idp..amazonaws.com/
,\n * for example, cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789
.\n *
\n * \n * - \n *
Google: accounts.google.com
\n *
\n * \n * - \n *
Amazon: www.amazon.com
\n *
\n * \n * - \n *
Twitter: api.twitter.com
\n *
\n * \n * - \n *
Digits: www.digits.com
\n *
\n * \n *
\n */\n Logins?: { [key: string]: string };\n}\n\nexport namespace GetIdInput {\n export const filterSensitiveLog = (obj: GetIdInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a GetId request.
\n */\nexport interface GetIdResponse {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n}\n\nexport namespace GetIdResponse {\n export const filterSensitiveLog = (obj: GetIdResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the GetIdentityPoolRoles
action.
\n */\nexport interface GetIdentityPoolRolesInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n}\n\nexport namespace GetIdentityPoolRolesInput {\n export const filterSensitiveLog = (obj: GetIdentityPoolRolesInput): any => ({\n ...obj,\n });\n}\n\nexport enum MappingRuleMatchType {\n CONTAINS = \"Contains\",\n EQUALS = \"Equals\",\n NOT_EQUAL = \"NotEqual\",\n STARTS_WITH = \"StartsWith\",\n}\n\n/**\n * A rule that maps a claim name, a claim value, and a match type to a role\n * ARN.
\n */\nexport interface MappingRule {\n /**\n * The claim name that must be present in the token, for example, \"isAdmin\" or\n * \"paid\".
\n */\n Claim: string | undefined;\n\n /**\n * The match condition that specifies how closely the claim value in the IdP token must\n * match Value
.
\n */\n MatchType: MappingRuleMatchType | string | undefined;\n\n /**\n * A brief string that the claim must match, for example, \"paid\" or \"yes\".
\n */\n Value: string | undefined;\n\n /**\n * The role ARN.
\n */\n RoleARN: string | undefined;\n}\n\nexport namespace MappingRule {\n export const filterSensitiveLog = (obj: MappingRule): any => ({\n ...obj,\n });\n}\n\n/**\n * A container for rules.
\n */\nexport interface RulesConfigurationType {\n /**\n * An array of rules. You can specify up to 25 rules per identity provider.
\n * Rules are evaluated in order. The first one to match specifies the role.
\n */\n Rules: MappingRule[] | undefined;\n}\n\nexport namespace RulesConfigurationType {\n export const filterSensitiveLog = (obj: RulesConfigurationType): any => ({\n ...obj,\n });\n}\n\nexport enum RoleMappingType {\n RULES = \"Rules\",\n TOKEN = \"Token\",\n}\n\n/**\n * A role mapping.
\n */\nexport interface RoleMapping {\n /**\n * The role mapping type. Token will use cognito:roles
and\n * cognito:preferred_role
claims from the Cognito identity provider token to\n * map groups to roles. Rules will attempt to match claims from the token to map to a\n * role.
\n */\n Type: RoleMappingType | string | undefined;\n\n /**\n * If you specify Token or Rules as the Type
,\n * AmbiguousRoleResolution
is required.
\n * Specifies the action to be taken if either no rules match the claim value for the\n * Rules
type, or there is no cognito:preferred_role
claim and\n * there are multiple cognito:roles
matches for the Token
\n * type.
\n */\n AmbiguousRoleResolution?: AmbiguousRoleResolutionType | string;\n\n /**\n * The rules to be used for mapping users to roles.
\n * If you specify Rules as the role mapping type, RulesConfiguration
is\n * required.
\n */\n RulesConfiguration?: RulesConfigurationType;\n}\n\nexport namespace RoleMapping {\n export const filterSensitiveLog = (obj: RoleMapping): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful GetIdentityPoolRoles
\n * operation.
\n */\nexport interface GetIdentityPoolRolesResponse {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId?: string;\n\n /**\n * The map of roles associated with this pool. Currently only authenticated and\n * unauthenticated roles are supported.
\n */\n Roles?: { [key: string]: string };\n\n /**\n * How users for a specific identity provider are to mapped to roles. This is a\n * String-to-RoleMapping object map. The string identifies the identity\n * provider, for example, \"graph.facebook.com\" or\n * \"cognito-idp.us-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id\".
\n */\n RoleMappings?: { [key: string]: RoleMapping };\n}\n\nexport namespace GetIdentityPoolRolesResponse {\n export const filterSensitiveLog = (obj: GetIdentityPoolRolesResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the GetOpenIdToken action.
\n */\nexport interface GetOpenIdTokenInput {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId: string | undefined;\n\n /**\n * A set of optional name-value pairs that map provider names to provider tokens. When\n * using graph.facebook.com and www.amazon.com, supply the access_token returned from the\n * provider's authflow. For accounts.google.com, an Amazon Cognito user pool provider, or any\n * other OpenId Connect provider, always include the id_token
.
\n */\n Logins?: { [key: string]: string };\n}\n\nexport namespace GetOpenIdTokenInput {\n export const filterSensitiveLog = (obj: GetOpenIdTokenInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful GetOpenIdToken request.
\n */\nexport interface GetOpenIdTokenResponse {\n /**\n * A unique identifier in the format REGION:GUID. Note that the IdentityId returned may\n * not match the one passed on input.
\n */\n IdentityId?: string;\n\n /**\n * An OpenID token, valid for 10 minutes.
\n */\n Token?: string;\n}\n\nexport namespace GetOpenIdTokenResponse {\n export const filterSensitiveLog = (obj: GetOpenIdTokenResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * The provided developer user identifier is already registered with Cognito under a\n * different identity ID.
\n */\nexport interface DeveloperUserAlreadyRegisteredException extends __SmithyException, $MetadataBearer {\n name: \"DeveloperUserAlreadyRegisteredException\";\n $fault: \"client\";\n /**\n * This developer user identifier is already registered with Cognito.
\n */\n message?: string;\n}\n\nexport namespace DeveloperUserAlreadyRegisteredException {\n export const filterSensitiveLog = (obj: DeveloperUserAlreadyRegisteredException): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the GetOpenIdTokenForDeveloperIdentity
action.
\n */\nexport interface GetOpenIdTokenForDeveloperIdentityInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * A set of optional name-value pairs that map provider names to provider tokens. Each\n * name-value pair represents a user from a public provider or developer provider. If the user\n * is from a developer provider, the name-value pair will follow the syntax\n * \"developer_provider_name\": \"developer_user_identifier\"
. The developer\n * provider is the \"domain\" by which Cognito will refer to your users; you provided this\n * domain while creating/updating the identity pool. The developer user identifier is an\n * identifier from your backend that uniquely identifies a user. When you create an identity\n * pool, you can specify the supported logins.
\n */\n Logins: { [key: string]: string } | undefined;\n\n /**\n * The expiration time of the token, in seconds. You can specify a custom expiration\n * time for the token so that you can cache it. If you don't provide an expiration time, the\n * token is valid for 15 minutes. You can exchange the token with Amazon STS for temporary AWS\n * credentials, which are valid for a maximum of one hour. The maximum token duration you can\n * set is 24 hours. You should take care in setting the expiration time for a token, as there\n * are significant security implications: an attacker could use a leaked token to access your\n * AWS resources for the token's duration.
\n * \n * Please provide for a small grace period, usually no more than 5 minutes, to account for clock skew.
\n * \n */\n TokenDuration?: number;\n}\n\nexport namespace GetOpenIdTokenForDeveloperIdentityInput {\n export const filterSensitiveLog = (obj: GetOpenIdTokenForDeveloperIdentityInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful GetOpenIdTokenForDeveloperIdentity
\n * request.
\n */\nexport interface GetOpenIdTokenForDeveloperIdentityResponse {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * An OpenID token.
\n */\n Token?: string;\n}\n\nexport namespace GetOpenIdTokenForDeveloperIdentityResponse {\n export const filterSensitiveLog = (obj: GetOpenIdTokenForDeveloperIdentityResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the ListIdentities action.
\n */\nexport interface ListIdentitiesInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * The maximum number of identities to return.
\n */\n MaxResults: number | undefined;\n\n /**\n * A pagination token.
\n */\n NextToken?: string;\n\n /**\n * An optional boolean parameter that allows you to hide disabled identities. If\n * omitted, the ListIdentities API will include disabled identities in the response.
\n */\n HideDisabled?: boolean;\n}\n\nexport namespace ListIdentitiesInput {\n export const filterSensitiveLog = (obj: ListIdentitiesInput): any => ({\n ...obj,\n });\n}\n\n/**\n * The response to a ListIdentities request.
\n */\nexport interface ListIdentitiesResponse {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId?: string;\n\n /**\n * An object containing a set of identities and associated mappings.
\n */\n Identities?: IdentityDescription[];\n\n /**\n * A pagination token.
\n */\n NextToken?: string;\n}\n\nexport namespace ListIdentitiesResponse {\n export const filterSensitiveLog = (obj: ListIdentitiesResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the ListIdentityPools action.
\n */\nexport interface ListIdentityPoolsInput {\n /**\n * The maximum number of identities to return.
\n */\n MaxResults: number | undefined;\n\n /**\n * A pagination token.
\n */\n NextToken?: string;\n}\n\nexport namespace ListIdentityPoolsInput {\n export const filterSensitiveLog = (obj: ListIdentityPoolsInput): any => ({\n ...obj,\n });\n}\n\n/**\n * A description of the identity pool.
\n */\nexport interface IdentityPoolShortDescription {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId?: string;\n\n /**\n * A string that you provide.
\n */\n IdentityPoolName?: string;\n}\n\nexport namespace IdentityPoolShortDescription {\n export const filterSensitiveLog = (obj: IdentityPoolShortDescription): any => ({\n ...obj,\n });\n}\n\n/**\n * The result of a successful ListIdentityPools action.
\n */\nexport interface ListIdentityPoolsResponse {\n /**\n * The identity pools returned by the ListIdentityPools action.
\n */\n IdentityPools?: IdentityPoolShortDescription[];\n\n /**\n * A pagination token.
\n */\n NextToken?: string;\n}\n\nexport namespace ListIdentityPoolsResponse {\n export const filterSensitiveLog = (obj: ListIdentityPoolsResponse): any => ({\n ...obj,\n });\n}\n\nexport interface ListTagsForResourceInput {\n /**\n * The Amazon Resource Name (ARN) of the identity pool that the tags are assigned\n * to.
\n */\n ResourceArn: string | undefined;\n}\n\nexport namespace ListTagsForResourceInput {\n export const filterSensitiveLog = (obj: ListTagsForResourceInput): any => ({\n ...obj,\n });\n}\n\nexport interface ListTagsForResourceResponse {\n /**\n * The tags that are assigned to the identity pool.
\n */\n Tags?: { [key: string]: string };\n}\n\nexport namespace ListTagsForResourceResponse {\n export const filterSensitiveLog = (obj: ListTagsForResourceResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the LookupDeveloperIdentityInput
action.
\n */\nexport interface LookupDeveloperIdentityInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * A unique ID used by your backend authentication process to identify a user.\n * Typically, a developer identity provider would issue many developer user identifiers, in\n * keeping with the number of users.
\n */\n DeveloperUserIdentifier?: string;\n\n /**\n * The maximum number of identities to return.
\n */\n MaxResults?: number;\n\n /**\n * A pagination token. The first call you make will have NextToken
set to\n * null. After that the service will return NextToken
values as needed. For\n * example, let's say you make a request with MaxResults
set to 10, and there are\n * 20 matches in the database. The service will return a pagination token as a part of the\n * response. This token can be used to call the API again and get results starting from the\n * 11th match.
\n */\n NextToken?: string;\n}\n\nexport namespace LookupDeveloperIdentityInput {\n export const filterSensitiveLog = (obj: LookupDeveloperIdentityInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful LookupDeveloperIdentity
\n * action.
\n */\nexport interface LookupDeveloperIdentityResponse {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n\n /**\n * This is the list of developer user identifiers associated with an identity ID.\n * Cognito supports the association of multiple developer user identifiers with an identity\n * ID.
\n */\n DeveloperUserIdentifierList?: string[];\n\n /**\n * A pagination token. The first call you make will have NextToken
set to\n * null. After that the service will return NextToken
values as needed. For\n * example, let's say you make a request with MaxResults
set to 10, and there are\n * 20 matches in the database. The service will return a pagination token as a part of the\n * response. This token can be used to call the API again and get results starting from the\n * 11th match.
\n */\n NextToken?: string;\n}\n\nexport namespace LookupDeveloperIdentityResponse {\n export const filterSensitiveLog = (obj: LookupDeveloperIdentityResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the MergeDeveloperIdentities
action.
\n */\nexport interface MergeDeveloperIdentitiesInput {\n /**\n * User identifier for the source user. The value should be a\n * DeveloperUserIdentifier
.
\n */\n SourceUserIdentifier: string | undefined;\n\n /**\n * User identifier for the destination user. The value should be a\n * DeveloperUserIdentifier
.
\n */\n DestinationUserIdentifier: string | undefined;\n\n /**\n * The \"domain\" by which Cognito will refer to your users. This is a (pseudo) domain\n * name that you provide while creating an identity pool. This name acts as a placeholder that\n * allows your backend and the Cognito service to communicate about the developer provider.\n * For the DeveloperProviderName
, you can use letters as well as period (.),\n * underscore (_), and dash (-).
\n */\n DeveloperProviderName: string | undefined;\n\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n}\n\nexport namespace MergeDeveloperIdentitiesInput {\n export const filterSensitiveLog = (obj: MergeDeveloperIdentitiesInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Returned in response to a successful MergeDeveloperIdentities
\n * action.
\n */\nexport interface MergeDeveloperIdentitiesResponse {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId?: string;\n}\n\nexport namespace MergeDeveloperIdentitiesResponse {\n export const filterSensitiveLog = (obj: MergeDeveloperIdentitiesResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Thrown if there are parallel requests to modify a resource.
\n */\nexport interface ConcurrentModificationException extends __SmithyException, $MetadataBearer {\n name: \"ConcurrentModificationException\";\n $fault: \"client\";\n /**\n * The message returned by a ConcurrentModificationException.
\n */\n message?: string;\n}\n\nexport namespace ConcurrentModificationException {\n export const filterSensitiveLog = (obj: ConcurrentModificationException): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the SetIdentityPoolRoles
action.
\n */\nexport interface SetIdentityPoolRolesInput {\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * The map of roles associated with this pool. For a given role, the key will be either\n * \"authenticated\" or \"unauthenticated\" and the value will be the Role ARN.
\n */\n Roles: { [key: string]: string } | undefined;\n\n /**\n * How users for a specific identity provider are to mapped to roles. This is a string\n * to RoleMapping object map. The string identifies the identity provider,\n * for example, \"graph.facebook.com\" or\n * \"cognito-idp-east-1.amazonaws.com/us-east-1_abcdefghi:app_client_id\".
\n * Up to 25 rules can be specified per identity provider.
\n */\n RoleMappings?: { [key: string]: RoleMapping };\n}\n\nexport namespace SetIdentityPoolRolesInput {\n export const filterSensitiveLog = (obj: SetIdentityPoolRolesInput): any => ({\n ...obj,\n });\n}\n\nexport interface TagResourceInput {\n /**\n * The Amazon Resource Name (ARN) of the identity pool to assign the tags to.
\n */\n ResourceArn: string | undefined;\n\n /**\n * The tags to assign to the identity pool.
\n */\n Tags: { [key: string]: string } | undefined;\n}\n\nexport namespace TagResourceInput {\n export const filterSensitiveLog = (obj: TagResourceInput): any => ({\n ...obj,\n });\n}\n\nexport interface TagResourceResponse {}\n\nexport namespace TagResourceResponse {\n export const filterSensitiveLog = (obj: TagResourceResponse): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the UnlinkDeveloperIdentity
action.
\n */\nexport interface UnlinkDeveloperIdentityInput {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId: string | undefined;\n\n /**\n * An identity pool ID in the format REGION:GUID.
\n */\n IdentityPoolId: string | undefined;\n\n /**\n * The \"domain\" by which Cognito will refer to your users.
\n */\n DeveloperProviderName: string | undefined;\n\n /**\n * A unique ID used by your backend authentication process to identify a user.
\n */\n DeveloperUserIdentifier: string | undefined;\n}\n\nexport namespace UnlinkDeveloperIdentityInput {\n export const filterSensitiveLog = (obj: UnlinkDeveloperIdentityInput): any => ({\n ...obj,\n });\n}\n\n/**\n * Input to the UnlinkIdentity action.
\n */\nexport interface UnlinkIdentityInput {\n /**\n * A unique identifier in the format REGION:GUID.
\n */\n IdentityId: string | undefined;\n\n /**\n * A set of optional name-value pairs that map provider names to provider\n * tokens.
\n */\n Logins: { [key: string]: string } | undefined;\n\n /**\n * Provider names to unlink from this identity.
\n */\n LoginsToRemove: string[] | undefined;\n}\n\nexport namespace UnlinkIdentityInput {\n export const filterSensitiveLog = (obj: UnlinkIdentityInput): any => ({\n ...obj,\n });\n}\n\nexport interface UntagResourceInput {\n /**\n * The Amazon Resource Name (ARN) of the identity pool that the tags are assigned\n * to.
\n */\n ResourceArn: string | undefined;\n\n /**\n * The keys of the tags to remove from the user pool.
\n */\n TagKeys: string[] | undefined;\n}\n\nexport namespace UntagResourceInput {\n export const filterSensitiveLog = (obj: UntagResourceInput): any => ({\n ...obj,\n });\n}\n\nexport interface UntagResourceResponse {}\n\nexport namespace UntagResourceResponse {\n export const filterSensitiveLog = (obj: UntagResourceResponse): any => ({\n ...obj,\n });\n}\n","import { CreateIdentityPoolCommandInput, CreateIdentityPoolCommandOutput } from \"../commands/CreateIdentityPoolCommand\";\nimport { DeleteIdentitiesCommandInput, DeleteIdentitiesCommandOutput } from \"../commands/DeleteIdentitiesCommand\";\nimport { DeleteIdentityPoolCommandInput, DeleteIdentityPoolCommandOutput } from \"../commands/DeleteIdentityPoolCommand\";\nimport { DescribeIdentityCommandInput, DescribeIdentityCommandOutput } from \"../commands/DescribeIdentityCommand\";\nimport {\n DescribeIdentityPoolCommandInput,\n DescribeIdentityPoolCommandOutput,\n} from \"../commands/DescribeIdentityPoolCommand\";\nimport {\n GetCredentialsForIdentityCommandInput,\n GetCredentialsForIdentityCommandOutput,\n} from \"../commands/GetCredentialsForIdentityCommand\";\nimport { GetIdCommandInput, GetIdCommandOutput } from \"../commands/GetIdCommand\";\nimport {\n GetIdentityPoolRolesCommandInput,\n GetIdentityPoolRolesCommandOutput,\n} from \"../commands/GetIdentityPoolRolesCommand\";\nimport { GetOpenIdTokenCommandInput, GetOpenIdTokenCommandOutput } from \"../commands/GetOpenIdTokenCommand\";\nimport {\n GetOpenIdTokenForDeveloperIdentityCommandInput,\n GetOpenIdTokenForDeveloperIdentityCommandOutput,\n} from \"../commands/GetOpenIdTokenForDeveloperIdentityCommand\";\nimport { ListIdentitiesCommandInput, ListIdentitiesCommandOutput } from \"../commands/ListIdentitiesCommand\";\nimport { ListIdentityPoolsCommandInput, ListIdentityPoolsCommandOutput } from \"../commands/ListIdentityPoolsCommand\";\nimport {\n ListTagsForResourceCommandInput,\n ListTagsForResourceCommandOutput,\n} from \"../commands/ListTagsForResourceCommand\";\nimport {\n LookupDeveloperIdentityCommandInput,\n LookupDeveloperIdentityCommandOutput,\n} from \"../commands/LookupDeveloperIdentityCommand\";\nimport {\n MergeDeveloperIdentitiesCommandInput,\n MergeDeveloperIdentitiesCommandOutput,\n} from \"../commands/MergeDeveloperIdentitiesCommand\";\nimport {\n SetIdentityPoolRolesCommandInput,\n SetIdentityPoolRolesCommandOutput,\n} from \"../commands/SetIdentityPoolRolesCommand\";\nimport { TagResourceCommandInput, TagResourceCommandOutput } from \"../commands/TagResourceCommand\";\nimport {\n UnlinkDeveloperIdentityCommandInput,\n UnlinkDeveloperIdentityCommandOutput,\n} from \"../commands/UnlinkDeveloperIdentityCommand\";\nimport { UnlinkIdentityCommandInput, UnlinkIdentityCommandOutput } from \"../commands/UnlinkIdentityCommand\";\nimport { UntagResourceCommandInput, UntagResourceCommandOutput } from \"../commands/UntagResourceCommand\";\nimport { UpdateIdentityPoolCommandInput, UpdateIdentityPoolCommandOutput } from \"../commands/UpdateIdentityPoolCommand\";\nimport {\n CognitoIdentityProvider,\n ConcurrentModificationException,\n CreateIdentityPoolInput,\n Credentials,\n DeleteIdentitiesInput,\n DeleteIdentitiesResponse,\n DeleteIdentityPoolInput,\n DescribeIdentityInput,\n DescribeIdentityPoolInput,\n DeveloperUserAlreadyRegisteredException,\n ExternalServiceException,\n GetCredentialsForIdentityInput,\n GetCredentialsForIdentityResponse,\n GetIdInput,\n GetIdResponse,\n GetIdentityPoolRolesInput,\n GetIdentityPoolRolesResponse,\n GetOpenIdTokenForDeveloperIdentityInput,\n GetOpenIdTokenForDeveloperIdentityResponse,\n GetOpenIdTokenInput,\n GetOpenIdTokenResponse,\n IdentityDescription,\n IdentityPool,\n IdentityPoolShortDescription,\n InternalErrorException,\n InvalidIdentityPoolConfigurationException,\n InvalidParameterException,\n LimitExceededException,\n ListIdentitiesInput,\n ListIdentitiesResponse,\n ListIdentityPoolsInput,\n ListIdentityPoolsResponse,\n ListTagsForResourceInput,\n ListTagsForResourceResponse,\n LookupDeveloperIdentityInput,\n LookupDeveloperIdentityResponse,\n MappingRule,\n MergeDeveloperIdentitiesInput,\n MergeDeveloperIdentitiesResponse,\n NotAuthorizedException,\n ResourceConflictException,\n ResourceNotFoundException,\n RoleMapping,\n RulesConfigurationType,\n SetIdentityPoolRolesInput,\n TagResourceInput,\n TagResourceResponse,\n TooManyRequestsException,\n UnlinkDeveloperIdentityInput,\n UnlinkIdentityInput,\n UnprocessedIdentityId,\n UntagResourceInput,\n UntagResourceResponse,\n} from \"../models/models_0\";\nimport { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from \"@aws-sdk/protocol-http\";\nimport { SmithyException as __SmithyException } from \"@aws-sdk/smithy-client\";\nimport {\n Endpoint as __Endpoint,\n HeaderBag as __HeaderBag,\n MetadataBearer as __MetadataBearer,\n ResponseMetadata as __ResponseMetadata,\n SerdeContext as __SerdeContext,\n} from \"@aws-sdk/types\";\n\nexport const serializeAws_json1_1CreateIdentityPoolCommand = async (\n input: CreateIdentityPoolCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.CreateIdentityPool\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1CreateIdentityPoolInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1DeleteIdentitiesCommand = async (\n input: DeleteIdentitiesCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DeleteIdentities\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1DeleteIdentitiesInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1DeleteIdentityPoolCommand = async (\n input: DeleteIdentityPoolCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DeleteIdentityPool\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1DeleteIdentityPoolInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1DescribeIdentityCommand = async (\n input: DescribeIdentityCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DescribeIdentity\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1DescribeIdentityInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1DescribeIdentityPoolCommand = async (\n input: DescribeIdentityPoolCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.DescribeIdentityPool\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1DescribeIdentityPoolInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1GetCredentialsForIdentityCommand = async (\n input: GetCredentialsForIdentityCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetCredentialsForIdentity\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1GetCredentialsForIdentityInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1GetIdCommand = async (\n input: GetIdCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetId\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1GetIdInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1GetIdentityPoolRolesCommand = async (\n input: GetIdentityPoolRolesCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetIdentityPoolRoles\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1GetIdentityPoolRolesInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1GetOpenIdTokenCommand = async (\n input: GetOpenIdTokenCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetOpenIdToken\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1GetOpenIdTokenInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommand = async (\n input: GetOpenIdTokenForDeveloperIdentityCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.GetOpenIdTokenForDeveloperIdentity\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1ListIdentitiesCommand = async (\n input: ListIdentitiesCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.ListIdentities\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1ListIdentitiesInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1ListIdentityPoolsCommand = async (\n input: ListIdentityPoolsCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.ListIdentityPools\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1ListIdentityPoolsInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1ListTagsForResourceCommand = async (\n input: ListTagsForResourceCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.ListTagsForResource\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1ListTagsForResourceInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1LookupDeveloperIdentityCommand = async (\n input: LookupDeveloperIdentityCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.LookupDeveloperIdentity\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1LookupDeveloperIdentityInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1MergeDeveloperIdentitiesCommand = async (\n input: MergeDeveloperIdentitiesCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.MergeDeveloperIdentities\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1MergeDeveloperIdentitiesInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1SetIdentityPoolRolesCommand = async (\n input: SetIdentityPoolRolesCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.SetIdentityPoolRoles\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1SetIdentityPoolRolesInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1TagResourceCommand = async (\n input: TagResourceCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.TagResource\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1TagResourceInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1UnlinkDeveloperIdentityCommand = async (\n input: UnlinkDeveloperIdentityCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UnlinkDeveloperIdentity\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1UnlinkDeveloperIdentityInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1UnlinkIdentityCommand = async (\n input: UnlinkIdentityCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UnlinkIdentity\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1UnlinkIdentityInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1UntagResourceCommand = async (\n input: UntagResourceCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UntagResource\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1UntagResourceInput(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const serializeAws_json1_1UpdateIdentityPoolCommand = async (\n input: UpdateIdentityPoolCommandInput,\n context: __SerdeContext\n): Promise<__HttpRequest> => {\n const headers: __HeaderBag = {\n \"content-type\": \"application/x-amz-json-1.1\",\n \"x-amz-target\": \"AWSCognitoIdentityService.UpdateIdentityPool\",\n };\n let body: any;\n body = JSON.stringify(serializeAws_json1_1IdentityPool(input, context));\n return buildHttpRpcRequest(context, headers, \"/\", undefined, body);\n};\n\nexport const deserializeAws_json1_1CreateIdentityPoolCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1CreateIdentityPoolCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1IdentityPool(data, context);\n const response: CreateIdentityPoolCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1CreateIdentityPoolCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"LimitExceededException\":\n case \"com.amazonaws.cognitoidentity#LimitExceededException\":\n response = {\n ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1DeleteIdentitiesCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1DeleteIdentitiesCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1DeleteIdentitiesResponse(data, context);\n const response: DeleteIdentitiesCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1DeleteIdentitiesCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1DeleteIdentityPoolCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1DeleteIdentityPoolCommandError(output, context);\n }\n await collectBody(output.body, context);\n const response: DeleteIdentityPoolCommandOutput = {\n $metadata: deserializeMetadata(output),\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1DeleteIdentityPoolCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1DescribeIdentityCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1DescribeIdentityCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1IdentityDescription(data, context);\n const response: DescribeIdentityCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1DescribeIdentityCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1DescribeIdentityPoolCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1DescribeIdentityPoolCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1IdentityPool(data, context);\n const response: DescribeIdentityPoolCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1DescribeIdentityPoolCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1GetCredentialsForIdentityCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1GetCredentialsForIdentityCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1GetCredentialsForIdentityResponse(data, context);\n const response: GetCredentialsForIdentityCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1GetCredentialsForIdentityCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"ExternalServiceException\":\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\":\n response = {\n ...(await deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidIdentityPoolConfigurationException\":\n case \"com.amazonaws.cognitoidentity#InvalidIdentityPoolConfigurationException\":\n response = {\n ...(await deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1GetIdCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1GetIdCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1GetIdResponse(data, context);\n const response: GetIdCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1GetIdCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"ExternalServiceException\":\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\":\n response = {\n ...(await deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"LimitExceededException\":\n case \"com.amazonaws.cognitoidentity#LimitExceededException\":\n response = {\n ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1GetIdentityPoolRolesCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1GetIdentityPoolRolesCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1GetIdentityPoolRolesResponse(data, context);\n const response: GetIdentityPoolRolesCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1GetIdentityPoolRolesCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1GetOpenIdTokenCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1GetOpenIdTokenCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1GetOpenIdTokenResponse(data, context);\n const response: GetOpenIdTokenCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1GetOpenIdTokenCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"ExternalServiceException\":\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\":\n response = {\n ...(await deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityResponse(data, context);\n const response: GetOpenIdTokenForDeveloperIdentityCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"DeveloperUserAlreadyRegisteredException\":\n case \"com.amazonaws.cognitoidentity#DeveloperUserAlreadyRegisteredException\":\n response = {\n ...(await deserializeAws_json1_1DeveloperUserAlreadyRegisteredExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1ListIdentitiesCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1ListIdentitiesCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1ListIdentitiesResponse(data, context);\n const response: ListIdentitiesCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1ListIdentitiesCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1ListIdentityPoolsCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1ListIdentityPoolsCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1ListIdentityPoolsResponse(data, context);\n const response: ListIdentityPoolsCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1ListIdentityPoolsCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1ListTagsForResourceCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1ListTagsForResourceCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1ListTagsForResourceResponse(data, context);\n const response: ListTagsForResourceCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1ListTagsForResourceCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1LookupDeveloperIdentityCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1LookupDeveloperIdentityCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1LookupDeveloperIdentityResponse(data, context);\n const response: LookupDeveloperIdentityCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1LookupDeveloperIdentityCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1MergeDeveloperIdentitiesCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1MergeDeveloperIdentitiesCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1MergeDeveloperIdentitiesResponse(data, context);\n const response: MergeDeveloperIdentitiesCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1MergeDeveloperIdentitiesCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1SetIdentityPoolRolesCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1SetIdentityPoolRolesCommandError(output, context);\n }\n await collectBody(output.body, context);\n const response: SetIdentityPoolRolesCommandOutput = {\n $metadata: deserializeMetadata(output),\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1SetIdentityPoolRolesCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"ConcurrentModificationException\":\n case \"com.amazonaws.cognitoidentity#ConcurrentModificationException\":\n response = {\n ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1TagResourceCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1TagResourceCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1TagResourceResponse(data, context);\n const response: TagResourceCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1TagResourceCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1UnlinkDeveloperIdentityCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1UnlinkDeveloperIdentityCommandError(output, context);\n }\n await collectBody(output.body, context);\n const response: UnlinkDeveloperIdentityCommandOutput = {\n $metadata: deserializeMetadata(output),\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1UnlinkDeveloperIdentityCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1UnlinkIdentityCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1UnlinkIdentityCommandError(output, context);\n }\n await collectBody(output.body, context);\n const response: UnlinkIdentityCommandOutput = {\n $metadata: deserializeMetadata(output),\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1UnlinkIdentityCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"ExternalServiceException\":\n case \"com.amazonaws.cognitoidentity#ExternalServiceException\":\n response = {\n ...(await deserializeAws_json1_1ExternalServiceExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1UntagResourceCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1UntagResourceCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1UntagResourceResponse(data, context);\n const response: UntagResourceCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1UntagResourceCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nexport const deserializeAws_json1_1UpdateIdentityPoolCommand = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n if (output.statusCode >= 300) {\n return deserializeAws_json1_1UpdateIdentityPoolCommandError(output, context);\n }\n const data: any = await parseBody(output.body, context);\n let contents: any = {};\n contents = deserializeAws_json1_1IdentityPool(data, context);\n const response: UpdateIdentityPoolCommandOutput = {\n $metadata: deserializeMetadata(output),\n ...contents,\n };\n return Promise.resolve(response);\n};\n\nconst deserializeAws_json1_1UpdateIdentityPoolCommandError = async (\n output: __HttpResponse,\n context: __SerdeContext\n): Promise => {\n const parsedOutput: any = {\n ...output,\n body: await parseBody(output.body, context),\n };\n let response: __SmithyException & __MetadataBearer & { [key: string]: any };\n let errorCode: string = \"UnknownError\";\n errorCode = loadRestJsonErrorCode(output, parsedOutput.body);\n switch (errorCode) {\n case \"ConcurrentModificationException\":\n case \"com.amazonaws.cognitoidentity#ConcurrentModificationException\":\n response = {\n ...(await deserializeAws_json1_1ConcurrentModificationExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InternalErrorException\":\n case \"com.amazonaws.cognitoidentity#InternalErrorException\":\n response = {\n ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"InvalidParameterException\":\n case \"com.amazonaws.cognitoidentity#InvalidParameterException\":\n response = {\n ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"LimitExceededException\":\n case \"com.amazonaws.cognitoidentity#LimitExceededException\":\n response = {\n ...(await deserializeAws_json1_1LimitExceededExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"NotAuthorizedException\":\n case \"com.amazonaws.cognitoidentity#NotAuthorizedException\":\n response = {\n ...(await deserializeAws_json1_1NotAuthorizedExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceConflictException\":\n case \"com.amazonaws.cognitoidentity#ResourceConflictException\":\n response = {\n ...(await deserializeAws_json1_1ResourceConflictExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"ResourceNotFoundException\":\n case \"com.amazonaws.cognitoidentity#ResourceNotFoundException\":\n response = {\n ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n case \"TooManyRequestsException\":\n case \"com.amazonaws.cognitoidentity#TooManyRequestsException\":\n response = {\n ...(await deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)),\n name: errorCode,\n $metadata: deserializeMetadata(output),\n };\n break;\n default:\n const parsedBody = parsedOutput.body;\n errorCode = parsedBody.code || parsedBody.Code || errorCode;\n response = {\n ...parsedBody,\n name: `${errorCode}`,\n message: parsedBody.message || parsedBody.Message || errorCode,\n $fault: \"client\",\n $metadata: deserializeMetadata(output),\n } as any;\n }\n const message = response.message || response.Message || errorCode;\n response.message = message;\n delete response.Message;\n return Promise.reject(Object.assign(new Error(message), response));\n};\n\nconst deserializeAws_json1_1ConcurrentModificationExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1ConcurrentModificationException(body, context);\n const contents: ConcurrentModificationException = {\n name: \"ConcurrentModificationException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1DeveloperUserAlreadyRegisteredExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1DeveloperUserAlreadyRegisteredException(body, context);\n const contents: DeveloperUserAlreadyRegisteredException = {\n name: \"DeveloperUserAlreadyRegisteredException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1ExternalServiceExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1ExternalServiceException(body, context);\n const contents: ExternalServiceException = {\n name: \"ExternalServiceException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1InternalErrorExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1InternalErrorException(body, context);\n const contents: InternalErrorException = {\n name: \"InternalErrorException\",\n $fault: \"server\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1InvalidIdentityPoolConfigurationExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1InvalidIdentityPoolConfigurationException(body, context);\n const contents: InvalidIdentityPoolConfigurationException = {\n name: \"InvalidIdentityPoolConfigurationException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1InvalidParameterExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1InvalidParameterException(body, context);\n const contents: InvalidParameterException = {\n name: \"InvalidParameterException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1LimitExceededExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1LimitExceededException(body, context);\n const contents: LimitExceededException = {\n name: \"LimitExceededException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1NotAuthorizedExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1NotAuthorizedException(body, context);\n const contents: NotAuthorizedException = {\n name: \"NotAuthorizedException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1ResourceConflictExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1ResourceConflictException(body, context);\n const contents: ResourceConflictException = {\n name: \"ResourceConflictException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1ResourceNotFoundException(body, context);\n const contents: ResourceNotFoundException = {\n name: \"ResourceNotFoundException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst deserializeAws_json1_1TooManyRequestsExceptionResponse = async (\n parsedOutput: any,\n context: __SerdeContext\n): Promise => {\n const body = parsedOutput.body;\n const deserialized: any = deserializeAws_json1_1TooManyRequestsException(body, context);\n const contents: TooManyRequestsException = {\n name: \"TooManyRequestsException\",\n $fault: \"client\",\n $metadata: deserializeMetadata(parsedOutput),\n ...deserialized,\n };\n return contents;\n};\n\nconst serializeAws_json1_1CognitoIdentityProvider = (input: CognitoIdentityProvider, context: __SerdeContext): any => {\n return {\n ...(input.ClientId !== undefined && input.ClientId !== null && { ClientId: input.ClientId }),\n ...(input.ProviderName !== undefined && input.ProviderName !== null && { ProviderName: input.ProviderName }),\n ...(input.ServerSideTokenCheck !== undefined &&\n input.ServerSideTokenCheck !== null && { ServerSideTokenCheck: input.ServerSideTokenCheck }),\n };\n};\n\nconst serializeAws_json1_1CognitoIdentityProviderList = (\n input: CognitoIdentityProvider[],\n context: __SerdeContext\n): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return serializeAws_json1_1CognitoIdentityProvider(entry, context);\n });\n};\n\nconst serializeAws_json1_1CreateIdentityPoolInput = (input: CreateIdentityPoolInput, context: __SerdeContext): any => {\n return {\n ...(input.AllowClassicFlow !== undefined &&\n input.AllowClassicFlow !== null && { AllowClassicFlow: input.AllowClassicFlow }),\n ...(input.AllowUnauthenticatedIdentities !== undefined &&\n input.AllowUnauthenticatedIdentities !== null && {\n AllowUnauthenticatedIdentities: input.AllowUnauthenticatedIdentities,\n }),\n ...(input.CognitoIdentityProviders !== undefined &&\n input.CognitoIdentityProviders !== null && {\n CognitoIdentityProviders: serializeAws_json1_1CognitoIdentityProviderList(\n input.CognitoIdentityProviders,\n context\n ),\n }),\n ...(input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName }),\n ...(input.IdentityPoolName !== undefined &&\n input.IdentityPoolName !== null && { IdentityPoolName: input.IdentityPoolName }),\n ...(input.IdentityPoolTags !== undefined &&\n input.IdentityPoolTags !== null && {\n IdentityPoolTags: serializeAws_json1_1IdentityPoolTagsType(input.IdentityPoolTags, context),\n }),\n ...(input.OpenIdConnectProviderARNs !== undefined &&\n input.OpenIdConnectProviderARNs !== null && {\n OpenIdConnectProviderARNs: serializeAws_json1_1OIDCProviderList(input.OpenIdConnectProviderARNs, context),\n }),\n ...(input.SamlProviderARNs !== undefined &&\n input.SamlProviderARNs !== null && {\n SamlProviderARNs: serializeAws_json1_1SAMLProviderList(input.SamlProviderARNs, context),\n }),\n ...(input.SupportedLoginProviders !== undefined &&\n input.SupportedLoginProviders !== null && {\n SupportedLoginProviders: serializeAws_json1_1IdentityProviders(input.SupportedLoginProviders, context),\n }),\n };\n};\n\nconst serializeAws_json1_1DeleteIdentitiesInput = (input: DeleteIdentitiesInput, context: __SerdeContext): any => {\n return {\n ...(input.IdentityIdsToDelete !== undefined &&\n input.IdentityIdsToDelete !== null && {\n IdentityIdsToDelete: serializeAws_json1_1IdentityIdList(input.IdentityIdsToDelete, context),\n }),\n };\n};\n\nconst serializeAws_json1_1DeleteIdentityPoolInput = (input: DeleteIdentityPoolInput, context: __SerdeContext): any => {\n return {\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n };\n};\n\nconst serializeAws_json1_1DescribeIdentityInput = (input: DescribeIdentityInput, context: __SerdeContext): any => {\n return {\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n };\n};\n\nconst serializeAws_json1_1DescribeIdentityPoolInput = (\n input: DescribeIdentityPoolInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n };\n};\n\nconst serializeAws_json1_1GetCredentialsForIdentityInput = (\n input: GetCredentialsForIdentityInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.CustomRoleArn !== undefined && input.CustomRoleArn !== null && { CustomRoleArn: input.CustomRoleArn }),\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n ...(input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }),\n };\n};\n\nconst serializeAws_json1_1GetIdentityPoolRolesInput = (\n input: GetIdentityPoolRolesInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n };\n};\n\nconst serializeAws_json1_1GetIdInput = (input: GetIdInput, context: __SerdeContext): any => {\n return {\n ...(input.AccountId !== undefined && input.AccountId !== null && { AccountId: input.AccountId }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }),\n };\n};\n\nconst serializeAws_json1_1GetOpenIdTokenForDeveloperIdentityInput = (\n input: GetOpenIdTokenForDeveloperIdentityInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }),\n ...(input.TokenDuration !== undefined && input.TokenDuration !== null && { TokenDuration: input.TokenDuration }),\n };\n};\n\nconst serializeAws_json1_1GetOpenIdTokenInput = (input: GetOpenIdTokenInput, context: __SerdeContext): any => {\n return {\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n ...(input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }),\n };\n};\n\nconst serializeAws_json1_1IdentityIdList = (input: string[], context: __SerdeContext): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst serializeAws_json1_1IdentityPool = (input: IdentityPool, context: __SerdeContext): any => {\n return {\n ...(input.AllowClassicFlow !== undefined &&\n input.AllowClassicFlow !== null && { AllowClassicFlow: input.AllowClassicFlow }),\n ...(input.AllowUnauthenticatedIdentities !== undefined &&\n input.AllowUnauthenticatedIdentities !== null && {\n AllowUnauthenticatedIdentities: input.AllowUnauthenticatedIdentities,\n }),\n ...(input.CognitoIdentityProviders !== undefined &&\n input.CognitoIdentityProviders !== null && {\n CognitoIdentityProviders: serializeAws_json1_1CognitoIdentityProviderList(\n input.CognitoIdentityProviders,\n context\n ),\n }),\n ...(input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.IdentityPoolName !== undefined &&\n input.IdentityPoolName !== null && { IdentityPoolName: input.IdentityPoolName }),\n ...(input.IdentityPoolTags !== undefined &&\n input.IdentityPoolTags !== null && {\n IdentityPoolTags: serializeAws_json1_1IdentityPoolTagsType(input.IdentityPoolTags, context),\n }),\n ...(input.OpenIdConnectProviderARNs !== undefined &&\n input.OpenIdConnectProviderARNs !== null && {\n OpenIdConnectProviderARNs: serializeAws_json1_1OIDCProviderList(input.OpenIdConnectProviderARNs, context),\n }),\n ...(input.SamlProviderARNs !== undefined &&\n input.SamlProviderARNs !== null && {\n SamlProviderARNs: serializeAws_json1_1SAMLProviderList(input.SamlProviderARNs, context),\n }),\n ...(input.SupportedLoginProviders !== undefined &&\n input.SupportedLoginProviders !== null && {\n SupportedLoginProviders: serializeAws_json1_1IdentityProviders(input.SupportedLoginProviders, context),\n }),\n };\n};\n\nconst serializeAws_json1_1IdentityPoolTagsListType = (input: string[], context: __SerdeContext): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst serializeAws_json1_1IdentityPoolTagsType = (input: { [key: string]: string }, context: __SerdeContext): any => {\n return Object.entries(input).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst serializeAws_json1_1IdentityProviders = (input: { [key: string]: string }, context: __SerdeContext): any => {\n return Object.entries(input).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst serializeAws_json1_1ListIdentitiesInput = (input: ListIdentitiesInput, context: __SerdeContext): any => {\n return {\n ...(input.HideDisabled !== undefined && input.HideDisabled !== null && { HideDisabled: input.HideDisabled }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),\n ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),\n };\n};\n\nconst serializeAws_json1_1ListIdentityPoolsInput = (input: ListIdentityPoolsInput, context: __SerdeContext): any => {\n return {\n ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),\n ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),\n };\n};\n\nconst serializeAws_json1_1ListTagsForResourceInput = (\n input: ListTagsForResourceInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }),\n };\n};\n\nconst serializeAws_json1_1LoginsList = (input: string[], context: __SerdeContext): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst serializeAws_json1_1LoginsMap = (input: { [key: string]: string }, context: __SerdeContext): any => {\n return Object.entries(input).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst serializeAws_json1_1LookupDeveloperIdentityInput = (\n input: LookupDeveloperIdentityInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.DeveloperUserIdentifier !== undefined &&\n input.DeveloperUserIdentifier !== null && { DeveloperUserIdentifier: input.DeveloperUserIdentifier }),\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),\n ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),\n };\n};\n\nconst serializeAws_json1_1MappingRule = (input: MappingRule, context: __SerdeContext): any => {\n return {\n ...(input.Claim !== undefined && input.Claim !== null && { Claim: input.Claim }),\n ...(input.MatchType !== undefined && input.MatchType !== null && { MatchType: input.MatchType }),\n ...(input.RoleARN !== undefined && input.RoleARN !== null && { RoleARN: input.RoleARN }),\n ...(input.Value !== undefined && input.Value !== null && { Value: input.Value }),\n };\n};\n\nconst serializeAws_json1_1MappingRulesList = (input: MappingRule[], context: __SerdeContext): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return serializeAws_json1_1MappingRule(entry, context);\n });\n};\n\nconst serializeAws_json1_1MergeDeveloperIdentitiesInput = (\n input: MergeDeveloperIdentitiesInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.DestinationUserIdentifier !== undefined &&\n input.DestinationUserIdentifier !== null && { DestinationUserIdentifier: input.DestinationUserIdentifier }),\n ...(input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.SourceUserIdentifier !== undefined &&\n input.SourceUserIdentifier !== null && { SourceUserIdentifier: input.SourceUserIdentifier }),\n };\n};\n\nconst serializeAws_json1_1OIDCProviderList = (input: string[], context: __SerdeContext): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst serializeAws_json1_1RoleMapping = (input: RoleMapping, context: __SerdeContext): any => {\n return {\n ...(input.AmbiguousRoleResolution !== undefined &&\n input.AmbiguousRoleResolution !== null && { AmbiguousRoleResolution: input.AmbiguousRoleResolution }),\n ...(input.RulesConfiguration !== undefined &&\n input.RulesConfiguration !== null && {\n RulesConfiguration: serializeAws_json1_1RulesConfigurationType(input.RulesConfiguration, context),\n }),\n ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }),\n };\n};\n\nconst serializeAws_json1_1RoleMappingMap = (input: { [key: string]: RoleMapping }, context: __SerdeContext): any => {\n return Object.entries(input).reduce((acc: { [key: string]: RoleMapping }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: serializeAws_json1_1RoleMapping(value, context),\n };\n }, {});\n};\n\nconst serializeAws_json1_1RolesMap = (input: { [key: string]: string }, context: __SerdeContext): any => {\n return Object.entries(input).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst serializeAws_json1_1RulesConfigurationType = (input: RulesConfigurationType, context: __SerdeContext): any => {\n return {\n ...(input.Rules !== undefined &&\n input.Rules !== null && { Rules: serializeAws_json1_1MappingRulesList(input.Rules, context) }),\n };\n};\n\nconst serializeAws_json1_1SAMLProviderList = (input: string[], context: __SerdeContext): any => {\n return input\n .filter((e: any) => e != null)\n .map((entry) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst serializeAws_json1_1SetIdentityPoolRolesInput = (\n input: SetIdentityPoolRolesInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n ...(input.RoleMappings !== undefined &&\n input.RoleMappings !== null && { RoleMappings: serializeAws_json1_1RoleMappingMap(input.RoleMappings, context) }),\n ...(input.Roles !== undefined &&\n input.Roles !== null && { Roles: serializeAws_json1_1RolesMap(input.Roles, context) }),\n };\n};\n\nconst serializeAws_json1_1TagResourceInput = (input: TagResourceInput, context: __SerdeContext): any => {\n return {\n ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }),\n ...(input.Tags !== undefined &&\n input.Tags !== null && { Tags: serializeAws_json1_1IdentityPoolTagsType(input.Tags, context) }),\n };\n};\n\nconst serializeAws_json1_1UnlinkDeveloperIdentityInput = (\n input: UnlinkDeveloperIdentityInput,\n context: __SerdeContext\n): any => {\n return {\n ...(input.DeveloperProviderName !== undefined &&\n input.DeveloperProviderName !== null && { DeveloperProviderName: input.DeveloperProviderName }),\n ...(input.DeveloperUserIdentifier !== undefined &&\n input.DeveloperUserIdentifier !== null && { DeveloperUserIdentifier: input.DeveloperUserIdentifier }),\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n ...(input.IdentityPoolId !== undefined &&\n input.IdentityPoolId !== null && { IdentityPoolId: input.IdentityPoolId }),\n };\n};\n\nconst serializeAws_json1_1UnlinkIdentityInput = (input: UnlinkIdentityInput, context: __SerdeContext): any => {\n return {\n ...(input.IdentityId !== undefined && input.IdentityId !== null && { IdentityId: input.IdentityId }),\n ...(input.Logins !== undefined &&\n input.Logins !== null && { Logins: serializeAws_json1_1LoginsMap(input.Logins, context) }),\n ...(input.LoginsToRemove !== undefined &&\n input.LoginsToRemove !== null && {\n LoginsToRemove: serializeAws_json1_1LoginsList(input.LoginsToRemove, context),\n }),\n };\n};\n\nconst serializeAws_json1_1UntagResourceInput = (input: UntagResourceInput, context: __SerdeContext): any => {\n return {\n ...(input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }),\n ...(input.TagKeys !== undefined &&\n input.TagKeys !== null && { TagKeys: serializeAws_json1_1IdentityPoolTagsListType(input.TagKeys, context) }),\n };\n};\n\nconst deserializeAws_json1_1CognitoIdentityProvider = (\n output: any,\n context: __SerdeContext\n): CognitoIdentityProvider => {\n return {\n ClientId: output.ClientId !== undefined && output.ClientId !== null ? output.ClientId : undefined,\n ProviderName: output.ProviderName !== undefined && output.ProviderName !== null ? output.ProviderName : undefined,\n ServerSideTokenCheck:\n output.ServerSideTokenCheck !== undefined && output.ServerSideTokenCheck !== null\n ? output.ServerSideTokenCheck\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1CognitoIdentityProviderList = (\n output: any,\n context: __SerdeContext\n): CognitoIdentityProvider[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return deserializeAws_json1_1CognitoIdentityProvider(entry, context);\n });\n};\n\nconst deserializeAws_json1_1ConcurrentModificationException = (\n output: any,\n context: __SerdeContext\n): ConcurrentModificationException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1Credentials = (output: any, context: __SerdeContext): Credentials => {\n return {\n AccessKeyId: output.AccessKeyId !== undefined && output.AccessKeyId !== null ? output.AccessKeyId : undefined,\n Expiration:\n output.Expiration !== undefined && output.Expiration !== null\n ? new Date(Math.round(output.Expiration * 1000))\n : undefined,\n SecretKey: output.SecretKey !== undefined && output.SecretKey !== null ? output.SecretKey : undefined,\n SessionToken: output.SessionToken !== undefined && output.SessionToken !== null ? output.SessionToken : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1DeleteIdentitiesResponse = (\n output: any,\n context: __SerdeContext\n): DeleteIdentitiesResponse => {\n return {\n UnprocessedIdentityIds:\n output.UnprocessedIdentityIds !== undefined && output.UnprocessedIdentityIds !== null\n ? deserializeAws_json1_1UnprocessedIdentityIdList(output.UnprocessedIdentityIds, context)\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1DeveloperUserAlreadyRegisteredException = (\n output: any,\n context: __SerdeContext\n): DeveloperUserAlreadyRegisteredException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1DeveloperUserIdentifierList = (output: any, context: __SerdeContext): string[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst deserializeAws_json1_1ExternalServiceException = (\n output: any,\n context: __SerdeContext\n): ExternalServiceException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1GetCredentialsForIdentityResponse = (\n output: any,\n context: __SerdeContext\n): GetCredentialsForIdentityResponse => {\n return {\n Credentials:\n output.Credentials !== undefined && output.Credentials !== null\n ? deserializeAws_json1_1Credentials(output.Credentials, context)\n : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1GetIdentityPoolRolesResponse = (\n output: any,\n context: __SerdeContext\n): GetIdentityPoolRolesResponse => {\n return {\n IdentityPoolId:\n output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n RoleMappings:\n output.RoleMappings !== undefined && output.RoleMappings !== null\n ? deserializeAws_json1_1RoleMappingMap(output.RoleMappings, context)\n : undefined,\n Roles:\n output.Roles !== undefined && output.Roles !== null\n ? deserializeAws_json1_1RolesMap(output.Roles, context)\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1GetIdResponse = (output: any, context: __SerdeContext): GetIdResponse => {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1GetOpenIdTokenForDeveloperIdentityResponse = (\n output: any,\n context: __SerdeContext\n): GetOpenIdTokenForDeveloperIdentityResponse => {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n Token: output.Token !== undefined && output.Token !== null ? output.Token : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1GetOpenIdTokenResponse = (output: any, context: __SerdeContext): GetOpenIdTokenResponse => {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n Token: output.Token !== undefined && output.Token !== null ? output.Token : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1IdentitiesList = (output: any, context: __SerdeContext): IdentityDescription[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return deserializeAws_json1_1IdentityDescription(entry, context);\n });\n};\n\nconst deserializeAws_json1_1IdentityDescription = (output: any, context: __SerdeContext): IdentityDescription => {\n return {\n CreationDate:\n output.CreationDate !== undefined && output.CreationDate !== null\n ? new Date(Math.round(output.CreationDate * 1000))\n : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n LastModifiedDate:\n output.LastModifiedDate !== undefined && output.LastModifiedDate !== null\n ? new Date(Math.round(output.LastModifiedDate * 1000))\n : undefined,\n Logins:\n output.Logins !== undefined && output.Logins !== null\n ? deserializeAws_json1_1LoginsList(output.Logins, context)\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1IdentityPool = (output: any, context: __SerdeContext): IdentityPool => {\n return {\n AllowClassicFlow:\n output.AllowClassicFlow !== undefined && output.AllowClassicFlow !== null ? output.AllowClassicFlow : undefined,\n AllowUnauthenticatedIdentities:\n output.AllowUnauthenticatedIdentities !== undefined && output.AllowUnauthenticatedIdentities !== null\n ? output.AllowUnauthenticatedIdentities\n : undefined,\n CognitoIdentityProviders:\n output.CognitoIdentityProviders !== undefined && output.CognitoIdentityProviders !== null\n ? deserializeAws_json1_1CognitoIdentityProviderList(output.CognitoIdentityProviders, context)\n : undefined,\n DeveloperProviderName:\n output.DeveloperProviderName !== undefined && output.DeveloperProviderName !== null\n ? output.DeveloperProviderName\n : undefined,\n IdentityPoolId:\n output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n IdentityPoolName:\n output.IdentityPoolName !== undefined && output.IdentityPoolName !== null ? output.IdentityPoolName : undefined,\n IdentityPoolTags:\n output.IdentityPoolTags !== undefined && output.IdentityPoolTags !== null\n ? deserializeAws_json1_1IdentityPoolTagsType(output.IdentityPoolTags, context)\n : undefined,\n OpenIdConnectProviderARNs:\n output.OpenIdConnectProviderARNs !== undefined && output.OpenIdConnectProviderARNs !== null\n ? deserializeAws_json1_1OIDCProviderList(output.OpenIdConnectProviderARNs, context)\n : undefined,\n SamlProviderARNs:\n output.SamlProviderARNs !== undefined && output.SamlProviderARNs !== null\n ? deserializeAws_json1_1SAMLProviderList(output.SamlProviderARNs, context)\n : undefined,\n SupportedLoginProviders:\n output.SupportedLoginProviders !== undefined && output.SupportedLoginProviders !== null\n ? deserializeAws_json1_1IdentityProviders(output.SupportedLoginProviders, context)\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1IdentityPoolShortDescription = (\n output: any,\n context: __SerdeContext\n): IdentityPoolShortDescription => {\n return {\n IdentityPoolId:\n output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n IdentityPoolName:\n output.IdentityPoolName !== undefined && output.IdentityPoolName !== null ? output.IdentityPoolName : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1IdentityPoolsList = (\n output: any,\n context: __SerdeContext\n): IdentityPoolShortDescription[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return deserializeAws_json1_1IdentityPoolShortDescription(entry, context);\n });\n};\n\nconst deserializeAws_json1_1IdentityPoolTagsType = (\n output: any,\n context: __SerdeContext\n): { [key: string]: string } => {\n return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst deserializeAws_json1_1IdentityProviders = (output: any, context: __SerdeContext): { [key: string]: string } => {\n return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst deserializeAws_json1_1InternalErrorException = (output: any, context: __SerdeContext): InternalErrorException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1InvalidIdentityPoolConfigurationException = (\n output: any,\n context: __SerdeContext\n): InvalidIdentityPoolConfigurationException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1InvalidParameterException = (\n output: any,\n context: __SerdeContext\n): InvalidParameterException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1LimitExceededException = (output: any, context: __SerdeContext): LimitExceededException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1ListIdentitiesResponse = (output: any, context: __SerdeContext): ListIdentitiesResponse => {\n return {\n Identities:\n output.Identities !== undefined && output.Identities !== null\n ? deserializeAws_json1_1IdentitiesList(output.Identities, context)\n : undefined,\n IdentityPoolId:\n output.IdentityPoolId !== undefined && output.IdentityPoolId !== null ? output.IdentityPoolId : undefined,\n NextToken: output.NextToken !== undefined && output.NextToken !== null ? output.NextToken : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1ListIdentityPoolsResponse = (\n output: any,\n context: __SerdeContext\n): ListIdentityPoolsResponse => {\n return {\n IdentityPools:\n output.IdentityPools !== undefined && output.IdentityPools !== null\n ? deserializeAws_json1_1IdentityPoolsList(output.IdentityPools, context)\n : undefined,\n NextToken: output.NextToken !== undefined && output.NextToken !== null ? output.NextToken : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1ListTagsForResourceResponse = (\n output: any,\n context: __SerdeContext\n): ListTagsForResourceResponse => {\n return {\n Tags:\n output.Tags !== undefined && output.Tags !== null\n ? deserializeAws_json1_1IdentityPoolTagsType(output.Tags, context)\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1LoginsList = (output: any, context: __SerdeContext): string[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst deserializeAws_json1_1LookupDeveloperIdentityResponse = (\n output: any,\n context: __SerdeContext\n): LookupDeveloperIdentityResponse => {\n return {\n DeveloperUserIdentifierList:\n output.DeveloperUserIdentifierList !== undefined && output.DeveloperUserIdentifierList !== null\n ? deserializeAws_json1_1DeveloperUserIdentifierList(output.DeveloperUserIdentifierList, context)\n : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n NextToken: output.NextToken !== undefined && output.NextToken !== null ? output.NextToken : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1MappingRule = (output: any, context: __SerdeContext): MappingRule => {\n return {\n Claim: output.Claim !== undefined && output.Claim !== null ? output.Claim : undefined,\n MatchType: output.MatchType !== undefined && output.MatchType !== null ? output.MatchType : undefined,\n RoleARN: output.RoleARN !== undefined && output.RoleARN !== null ? output.RoleARN : undefined,\n Value: output.Value !== undefined && output.Value !== null ? output.Value : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1MappingRulesList = (output: any, context: __SerdeContext): MappingRule[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return deserializeAws_json1_1MappingRule(entry, context);\n });\n};\n\nconst deserializeAws_json1_1MergeDeveloperIdentitiesResponse = (\n output: any,\n context: __SerdeContext\n): MergeDeveloperIdentitiesResponse => {\n return {\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1NotAuthorizedException = (output: any, context: __SerdeContext): NotAuthorizedException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1OIDCProviderList = (output: any, context: __SerdeContext): string[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst deserializeAws_json1_1ResourceConflictException = (\n output: any,\n context: __SerdeContext\n): ResourceConflictException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1ResourceNotFoundException = (\n output: any,\n context: __SerdeContext\n): ResourceNotFoundException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1RoleMapping = (output: any, context: __SerdeContext): RoleMapping => {\n return {\n AmbiguousRoleResolution:\n output.AmbiguousRoleResolution !== undefined && output.AmbiguousRoleResolution !== null\n ? output.AmbiguousRoleResolution\n : undefined,\n RulesConfiguration:\n output.RulesConfiguration !== undefined && output.RulesConfiguration !== null\n ? deserializeAws_json1_1RulesConfigurationType(output.RulesConfiguration, context)\n : undefined,\n Type: output.Type !== undefined && output.Type !== null ? output.Type : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1RoleMappingMap = (output: any, context: __SerdeContext): { [key: string]: RoleMapping } => {\n return Object.entries(output).reduce((acc: { [key: string]: RoleMapping }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: deserializeAws_json1_1RoleMapping(value, context),\n };\n }, {});\n};\n\nconst deserializeAws_json1_1RolesMap = (output: any, context: __SerdeContext): { [key: string]: string } => {\n return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {\n if (value === null) {\n return acc;\n }\n return {\n ...acc,\n [key]: value,\n };\n }, {});\n};\n\nconst deserializeAws_json1_1RulesConfigurationType = (output: any, context: __SerdeContext): RulesConfigurationType => {\n return {\n Rules:\n output.Rules !== undefined && output.Rules !== null\n ? deserializeAws_json1_1MappingRulesList(output.Rules, context)\n : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1SAMLProviderList = (output: any, context: __SerdeContext): string[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return entry;\n });\n};\n\nconst deserializeAws_json1_1TagResourceResponse = (output: any, context: __SerdeContext): TagResourceResponse => {\n return {} as any;\n};\n\nconst deserializeAws_json1_1TooManyRequestsException = (\n output: any,\n context: __SerdeContext\n): TooManyRequestsException => {\n return {\n message: output.message !== undefined && output.message !== null ? output.message : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1UnprocessedIdentityId = (output: any, context: __SerdeContext): UnprocessedIdentityId => {\n return {\n ErrorCode: output.ErrorCode !== undefined && output.ErrorCode !== null ? output.ErrorCode : undefined,\n IdentityId: output.IdentityId !== undefined && output.IdentityId !== null ? output.IdentityId : undefined,\n } as any;\n};\n\nconst deserializeAws_json1_1UnprocessedIdentityIdList = (\n output: any,\n context: __SerdeContext\n): UnprocessedIdentityId[] => {\n return (output || [])\n .filter((e: any) => e != null)\n .map((entry: any) => {\n if (entry === null) {\n return null as any;\n }\n return deserializeAws_json1_1UnprocessedIdentityId(entry, context);\n });\n};\n\nconst deserializeAws_json1_1UntagResourceResponse = (output: any, context: __SerdeContext): UntagResourceResponse => {\n return {} as any;\n};\n\nconst deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({\n httpStatusCode: output.statusCode,\n requestId: output.headers[\"x-amzn-requestid\"] ?? output.headers[\"x-amzn-request-id\"],\n extendedRequestId: output.headers[\"x-amz-id-2\"],\n cfId: output.headers[\"x-amz-cf-id\"],\n});\n\n// Collect low-level response body stream to Uint8Array.\nconst collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise => {\n if (streamBody instanceof Uint8Array) {\n return Promise.resolve(streamBody);\n }\n return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());\n};\n\n// Encode Uint8Array data into string with utf-8.\nconst collectBodyString = (streamBody: any, context: __SerdeContext): Promise =>\n collectBody(streamBody, context).then((body) => context.utf8Encoder(body));\n\nconst buildHttpRpcRequest = async (\n context: __SerdeContext,\n headers: __HeaderBag,\n path: string,\n resolvedHostname: string | undefined,\n body: any\n): Promise<__HttpRequest> => {\n const { hostname, protocol = \"https\", port } = await context.endpoint();\n const contents: any = {\n protocol,\n hostname,\n port,\n method: \"POST\",\n path,\n headers,\n };\n if (resolvedHostname !== undefined) {\n contents.hostname = resolvedHostname;\n }\n if (body !== undefined) {\n contents.body = body;\n }\n return new __HttpRequest(contents);\n};\n\nconst parseBody = (streamBody: any, context: __SerdeContext): any =>\n collectBodyString(streamBody, context).then((encoded) => {\n if (encoded.length) {\n return JSON.parse(encoded);\n }\n return {};\n });\n\n/**\n * Load an error code for the aws.rest-json-1.1 protocol.\n */\nconst loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {\n const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());\n\n const sanitizeErrorCode = (rawValue: string): string => {\n let cleanValue = rawValue;\n if (cleanValue.indexOf(\":\") >= 0) {\n cleanValue = cleanValue.split(\":\")[0];\n }\n if (cleanValue.indexOf(\"#\") >= 0) {\n cleanValue = cleanValue.split(\"#\")[1];\n }\n return cleanValue;\n };\n\n const headerKey = findKey(output.headers, \"x-amzn-errortype\");\n if (headerKey !== undefined) {\n return sanitizeErrorCode(output.headers[headerKey]);\n }\n\n if (data.code !== undefined) {\n return sanitizeErrorCode(data.code);\n }\n\n if (data[\"__type\"] !== undefined) {\n return sanitizeErrorCode(data[\"__type\"]);\n }\n\n return \"\";\n};\n","import { CognitoIdentityClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from \"../CognitoIdentityClient\";\nimport { GetCredentialsForIdentityInput, GetCredentialsForIdentityResponse } from \"../models/models_0\";\nimport {\n deserializeAws_json1_1GetCredentialsForIdentityCommand,\n serializeAws_json1_1GetCredentialsForIdentityCommand,\n} from \"../protocols/Aws_json1_1\";\nimport { getSerdePlugin } from \"@aws-sdk/middleware-serde\";\nimport { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from \"@aws-sdk/protocol-http\";\nimport { Command as $Command } from \"@aws-sdk/smithy-client\";\nimport {\n FinalizeHandlerArguments,\n Handler,\n HandlerExecutionContext,\n MiddlewareStack,\n HttpHandlerOptions as __HttpHandlerOptions,\n MetadataBearer as __MetadataBearer,\n SerdeContext as __SerdeContext,\n} from \"@aws-sdk/types\";\n\nexport type GetCredentialsForIdentityCommandInput = GetCredentialsForIdentityInput;\nexport type GetCredentialsForIdentityCommandOutput = GetCredentialsForIdentityResponse & __MetadataBearer;\n\n/**\n * Returns credentials for the provided identity ID. Any provided logins will be\n * validated against supported login providers. If the token is for\n * cognito-identity.amazonaws.com, it will be passed through to AWS Security Token Service\n * with the appropriate role for the token.
\n * This is a public API. You do not need any credentials to call this API.
\n */\nexport class GetCredentialsForIdentityCommand extends $Command<\n GetCredentialsForIdentityCommandInput,\n GetCredentialsForIdentityCommandOutput,\n CognitoIdentityClientResolvedConfig\n> {\n // Start section: command_properties\n // End section: command_properties\n\n constructor(readonly input: GetCredentialsForIdentityCommandInput) {\n // Start section: command_constructor\n super();\n // End section: command_constructor\n }\n\n /**\n * @internal\n */\n resolveMiddleware(\n clientStack: MiddlewareStack,\n configuration: CognitoIdentityClientResolvedConfig,\n options?: __HttpHandlerOptions\n ): Handler {\n this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));\n\n const stack = clientStack.concat(this.middlewareStack);\n\n const { logger } = configuration;\n const clientName = \"CognitoIdentityClient\";\n const commandName = \"GetCredentialsForIdentityCommand\";\n const handlerExecutionContext: HandlerExecutionContext = {\n logger,\n clientName,\n commandName,\n inputFilterSensitiveLog: GetCredentialsForIdentityInput.filterSensitiveLog,\n outputFilterSensitiveLog: GetCredentialsForIdentityResponse.filterSensitiveLog,\n };\n const { requestHandler } = configuration;\n return stack.resolve(\n (request: FinalizeHandlerArguments) =>\n requestHandler.handle(request.request as __HttpRequest, options || {}),\n handlerExecutionContext\n );\n }\n\n private serialize(input: GetCredentialsForIdentityCommandInput, context: __SerdeContext): Promise<__HttpRequest> {\n return serializeAws_json1_1GetCredentialsForIdentityCommand(input, context);\n }\n\n private deserialize(\n output: __HttpResponse,\n context: __SerdeContext\n ): Promise {\n return deserializeAws_json1_1GetCredentialsForIdentityCommand(output, context);\n }\n\n // Start section: command_body_extra\n // End section: command_body_extra\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * An error representing a failure of an individual credential provider.\n *\n * This error class has special meaning to the {@link chain} method. If a\n * provider in the chain is rejected with an error, the chain will only proceed\n * to the next provider if the value of the `tryNextLink` property on the error\n * is truthy. This allows individual providers to halt the chain and also\n * ensures the chain will stop if an entirely unexpected error is encountered.\n */\nexport class ProviderError extends Error {\n constructor(message: string, public readonly tryNextLink: boolean = true) {\n super(message);\n }\n}\n","import { Logins, ResolvedLogins } from \"./Logins\";\n\n/**\n * @internal\n */\nexport function resolveLogins(logins: Logins): Promise {\n return Promise.all(\n Object.keys(logins).reduce((arr: Array<[string, string] | Promise<[string, string]>>, name: string) => {\n const tokenOrProvider = logins[name];\n if (typeof tokenOrProvider === \"string\") {\n arr.push([name, tokenOrProvider] as [string, string]);\n } else {\n arr.push(tokenOrProvider().then((token) => [name, token] as [string, string]));\n }\n return arr;\n }, [] as Array>)\n ).then((resolvedPairs) =>\n resolvedPairs.reduce((logins: ResolvedLogins, [key, value]) => {\n logins[key] = value;\n return logins;\n }, {} as ResolvedLogins)\n );\n}\n","import { GetCredentialsForIdentityCommand } from \"@aws-sdk/client-cognito-identity\";\nimport { ProviderError } from \"@aws-sdk/property-provider\";\nimport { CredentialProvider, Credentials } from \"@aws-sdk/types\";\n\nimport { CognitoProviderParameters } from \"./CognitoProviderParameters\";\nimport { resolveLogins } from \"./resolveLogins\";\n\nexport interface CognitoIdentityCredentials extends Credentials {\n /**\n * The Cognito ID returned by the last call to AWS.CognitoIdentity.getOpenIdToken().\n */\n identityId: string;\n}\n\n/**\n * Retrieves temporary AWS credentials using Amazon Cognito's\n * `GetCredentialsForIdentity` operation.\n *\n * Results from this function call are not cached internally.\n */\nexport function fromCognitoIdentity(parameters: FromCognitoIdentityParameters): CredentialProvider {\n return async (): Promise => {\n const {\n Credentials: {\n AccessKeyId = throwOnMissingAccessKeyId(),\n Expiration,\n SecretKey = throwOnMissingSecretKey(),\n SessionToken,\n } = throwOnMissingCredentials(),\n } = await parameters.client.send(\n new GetCredentialsForIdentityCommand({\n CustomRoleArn: parameters.customRoleArn,\n IdentityId: parameters.identityId,\n Logins: parameters.logins ? await resolveLogins(parameters.logins) : undefined,\n })\n );\n\n return {\n identityId: parameters.identityId,\n accessKeyId: AccessKeyId,\n secretAccessKey: SecretKey,\n sessionToken: SessionToken,\n expiration: Expiration,\n };\n };\n}\n\nexport interface FromCognitoIdentityParameters extends CognitoProviderParameters {\n /**\n * The unique identifier for the identity against which credentials will be\n * issued.\n */\n identityId: string;\n}\n\nfunction throwOnMissingAccessKeyId(): never {\n throw new ProviderError(\"Response from Amazon Cognito contained no access key ID\");\n}\n\nfunction throwOnMissingCredentials(): never {\n throw new ProviderError(\"Response from Amazon Cognito contained no credentials\");\n}\n\nfunction throwOnMissingSecretKey(): never {\n throw new ProviderError(\"Response from Amazon Cognito contained no secret key\");\n}\n","import { CognitoIdentityClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from \"../CognitoIdentityClient\";\nimport { GetIdInput, GetIdResponse } from \"../models/models_0\";\nimport { deserializeAws_json1_1GetIdCommand, serializeAws_json1_1GetIdCommand } from \"../protocols/Aws_json1_1\";\nimport { getSerdePlugin } from \"@aws-sdk/middleware-serde\";\nimport { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from \"@aws-sdk/protocol-http\";\nimport { Command as $Command } from \"@aws-sdk/smithy-client\";\nimport {\n FinalizeHandlerArguments,\n Handler,\n HandlerExecutionContext,\n MiddlewareStack,\n HttpHandlerOptions as __HttpHandlerOptions,\n MetadataBearer as __MetadataBearer,\n SerdeContext as __SerdeContext,\n} from \"@aws-sdk/types\";\n\nexport type GetIdCommandInput = GetIdInput;\nexport type GetIdCommandOutput = GetIdResponse & __MetadataBearer;\n\n/**\n * Generates (or retrieves) a Cognito ID. Supplying multiple logins will create an\n * implicit linked account.
\n * This is a public API. You do not need any credentials to call this API.
\n */\nexport class GetIdCommand extends $Command {\n // Start section: command_properties\n // End section: command_properties\n\n constructor(readonly input: GetIdCommandInput) {\n // Start section: command_constructor\n super();\n // End section: command_constructor\n }\n\n /**\n * @internal\n */\n resolveMiddleware(\n clientStack: MiddlewareStack,\n configuration: CognitoIdentityClientResolvedConfig,\n options?: __HttpHandlerOptions\n ): Handler {\n this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));\n\n const stack = clientStack.concat(this.middlewareStack);\n\n const { logger } = configuration;\n const clientName = \"CognitoIdentityClient\";\n const commandName = \"GetIdCommand\";\n const handlerExecutionContext: HandlerExecutionContext = {\n logger,\n clientName,\n commandName,\n inputFilterSensitiveLog: GetIdInput.filterSensitiveLog,\n outputFilterSensitiveLog: GetIdResponse.filterSensitiveLog,\n };\n const { requestHandler } = configuration;\n return stack.resolve(\n (request: FinalizeHandlerArguments) =>\n requestHandler.handle(request.request as __HttpRequest, options || {}),\n handlerExecutionContext\n );\n }\n\n private serialize(input: GetIdCommandInput, context: __SerdeContext): Promise<__HttpRequest> {\n return serializeAws_json1_1GetIdCommand(input, context);\n }\n\n private deserialize(output: __HttpResponse, context: __SerdeContext): Promise {\n return deserializeAws_json1_1GetIdCommand(output, context);\n }\n\n // Start section: command_body_extra\n // End section: command_body_extra\n}\n","import { Storage } from \"./Storage\";\n\nconst STORE_NAME = \"IdentityIds\";\n\nexport class IndexedDbStorage implements Storage {\n constructor(private readonly dbName: string = \"aws:cognito-identity-ids\") {}\n\n getItem(key: string): Promise {\n return this.withObjectStore(\"readonly\", (store) => {\n const req = store.get(key);\n\n return new Promise((resolve) => {\n req.onerror = () => resolve(null);\n\n req.onsuccess = () => resolve(req.result ? req.result.value : null);\n });\n }).catch(() => null);\n }\n\n removeItem(key: string): Promise {\n return this.withObjectStore(\"readwrite\", (store) => {\n const req = store.delete(key);\n\n return new Promise((resolve, reject) => {\n req.onerror = () => reject(req.error);\n\n req.onsuccess = () => resolve();\n });\n });\n }\n\n setItem(id: string, value: string): Promise {\n return this.withObjectStore(\"readwrite\", (store) => {\n const req = store.put({ id, value });\n\n return new Promise((resolve, reject) => {\n req.onerror = () => reject(req.error);\n\n req.onsuccess = () => resolve();\n });\n });\n }\n\n private getDb(): Promise {\n const openDbRequest = self.indexedDB.open(this.dbName, 1);\n return new Promise((resolve, reject) => {\n openDbRequest.onsuccess = () => {\n resolve(openDbRequest.result);\n };\n\n openDbRequest.onerror = () => {\n reject(openDbRequest.error);\n };\n\n openDbRequest.onblocked = () => {\n reject(new Error(\"Unable to access DB\"));\n };\n\n openDbRequest.onupgradeneeded = () => {\n const db = openDbRequest.result;\n db.onerror = () => {\n reject(new Error(\"Failed to create object store\"));\n };\n\n db.createObjectStore(STORE_NAME, { keyPath: \"id\" });\n };\n });\n }\n\n private withObjectStore(mode: IDBTransactionMode, action: (store: IDBObjectStore) => Promise