@@ -9,101 +9,7 @@ const app = express()
99// Initialize Salesforce SDK
1010const sdk = init ( ) ;
1111
12- // List of business name components for random generation
13- const businessTypes = [
1412 'Tech' , 'Global' , 'Advanced' , 'Innovative' , 'Strategic' , 'Premier' , 'Elite' ,
15- 'Dynamic' , 'Pacific' , 'Atlantic' , 'Modern' , 'Future' , 'Smart' , 'Connected' ,
16- 'Digital' , 'Quantum' , 'Unified' , 'Integrated' , 'Precision' , 'Summit'
17- ] ;
18-
19- const businessNames = [
20- 'Solutions' , 'Systems' , 'Enterprises' , 'Industries' , 'Dynamics' , 'Partners' ,
21- 'Networks' , 'Technologies' , 'Services' , 'Innovations' , 'Analytics' , 'Consulting' ,
22- 'Operations' , 'Group' , 'Corporation' , 'Associates' , 'International' , 'Management' ,
23- 'Ventures' , 'Labs'
24- ] ;
25-
26- const industries = [
27- 'Manufacturing' , 'Software' , 'Healthcare' , 'Logistics' , 'Energy' ,
28- 'Communications' , 'Engineering' , 'Research' , 'Development' , 'Robotics'
29- ] ;
30-
31- // Address components for random generation
32- const streetTypes = [
33- 'Street' , 'Avenue' , 'Boulevard' , 'Road' , 'Drive' , 'Lane' , 'Way' , 'Circle' ,
34- 'Court' , 'Place' , 'Square' , 'Terrace' , 'Parkway' , 'Plaza'
35- ] ;
36-
37- const streetNames = [
38- 'Maple' , 'Oak' , 'Cedar' , 'Pine' , 'Elm' , 'Washington' , 'Lincoln' , 'Park' ,
39- 'Lake' , 'River' , 'Mountain' , 'Valley' , 'Forest' , 'Meadow' , 'Spring' ,
40- 'Sunset' , 'Highland' , 'Madison' , 'Jefferson' , 'Franklin'
41- ] ;
42-
43- const cities = [
44- 'San Francisco' , 'New York' , 'Chicago' , 'Los Angeles' , 'Seattle' ,
45- 'Boston' , 'Austin' , 'Denver' , 'Miami' , 'Portland' , 'Atlanta' ,
46- 'Dallas' , 'Houston' , 'Phoenix' , 'Minneapolis'
47- ] ;
48-
49- const states = [
50- { name : 'California' , abbr : 'CA' } ,
51- { name : 'New York' , abbr : 'NY' } ,
52- { name : 'Texas' , abbr : 'TX' } ,
53- { name : 'Florida' , abbr : 'FL' } ,
54- { name : 'Illinois' , abbr : 'IL' } ,
55- { name : 'Washington' , abbr : 'WA' } ,
56- { name : 'Massachusetts' , abbr : 'MA' } ,
57- { name : 'Colorado' , abbr : 'CO' } ,
58- { name : 'Oregon' , abbr : 'OR' } ,
59- { name : 'Georgia' , abbr : 'GA' }
60- ] ;
61-
62- // Function to generate a random address
63- function generateAddress ( ) {
64- const streetNumber = Math . floor ( Math . random ( ) * 9900 ) + 100 ; // 100-9999
65- const streetName = streetNames [ Math . floor ( Math . random ( ) * streetNames . length ) ] ;
66- const streetType = streetTypes [ Math . floor ( Math . random ( ) * streetTypes . length ) ] ;
67- const city = cities [ Math . floor ( Math . random ( ) * cities . length ) ] ;
68- const state = states [ Math . floor ( Math . random ( ) * states . length ) ] ;
69- const zip = Math . floor ( Math . random ( ) * 90000 ) + 10000 ; // 10000-99999
70-
71- return {
72- street : `${ streetNumber } ${ streetName } ${ streetType } ` ,
73- city : city ,
74- state : state . name ,
75- stateAbbr : state . abbr ,
76- zip : zip . toString ( )
77- } ;
78- }
79-
80- // Function to generate a random business name
81- function generateBusinessName ( ) {
82- const type = businessTypes [ Math . floor ( Math . random ( ) * businessTypes . length ) ] ;
83- const name = businessNames [ Math . floor ( Math . random ( ) * businessNames . length ) ] ;
84- const industry = industries [ Math . floor ( Math . random ( ) * industries . length ) ] ;
85- const timestamp = Date . now ( ) . toString ( ) . slice ( - 4 ) ;
86- const randomSuffix = Math . random ( ) . toString ( 36 ) . substring ( 2 , 5 ) . toUpperCase ( ) ;
87-
88- // Always prefix with 'Bulk Account' but add random elements after
89- const formats = [
90- `Bulk Account ${ type } ${ name } ${ randomSuffix } ` ,
91- `Bulk Account ${ type } ${ industry } ${ randomSuffix } ` ,
92- `Bulk Account ${ industry } ${ name } ${ timestamp } ` ,
93- `Bulk Account ${ type } ${ name } ${ industry } ${ randomSuffix } `
94- ] ;
95-
96- const generatedName = formats [ Math . floor ( Math . random ( ) * formats . length ) ] ;
97-
98- // Ensure name doesn't exceed Salesforce's 255-character limit
99- if ( generatedName . length > 255 ) {
100- // If somehow too long, return a shorter format
101- return `Bulk Account ${ type } ${ randomSuffix } ` ;
102- }
103-
104- return generatedName ;
105- }
106-
10713// Get connection names from environment variable
10814const connectionNames = process . env . CONNECTION_NAMES ? process . env . CONNECTION_NAMES . split ( ',' ) : [ ]
10915
@@ -305,3 +211,98 @@ process.on('SIGTERM', async () => {
305211 } )
306212 }
307213} )
214+
215+ // List of business name components for random generation
216+ const businessTypes = [
217+ 'Tech' , 'Global' , 'Advanced' , 'Innovative' , 'Strategic' , 'Premier' , 'Elite' ,
218+ 'Dynamic' , 'Pacific' , 'Atlantic' , 'Modern' , 'Future' , 'Smart' , 'Connected' ,
219+ 'Digital' , 'Quantum' , 'Unified' , 'Integrated' , 'Precision' , 'Summit'
220+ ] ;
221+
222+ const businessNames = [
223+ 'Solutions' , 'Systems' , 'Enterprises' , 'Industries' , 'Dynamics' , 'Partners' ,
224+ 'Networks' , 'Technologies' , 'Services' , 'Innovations' , 'Analytics' , 'Consulting' ,
225+ 'Operations' , 'Group' , 'Corporation' , 'Associates' , 'International' , 'Management' ,
226+ 'Ventures' , 'Labs'
227+ ] ;
228+
229+ const industries = [
230+ 'Manufacturing' , 'Software' , 'Healthcare' , 'Logistics' , 'Energy' ,
231+ 'Communications' , 'Engineering' , 'Research' , 'Development' , 'Robotics'
232+ ] ;
233+
234+ // Address components for random generation
235+ const streetTypes = [
236+ 'Street' , 'Avenue' , 'Boulevard' , 'Road' , 'Drive' , 'Lane' , 'Way' , 'Circle' ,
237+ 'Court' , 'Place' , 'Square' , 'Terrace' , 'Parkway' , 'Plaza'
238+ ] ;
239+
240+ const streetNames = [
241+ 'Maple' , 'Oak' , 'Cedar' , 'Pine' , 'Elm' , 'Washington' , 'Lincoln' , 'Park' ,
242+ 'Lake' , 'River' , 'Mountain' , 'Valley' , 'Forest' , 'Meadow' , 'Spring' ,
243+ 'Sunset' , 'Highland' , 'Madison' , 'Jefferson' , 'Franklin'
244+ ] ;
245+
246+ const cities = [
247+ 'San Francisco' , 'New York' , 'Chicago' , 'Los Angeles' , 'Seattle' ,
248+ 'Boston' , 'Austin' , 'Denver' , 'Miami' , 'Portland' , 'Atlanta' ,
249+ 'Dallas' , 'Houston' , 'Phoenix' , 'Minneapolis'
250+ ] ;
251+
252+ const states = [
253+ { name : 'California' , abbr : 'CA' } ,
254+ { name : 'New York' , abbr : 'NY' } ,
255+ { name : 'Texas' , abbr : 'TX' } ,
256+ { name : 'Florida' , abbr : 'FL' } ,
257+ { name : 'Illinois' , abbr : 'IL' } ,
258+ { name : 'Washington' , abbr : 'WA' } ,
259+ { name : 'Massachusetts' , abbr : 'MA' } ,
260+ { name : 'Colorado' , abbr : 'CO' } ,
261+ { name : 'Oregon' , abbr : 'OR' } ,
262+ { name : 'Georgia' , abbr : 'GA' }
263+ ] ;
264+
265+ // Function to generate a random address
266+ function generateAddress ( ) {
267+ const streetNumber = Math . floor ( Math . random ( ) * 9900 ) + 100 ; // 100-9999
268+ const streetName = streetNames [ Math . floor ( Math . random ( ) * streetNames . length ) ] ;
269+ const streetType = streetTypes [ Math . floor ( Math . random ( ) * streetTypes . length ) ] ;
270+ const city = cities [ Math . floor ( Math . random ( ) * cities . length ) ] ;
271+ const state = states [ Math . floor ( Math . random ( ) * states . length ) ] ;
272+ const zip = Math . floor ( Math . random ( ) * 90000 ) + 10000 ; // 10000-99999
273+
274+ return {
275+ street : `${ streetNumber } ${ streetName } ${ streetType } ` ,
276+ city : city ,
277+ state : state . name ,
278+ stateAbbr : state . abbr ,
279+ zip : zip . toString ( )
280+ } ;
281+ }
282+
283+ // Function to generate a random business name
284+ function generateBusinessName ( ) {
285+ const type = businessTypes [ Math . floor ( Math . random ( ) * businessTypes . length ) ] ;
286+ const name = businessNames [ Math . floor ( Math . random ( ) * businessNames . length ) ] ;
287+ const industry = industries [ Math . floor ( Math . random ( ) * industries . length ) ] ;
288+ const timestamp = Date . now ( ) . toString ( ) . slice ( - 4 ) ;
289+ const randomSuffix = Math . random ( ) . toString ( 36 ) . substring ( 2 , 5 ) . toUpperCase ( ) ;
290+
291+ // Always prefix with 'Bulk Account' but add random elements after
292+ const formats = [
293+ `Bulk Account ${ type } ${ name } ${ randomSuffix } ` ,
294+ `Bulk Account ${ type } ${ industry } ${ randomSuffix } ` ,
295+ `Bulk Account ${ industry } ${ name } ${ timestamp } ` ,
296+ `Bulk Account ${ type } ${ name } ${ industry } ${ randomSuffix } `
297+ ] ;
298+
299+ const generatedName = formats [ Math . floor ( Math . random ( ) * formats . length ) ] ;
300+
301+ // Ensure name doesn't exceed Salesforce's 255-character limit
302+ if ( generatedName . length > 255 ) {
303+ // If somehow too long, return a shorter format
304+ return `Bulk Account ${ type } ${ randomSuffix } ` ;
305+ }
306+
307+ return generatedName ;
308+ }
0 commit comments