@hyperdrive.bot/cli 1.0.11 → 1.0.13

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.
@@ -75,6 +75,8 @@ export class TenantService {
75
75
  // Fallback: construct from tenant ID
76
76
  cognitoDomain = `${bootstrap.tenantId}.auth.${region}.amazoncognito.com`;
77
77
  }
78
+ // Extract all additional API URLs from bootstrap (services self-serve by key)
79
+ const additionalApiUrls = this.extractAdditionalApiUrls(bootstrap.amplifyConfig.API);
78
80
  const config = {
79
81
  apiUrl: this.getApiUrl(region, bootstrap.amplifyConfig.API, domain),
80
82
  cognitoClientId: Cognito.userPoolClientId,
@@ -85,8 +87,7 @@ export class TenantService {
85
87
  region,
86
88
  tenantDomain: domain,
87
89
  tenantId: bootstrap.tenantId,
88
- projectsApiUrl: this.getProjectsApiUrl(bootstrap.amplifyConfig.API),
89
- userGroupsApiUrl: this.getUserGroupsApiUrl(bootstrap.amplifyConfig.API),
90
+ additionalApiUrls: Object.keys(additionalApiUrls).length > 0 ? additionalApiUrls : undefined,
90
91
  };
91
92
  // Cache the tenant domain for future use
92
93
  this.saveTenantDomainToConfig(domain);
@@ -315,27 +316,22 @@ export class TenantService {
315
316
  chalk.gray('Please contact your administrator to enable the Hyperdrive module.'));
316
317
  }
317
318
  /**
318
- * Get Projects API URL from bootstrap config (hyperdrive-projects module)
319
- * Returns undefined if not available (optional module)
319
+ * Extract all additional API URLs from bootstrap REST config.
320
+ * Returns a map of module name → endpoint URL for every REST API
321
+ * beyond the primary 'hyperdrive' endpoint. Services self-serve
322
+ * by looking up the key they need (e.g., 'hyperdrive-projects', 'user-groups').
320
323
  */
321
- getProjectsApiUrl(apiConfig) {
322
- if (apiConfig?.REST?.['hyperdrive-projects']?.endpoint) {
323
- console.log(chalk.gray(`✓ Using hyperdrive-projects API endpoint from bootstrap: ${apiConfig.REST['hyperdrive-projects'].endpoint}`));
324
- return apiConfig.REST['hyperdrive-projects'].endpoint;
325
- }
326
- return undefined;
327
- }
328
- /**
329
- * Get User Groups API URL from bootstrap config
330
- * Returns undefined if not available (optional module)
331
- */
332
- getUserGroupsApiUrl(apiConfig) {
333
- // Check for user-groups endpoint in bootstrap
334
- if (apiConfig?.REST?.['user-groups']?.endpoint) {
335
- console.log(chalk.gray(`✓ Using user-groups API endpoint from bootstrap: ${apiConfig.REST['user-groups'].endpoint}`));
336
- return apiConfig.REST['user-groups'].endpoint;
324
+ extractAdditionalApiUrls(apiConfig) {
325
+ const urls = {};
326
+ if (!apiConfig?.REST)
327
+ return urls;
328
+ for (const [apiName, config] of Object.entries(apiConfig.REST)) {
329
+ if (apiName !== 'hyperdrive' && config.endpoint) {
330
+ console.log(chalk.gray(`✓ Discovered API endpoint: ${apiName} → ${config.endpoint}`));
331
+ urls[apiName] = config.endpoint;
332
+ }
337
333
  }
338
- return undefined;
334
+ return urls;
339
335
  }
340
336
  /**
341
337
  * Get bootstrap URL with fallback chain:
@@ -48,15 +48,14 @@ export interface CognitoConfig {
48
48
  * Complete stored credentials including tokens and AWS credentials
49
49
  */
50
50
  export interface StoredCredentials extends CognitoTokens {
51
+ additionalApiUrls?: Record<string, string>;
51
52
  apiUrl: string;
52
53
  awsCredentials: AWSCredentials;
53
54
  cognitoConfig: CognitoConfig;
54
55
  obtainedAt: string;
55
- projectsApiUrl?: string;
56
56
  region: string;
57
57
  tenantDomain: string;
58
58
  tenantId: string;
59
- userGroupsApiUrl?: string;
60
59
  }
61
60
  /**
62
61
  * Generate PKCE code verifier (random base64url string)
@@ -321,6 +321,7 @@ export async function executeAuthFlow(options) {
321
321
  // Step 8: Save credentials
322
322
  saveCredentials({
323
323
  ...tokens,
324
+ additionalApiUrls: tenantConfig.additionalApiUrls,
324
325
  apiUrl: tenantConfig.apiUrl,
325
326
  awsCredentials,
326
327
  cognitoConfig: {
@@ -330,11 +331,9 @@ export async function executeAuthFlow(options) {
330
331
  userPoolId: tenantConfig.cognitoUserPoolId,
331
332
  },
332
333
  obtainedAt: new Date().toISOString(),
333
- projectsApiUrl: tenantConfig.projectsApiUrl,
334
334
  region: tenantConfig.region,
335
335
  tenantDomain: tenantConfig.tenantDomain,
336
336
  tenantId: tenantConfig.tenantId,
337
- userGroupsApiUrl: tenantConfig.userGroupsApiUrl,
338
337
  }, tenantConfig.tenantDomain);
339
338
  return { success: true };
340
339
  }
@@ -406,6 +405,7 @@ export async function executeCIAuthFlow(options) {
406
405
  logger('Saving credentials...');
407
406
  saveCredentials({
408
407
  access_token: authResult.AccessToken || '',
408
+ additionalApiUrls: tenantConfig.additionalApiUrls,
409
409
  apiUrl: tenantConfig.apiUrl,
410
410
  awsCredentials,
411
411
  cognitoConfig: {
@@ -417,13 +417,11 @@ export async function executeCIAuthFlow(options) {
417
417
  expires_in: authResult.ExpiresIn || 3600,
418
418
  id_token: authResult.IdToken,
419
419
  obtainedAt: new Date().toISOString(),
420
- projectsApiUrl: tenantConfig.projectsApiUrl,
421
420
  refresh_token: authResult.RefreshToken || '',
422
421
  region: tenantConfig.region,
423
422
  tenantDomain: tenantConfig.tenantDomain,
424
423
  tenantId: tenantConfig.tenantId,
425
424
  token_type: authResult.TokenType || 'Bearer',
426
- userGroupsApiUrl: tenantConfig.userGroupsApiUrl,
427
425
  }, tenantConfig.tenantDomain);
428
426
  return { success: true };
429
427
  }
@@ -554,7 +554,7 @@
554
554
  "description": "The name of the deployment",
555
555
  "name": "name",
556
556
  "required": false,
557
- "default": "Deployment-2026-02-08-14-37-25",
557
+ "default": "Deployment-2026-02-09-20-44-58",
558
558
  "hasDynamicHelp": false,
559
559
  "multiple": false,
560
560
  "type": "option"
@@ -3515,5 +3515,5 @@
3515
3515
  ]
3516
3516
  }
3517
3517
  },
3518
- "version": "1.0.11"
3518
+ "version": "1.0.13"
3519
3519
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hyperdrive.bot/cli",
3
3
  "description": "hyperdrive.bot is a command-line interface (CLI) tool designed for managing and deploying projects using the Hyperdrive API. The CLI acts as a proxy to the Hyperdrive API, enabling users to:",
4
- "version": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "author": "marcelomarra",
6
6
  "bin": {
7
7
  "hd": "./bin/run.js",