aws-sdk-js-codemod
Version:
Collection of codemod scripts that help update AWS SDK for JavaScript APIs
19 lines (18 loc) • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClientIdentifiers = void 0;
const getClientIdNamesFromNewExpr_1 = require("./getClientIdNamesFromNewExpr");
const getClientIdNamesFromTSTypeRef_1 = require("./getClientIdNamesFromTSTypeRef");
const getClientIdThisExpressions_1 = require("./getClientIdThisExpressions");
const getClientIdentifiers = (j, source, options) => {
const namesFromNewExpr = (0, getClientIdNamesFromNewExpr_1.getClientIdNamesFromNewExpr)(j, source, options);
const namesFromTSTypeRef = (0, getClientIdNamesFromTSTypeRef_1.getClientIdNamesFromTSTypeRef)(j, source, options);
const clientIdNames = [...new Set([...namesFromNewExpr, ...namesFromTSTypeRef])];
const clientIdentifiers = clientIdNames.map((clientidName) => ({
type: "Identifier",
name: clientidName,
}));
const clientIdThisExpressions = (0, getClientIdThisExpressions_1.getClientIdThisExpressions)(j, source, clientIdentifiers);
return [...clientIdentifiers, ...clientIdThisExpressions];
};
exports.getClientIdentifiers = getClientIdentifiers;