@dishantlangayan/sc-cli-core 0.5.0 → 0.5.2

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.
@@ -45,17 +45,21 @@ export class OrgManager {
45
45
  this.ensureInitialized();
46
46
  // Validate organization
47
47
  this.validateOrg(org);
48
- // Check if organization already exists (by orgId or alias)
49
- const existingByOrgId = this.storage.orgs.find((o) => o.orgId === org.orgId);
50
- if (existingByOrgId) {
51
- throw new OrgError(`Organization '${org.orgId}' already exists`, OrgErrorCode.ORG_ALREADY_EXISTS);
52
- }
48
+ // Check if alias already exists (aliases must be globally unique)
53
49
  if (org.alias) {
54
50
  const existingByAlias = this.storage.orgs.find((o) => o.alias === org.alias);
55
51
  if (existingByAlias) {
56
52
  throw new OrgError(`Organization with alias '${org.alias}' already exists`, OrgErrorCode.ORG_ALREADY_EXISTS);
57
53
  }
58
54
  }
55
+ // If no alias provided, check if orgId already exists (maintain current behavior)
56
+ // If alias is provided, allow multiple tokens for the same orgId with different aliases
57
+ if (!org.alias) {
58
+ const existingByOrgId = this.storage.orgs.find((o) => o.orgId === org.orgId);
59
+ if (existingByOrgId) {
60
+ throw new OrgError(`Organization '${org.orgId}' already exists`, OrgErrorCode.ORG_ALREADY_EXISTS);
61
+ }
62
+ }
59
63
  // If this org is being set as default, unset any existing default
60
64
  if (org.isDefault) {
61
65
  this.unsetAllDefaults();
package/lib/sc-command.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
2
  import { BrokerAuthManager } from './auth/auth-manager.js';
3
3
  import { OrgManager } from './auth/org-manager.js';
4
- import { DefaultBaseUrl, EnvironmentVariable, envVars } from './config/env-vars.js';
5
4
  /**
6
5
  * A base command that provided common functionality for all sc commands.
7
6
  *
@@ -66,15 +65,5 @@ export class ScCommand extends Command {
66
65
  });
67
66
  this.flags = flags;
68
67
  this.args = args;
69
- // set base url if not defined in environment variables
70
- if (!envVars.getString(EnvironmentVariable.SC_BASE_URL)) {
71
- this.debug(`Environment variable '${EnvironmentVariable.SC_BASE_URL}' not set, using default '${DefaultBaseUrl}'`);
72
- envVars.setString(EnvironmentVariable.SC_BASE_URL, DefaultBaseUrl);
73
- }
74
- // Check if Access Token is set
75
- const value = envVars.getString(EnvironmentVariable.SC_ACCESS_TOKEN);
76
- if (!value) {
77
- this.error(`Environment variable ${EnvironmentVariable.SC_ACCESS_TOKEN} is not set and required for any API operations.`);
78
- }
79
68
  }
80
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dishantlangayan/sc-cli-core",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Base library for the Solace Cloud CLI and plugins",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Dishant Langayan",