@atlashub/smartstack-cli 1.20.0 → 1.21.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/dist/index.js CHANGED
@@ -115807,11 +115807,7 @@ EndGlobal
115807
115807
  );
115808
115808
  }
115809
115809
  logger.info("Installing NuGet packages...");
115810
- const dbPackage = {
115811
- sqlserver: "Microsoft.EntityFrameworkCore.SqlServer",
115812
- postgresql: "Npgsql.EntityFrameworkCore.PostgreSQL",
115813
- sqlite: "Microsoft.EntityFrameworkCore.Sqlite"
115814
- }[config.database];
115810
+ const dbPackage = "Microsoft.EntityFrameworkCore.SqlServer";
115815
115811
  const nugetPackages = [
115816
115812
  {
115817
115813
  project: `${projectName}.Domain`,
@@ -115924,11 +115920,7 @@ async function createConfigFiles(config, dryRun) {
115924
115920
  </Project>
115925
115921
  `;
115926
115922
  await import_fs_extra3.default.writeFile((0, import_path4.join)(projectDir, "Directory.Build.props"), buildProps);
115927
- const connectionString = {
115928
- sqlserver: `Server=(local);Database=${projectName};Integrated Security=true;TrustServerCertificate=true;Connection Timeout=60;Pooling=true;Min Pool Size=0;Max Pool Size=50;Load Balance Timeout=30`,
115929
- postgresql: `Host=localhost;Database=${projectName.toLowerCase()};Username=postgres;Password=postgres;Pooling=true;Minimum Pool Size=0;Maximum Pool Size=50`,
115930
- sqlite: `Data Source=${projectName.toLowerCase()}.db`
115931
- }[config.database];
115923
+ const connectionString = `Server=(local);Database=${projectName};Integrated Security=true;TrustServerCertificate=true;Connection Timeout=60;Pooling=true;Min Pool Size=0;Max Pool Size=50;Load Balance Timeout=30`;
115932
115924
  const appSettings = {
115933
115925
  ConnectionStrings: {
115934
115926
  DefaultConnection: connectionString
@@ -116068,6 +116060,13 @@ async function createConfigFiles(config, dryRun) {
116068
116060
  DefaultConflictResolution: "ManualReview",
116069
116061
  AutoCreateReferences: true
116070
116062
  },
116063
+ MultiTenant: {
116064
+ Enabled: config.multiTenant.enabled,
116065
+ EnableB2C: config.multiTenant.enableB2C,
116066
+ SystemTenantSlug: config.multiTenant.systemTenantSlug,
116067
+ SystemTenantName: config.multiTenant.systemTenantName,
116068
+ AutoAssignUsersToSystemTenant: config.multiTenant.autoAssignUsersToSystemTenant
116069
+ },
116071
116070
  AllowedHosts: "*"
116072
116071
  };
116073
116072
  await import_fs_extra3.default.writeFile(
@@ -116641,7 +116640,7 @@ async function initializeGit(config, dryRun) {
116641
116640
  execCommand("git add .", projectDir, dryRun);
116642
116641
  execCommand('git commit -m "chore: initial SmartStack project setup"', projectDir, dryRun);
116643
116642
  }
116644
- var initCommand = new Command("init").description("Initialize a new SmartStack project").argument("<name>", "Project name").option("--db <type>", "Database type (sqlserver, postgresql, sqlite)", "sqlserver").option("--dry-run", "Show what would be created without actually creating").option("-y, --yes", "Skip prompts and use defaults").option("--skip-mcp-check", "Skip MCP servers verification").action(async (name, options) => {
116643
+ var initCommand = new Command("init").description("Initialize a new SmartStack project").argument("<name>", "Project name").option("--dry-run", "Show what would be created without actually creating").option("-y, --yes", "Skip prompts and use defaults").option("--skip-mcp-check", "Skip MCP servers verification").option("--multi-tenant", "Enable multi-tenant mode").option("--b2c", "Enable B2C (user tenant management)").action(async (name, options) => {
116645
116644
  logger.header("SmartStack Project Initialization");
116646
116645
  if (!options.skipMcpCheck) {
116647
116646
  logger.info("Checking MCP servers...");
@@ -116719,39 +116718,56 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
116719
116718
  config = {
116720
116719
  name,
116721
116720
  nameLower: name.toLowerCase(),
116722
- database: options.db || "sqlserver",
116723
- modules: ["Auth", "Navigation", "Notifications"]
116721
+ database: "sqlserver",
116722
+ multiTenant: {
116723
+ enabled: options.multiTenant ?? true,
116724
+ enableB2C: options.b2c ?? true,
116725
+ systemTenantSlug: "default",
116726
+ systemTenantName: "Default Workspace",
116727
+ autoAssignUsersToSystemTenant: true
116728
+ }
116724
116729
  };
116725
116730
  } else {
116726
116731
  const answers = await lib_default.prompt([
116727
116732
  {
116728
- type: "list",
116729
- name: "database",
116730
- message: "Which database do you want to use?",
116731
- choices: [
116732
- { name: "SQL Server", value: "sqlserver" },
116733
- { name: "PostgreSQL", value: "postgresql" },
116734
- { name: "SQLite", value: "sqlite" }
116735
- ],
116736
- default: options.db || "sqlserver"
116733
+ type: "confirm",
116734
+ name: "multiTenantEnabled",
116735
+ message: "Enable multi-tenant mode?",
116736
+ default: true
116737
116737
  },
116738
116738
  {
116739
- type: "checkbox",
116740
- name: "modules",
116741
- message: "Which SmartStack modules do you want to enable?",
116742
- choices: [
116743
- { name: "Auth (JWT + OAuth)", value: "Auth", checked: true },
116744
- { name: "Navigation (Dynamic menus)", value: "Navigation", checked: true },
116745
- { name: "AI (OpenAI/Claude integration)", value: "AI", checked: false },
116746
- { name: "Notifications (SignalR real-time)", value: "Notifications", checked: true }
116747
- ]
116739
+ type: "confirm",
116740
+ name: "enableB2C",
116741
+ message: "Enable B2C (user tenant management)?",
116742
+ default: true,
116743
+ when: (answers2) => answers2.multiTenantEnabled
116744
+ },
116745
+ {
116746
+ type: "input",
116747
+ name: "systemTenantSlug",
116748
+ message: "System tenant slug:",
116749
+ default: "default",
116750
+ when: (answers2) => answers2.multiTenantEnabled
116751
+ },
116752
+ {
116753
+ type: "input",
116754
+ name: "systemTenantName",
116755
+ message: "System tenant name:",
116756
+ default: "Default Workspace",
116757
+ when: (answers2) => answers2.multiTenantEnabled
116748
116758
  }
116749
116759
  ]);
116750
116760
  config = {
116751
116761
  name,
116752
116762
  nameLower: name.toLowerCase(),
116753
- database: answers.database || "sqlserver",
116754
- modules: answers.modules || []
116763
+ database: "sqlserver",
116764
+ multiTenant: {
116765
+ enabled: answers.multiTenantEnabled ?? true,
116766
+ enableB2C: answers.enableB2C ?? true,
116767
+ systemTenantSlug: answers.systemTenantSlug || "default",
116768
+ systemTenantName: answers.systemTenantName || "Default Workspace",
116769
+ autoAssignUsersToSystemTenant: true
116770
+ }
116755
116771
  };
116756
116772
  }
116757
116773
  const dryRun = options.dryRun || false;
@@ -116760,8 +116776,12 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
116760
116776
  }
116761
116777
  console.log();
116762
116778
  logger.info(`Project: ${source_default.cyan(config.name)}`);
116763
- logger.info(`Database: ${source_default.cyan(config.database)}`);
116764
- logger.info(`Modules: ${source_default.cyan(config.modules.join(", ") || "None")}`);
116779
+ logger.info(`Database: ${source_default.cyan("SQL Server")}`);
116780
+ logger.info(`Multi-Tenant: ${config.multiTenant.enabled ? source_default.green("Enabled") : source_default.gray("Disabled")}`);
116781
+ if (config.multiTenant.enabled) {
116782
+ logger.info(` B2C (User Tenants): ${config.multiTenant.enableB2C ? source_default.green("Enabled") : source_default.gray("Disabled")}`);
116783
+ logger.info(` System Tenant: ${source_default.cyan(config.multiTenant.systemTenantSlug)} (${config.multiTenant.systemTenantName})`);
116784
+ }
116765
116785
  console.log();
116766
116786
  try {
116767
116787
  if (!dryRun) {
@@ -117816,7 +117836,7 @@ function parseConnectionString(connStr) {
117816
117836
  }
117817
117837
  function executeSqlCmd(server, database, query) {
117818
117838
  const sqlServer = server === "(local)" ? "." : server;
117819
- const cmd = `sqlcmd -S "${sqlServer}" -d "${database}" -E -Q "${query.replace(/"/g, '\\"')}" -h -1 -W`;
117839
+ const cmd = `sqlcmd -S "${sqlServer}" -d "${database}" -E -I -Q "${query.replace(/"/g, '\\"')}" -h -1 -W`;
117820
117840
  return (0, import_child_process7.execSync)(cmd, { encoding: "utf-8" }).trim();
117821
117841
  }
117822
117842
  function detectSmartStackApp() {