@@ -2,71 +2,19 @@ import AWS, { ConfigurationOptions } from 'aws-sdk'
22import { APIVersions } from 'aws-sdk/lib/config'
33import CloudGraph , { Opts } from '@cloudgraph/sdk'
44import STS from 'aws-sdk/clients/sts'
5- import camelCase from 'lodash/camelCase'
65import isEmpty from 'lodash/isEmpty'
76import isEqual from 'lodash/isEqual'
87import unionWith from 'lodash/unionWith'
8+
99import environment from '../config/environment'
1010import { Credentials } from '../types'
1111import {
1212 BASE_CUSTOM_RETRY_DELAY ,
1313 MAX_FAILED_AWS_REQUEST_RETRIES ,
1414} from '../config/constants'
15- import relations from '../enums/relations'
16-
17-
1815
1916const { logger } = CloudGraph
2017
21- export const toCamel = ( o : any ) : any => {
22- let origKey
23- let newKey
24- let value
25-
26- if ( o instanceof Array ) {
27- return o . map ( value => {
28- if ( typeof value === 'object' ) {
29- value = toCamel ( value )
30- }
31- return value
32- } )
33- }
34-
35- const newObject = { }
36- for ( origKey in o ) {
37- if ( o . hasOwnProperty ( origKey ) ) {
38- newKey = camelCase ( origKey )
39- value = o [ origKey ]
40- if (
41- value instanceof Array ||
42- ( value !== null && value !== undefined && value . constructor === Object )
43- ) {
44- value = toCamel ( value )
45- }
46- newObject [ newKey ] = value
47- }
48- }
49-
50- return newObject
51- }
52-
53- export const getKeyByValue = (
54- object : Record < string , unknown > ,
55- value : any
56- ) : string | undefined => {
57- return Object . keys ( object ) . find ( key => object [ key ] === value )
58- }
59-
60- export const intersectStringArrays = (
61- a : Array < string > ,
62- b : Array < string >
63- ) : Array < string > => {
64- const setA = new Set ( a )
65- const setB = new Set ( b )
66- const intersection = new Set ( [ ...setA ] . filter ( x => setB . has ( x ) ) )
67- return Array . from ( intersection )
68- }
69-
7018export async function getAccountId ( {
7119 credentials,
7220} : // opts,
@@ -160,21 +108,6 @@ export const settleAllPromises = async (
160108 i => ( i as PromiseFulfilledResult < any > ) . value
161109 )
162110
163- /**
164- * Sorts a services list depending on his dependencies
165- * @param resourceNames services to sort
166- * @returns sorted list of services
167- */
168- export const sortResourcesDependencies = ( resourceNames : string [ ] ) : string [ ] =>
169- resourceNames . sort ( ( prevResource , nextResource ) => {
170- const dependecies = relations [ prevResource ]
171-
172- if ( dependecies && dependecies . includes ( nextResource ) ) {
173- return - 1
174- }
175- return 0
176- } )
177-
178111export const checkAndMergeConnections = (
179112 serviceConnections : any ,
180113 connectionsToMerge : any
0 commit comments