@dataformer/env-service 2.4.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dataformer/env-service
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - change setSearchEngineId method to setCustomSearchEngineId
8
+
3
9
  ## 2.4.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ declare const askQuestion: (question: string, defaultValue?: string) => Promise<
2
2
  declare function obfuscateCred(cred: string | null): string;
3
3
  declare function getEnvVar(baseSecretKey: string): Promise<string | null>;
4
4
  declare function getCustomSearchApiKey(): Promise<string>;
5
- declare function getSearchEngineId(): Promise<string>;
5
+ declare function getCustomSearchEngineId(): Promise<string>;
6
6
  declare function getGcpProjectId(): Promise<string>;
7
7
  declare function setEnvVar(baseSecretKey: string, value: string): Promise<boolean>;
8
8
  declare const setLogToConsole: () => Promise<void>;
@@ -23,6 +23,7 @@ declare const setJiraUserEmail: () => Promise<void>;
23
23
  declare const setGeminiApiKey: () => Promise<void>;
24
24
  declare const setNpmToken: () => Promise<void>;
25
25
  declare const setCustomSearchApiKey: () => Promise<void>;
26
+ declare const setCustomSearchEngineId: () => Promise<void>;
26
27
  declare const setFirestoreProjectId: () => Promise<void>;
27
28
  declare const getLogToConsole: () => Promise<string | null>;
28
29
  declare const getPostgresUser: () => Promise<string | null>;
@@ -46,4 +47,4 @@ declare const getProjectRoot: () => string;
46
47
  declare const printEnv: () => Promise<void>;
47
48
  declare const run: () => Promise<void>;
48
49
 
49
- export { askQuestion, getBigtableInstanceName, getBigtableProjectId, getBigtableTableName, getCustomSearchApiKey, getEnvVar, getFirestoreProjectId, getGcpProjectId, getGeminiApiKey, getJiraApiBaseUrl, getJiraApiToken, getJiraUserEmail, getLogToConsole, getNpmToken, getPostgresAuthType, getPostgresDatabase, getPostgresHostName, getPostgresInstanceConnectionName, getPostgresIpType, getPostgresPassword, getPostgresPoolSizeMax, getPostgresUser, getProjectRoot, getSearchEngineId, obfuscateCred, printEnv, run, setBigtableInstanceName, setBigtableProjectId, setBigtableTableName, setCustomSearchApiKey, setEnvVar, setFirestoreProjectId, setGeminiApiKey, setJiraApiBaseUrl, setJiraApiToken, setJiraUserEmail, setLogToConsole, setNpmToken, setPostgresAuthType, setPostgresDatabase, setPostgresHostName, setPostgresInstanceConnectionName, setPostgresIpType, setPostgresPassword, setPostgresPoolSizeMax, setPostgresUser };
50
+ export { askQuestion, getBigtableInstanceName, getBigtableProjectId, getBigtableTableName, getCustomSearchApiKey, getCustomSearchEngineId, getEnvVar, getFirestoreProjectId, getGcpProjectId, getGeminiApiKey, getJiraApiBaseUrl, getJiraApiToken, getJiraUserEmail, getLogToConsole, getNpmToken, getPostgresAuthType, getPostgresDatabase, getPostgresHostName, getPostgresInstanceConnectionName, getPostgresIpType, getPostgresPassword, getPostgresPoolSizeMax, getPostgresUser, getProjectRoot, obfuscateCred, printEnv, run, setBigtableInstanceName, setBigtableProjectId, setBigtableTableName, setCustomSearchApiKey, setCustomSearchEngineId, setEnvVar, setFirestoreProjectId, setGeminiApiKey, setJiraApiBaseUrl, setJiraApiToken, setJiraUserEmail, setLogToConsole, setNpmToken, setPostgresAuthType, setPostgresDatabase, setPostgresHostName, setPostgresInstanceConnectionName, setPostgresIpType, setPostgresPassword, setPostgresPoolSizeMax, setPostgresUser };
package/dist/index.js CHANGED
@@ -104,10 +104,10 @@ async function getCustomSearchApiKey() {
104
104
  }
105
105
  return apiKey;
106
106
  }
107
- async function getSearchEngineId() {
108
- const searchEngineId = await getEnvVar("SEARCH_ENGINE_ID");
107
+ async function getCustomSearchEngineId() {
108
+ const searchEngineId = await getEnvVar("CUSTOM_SEARCH_ENGINE_ID");
109
109
  if (!searchEngineId) {
110
- throw new Error("SEARCH_ENGINE_ID not found in environment variables.");
110
+ throw new Error("CUSTOM_SEARCH_ENGINE_ID not found in environment variables.");
111
111
  }
112
112
  return searchEngineId;
113
113
  }
@@ -285,6 +285,12 @@ var setCustomSearchApiKey = async () => {
285
285
  await setEnvVar("CUSTOM_SEARCH_API_KEY", customSearchApiKey);
286
286
  }
287
287
  };
288
+ var setCustomSearchEngineId = async () => {
289
+ const customSearchEngineId = await askQuestion("Enter Custom Search Engine ID", "");
290
+ if (customSearchEngineId) {
291
+ await setEnvVar("CUSTOM_SEARCH_ENGINE_ID", customSearchEngineId);
292
+ }
293
+ };
288
294
  var setFirestoreProjectId = async () => {
289
295
  const firestoreProjectId = await askQuestion("Enter Firestore Project ID", "dataformer-prod");
290
296
  if (firestoreProjectId) {
@@ -336,6 +342,7 @@ var printEnv = async () => {
336
342
  const jiraUserEmail = await getJiraUserEmail();
337
343
  const geminiApiKey = await getGeminiApiKey();
338
344
  const customSearchApiKey = await getCustomSearchApiKey();
345
+ const customSearchEngineId = await getCustomSearchEngineId();
339
346
  const gcpProjectIdVal = await getGcpProjectId();
340
347
  const npmToken = await getNpmToken();
341
348
  console.log(`Project Root: ${getProjectRoot()}`);
@@ -357,6 +364,7 @@ var printEnv = async () => {
357
364
  console.log(`Jira API Base URL: ${jiraApiBaseUrl}`);
358
365
  console.log(`Jira User Email: ${jiraUserEmail}`);
359
366
  console.log(`Custom Search API Key: ${obfuscateCred(customSearchApiKey)}`);
367
+ console.log(`Custom Search Engine ID: ${customSearchEngineId}`);
360
368
  console.log(`Gemini API Key: ${obfuscateCred(geminiApiKey)}`);
361
369
  console.log(`NPM Token: ${obfuscateCred(npmToken)}`);
362
370
  };
@@ -420,6 +428,9 @@ var run = async () => {
420
428
  case "setCustomSearchApiKey":
421
429
  await setCustomSearchApiKey();
422
430
  break;
431
+ case "setCustomSearchEngineId":
432
+ await setCustomSearchEngineId();
433
+ break;
423
434
  case "printEnv":
424
435
  await printEnv();
425
436
  break;
@@ -441,6 +452,7 @@ export {
441
452
  getBigtableProjectId,
442
453
  getBigtableTableName,
443
454
  getCustomSearchApiKey,
455
+ getCustomSearchEngineId,
444
456
  getEnvVar,
445
457
  getFirestoreProjectId,
446
458
  getGcpProjectId,
@@ -459,7 +471,6 @@ export {
459
471
  getPostgresPoolSizeMax,
460
472
  getPostgresUser,
461
473
  getProjectRoot,
462
- getSearchEngineId,
463
474
  obfuscateCred,
464
475
  printEnv,
465
476
  run,
@@ -467,6 +478,7 @@ export {
467
478
  setBigtableProjectId,
468
479
  setBigtableTableName,
469
480
  setCustomSearchApiKey,
481
+ setCustomSearchEngineId,
470
482
  setEnvVar,
471
483
  setFirestoreProjectId,
472
484
  setGeminiApiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataformer/env-service",
3
- "version": "2.4.0",
3
+ "version": "3.0.0",
4
4
  "description": "Environment service for Dataformer",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -174,10 +174,10 @@ export async function getCustomSearchApiKey(): Promise<string> {
174
174
  return apiKey;
175
175
  }
176
176
 
177
- export async function getSearchEngineId(): Promise<string> {
178
- const searchEngineId = await getEnvVar('SEARCH_ENGINE_ID');
177
+ export async function getCustomSearchEngineId(): Promise<string> {
178
+ const searchEngineId = await getEnvVar('CUSTOM_SEARCH_ENGINE_ID');
179
179
  if (!searchEngineId) {
180
- throw new Error('SEARCH_ENGINE_ID not found in environment variables.');
180
+ throw new Error('CUSTOM_SEARCH_ENGINE_ID not found in environment variables.');
181
181
  }
182
182
  return searchEngineId;
183
183
  }
@@ -391,6 +391,13 @@ const setCustomSearchApiKey = async (): Promise<void> => {
391
391
  }
392
392
  };
393
393
 
394
+ const setCustomSearchEngineId = async (): Promise<void> => {
395
+ const customSearchEngineId = await askQuestion('Enter Custom Search Engine ID', '');
396
+ if (customSearchEngineId) {
397
+ await setEnvVar('CUSTOM_SEARCH_ENGINE_ID', customSearchEngineId);
398
+ }
399
+ };
400
+
394
401
  const setFirestoreProjectId = async (): Promise<void> => {
395
402
  const firestoreProjectId = await askQuestion('Enter Firestore Project ID', 'dataformer-prod');
396
403
  if (firestoreProjectId) {
@@ -459,6 +466,7 @@ const printEnv = async (): Promise<void> => {
459
466
  const jiraUserEmail = await getJiraUserEmail();
460
467
  const geminiApiKey = await getGeminiApiKey();
461
468
  const customSearchApiKey = await getCustomSearchApiKey();
469
+ const customSearchEngineId = await getCustomSearchEngineId();
462
470
  const gcpProjectIdVal = await getGcpProjectId();
463
471
  const npmToken = await getNpmToken();
464
472
 
@@ -481,6 +489,7 @@ const printEnv = async (): Promise<void> => {
481
489
  console.log(`Jira API Base URL: ${jiraApiBaseUrl}`);
482
490
  console.log(`Jira User Email: ${jiraUserEmail}`);
483
491
  console.log(`Custom Search API Key: ${obfuscateCred(customSearchApiKey)}`);
492
+ console.log(`Custom Search Engine ID: ${customSearchEngineId}`);
484
493
  console.log(`Gemini API Key: ${obfuscateCred(geminiApiKey)}`);
485
494
  console.log(`NPM Token: ${obfuscateCred(npmToken)}`);
486
495
  };
@@ -507,6 +516,7 @@ const run = async (): Promise<void> => {
507
516
  case 'setGeminiApiKey': await setGeminiApiKey(); break;
508
517
  case 'setNpmToken': await setNpmToken(); break;
509
518
  case 'setCustomSearchApiKey': await setCustomSearchApiKey(); break;
519
+ case 'setCustomSearchEngineId': await setCustomSearchEngineId(); break;
510
520
  case 'printEnv': await printEnv(); break;
511
521
  default: console.log('Unknown command. Available commands: setEnv, setBearerToken, ..., printEnv');
512
522
  }
@@ -548,6 +558,7 @@ export {
548
558
  setGeminiApiKey,
549
559
  setNpmToken,
550
560
  setCustomSearchApiKey,
561
+ setCustomSearchEngineId,
551
562
 
552
563
  // Getters
553
564
  getLogToConsole,