UNPKG

aws-sdk-js-codemod

Version:

Collection of codemod scripts that help update AWS SDK for JavaScript APIs

21 lines (20 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getV3ClientType = void 0; const config_1 = require("../config"); const CLIENT_REQ_RESP_TYPES_MAP_1 = require("../config/CLIENT_REQ_RESP_TYPES_MAP"); const getTypeForString_1 = require("./getTypeForString"); const getV3ClientType = (j, options) => { const { v2ClientName, v2ClientLocalName, v2ClientTypeName } = options; const clientReqRespTypesMap = CLIENT_REQ_RESP_TYPES_MAP_1.CLIENT_REQ_RESP_TYPES_MAP[v2ClientName]; if (Object.keys(clientReqRespTypesMap).includes(v2ClientTypeName)) { const v3ClientTypeName = clientReqRespTypesMap[v2ClientTypeName]; return j.tsTypeReference(j.identifier(v3ClientTypeName)); } const clientTypesMap = config_1.CLIENT_TYPES_MAP[v2ClientName]; if (Object.keys(clientTypesMap).includes(v2ClientTypeName)) { return (0, getTypeForString_1.getTypeForString)(j, v2ClientLocalName, clientTypesMap[v2ClientTypeName]); } return j.tsTypeReference(j.identifier(v2ClientTypeName)); }; exports.getV3ClientType = getV3ClientType;