@atlashub/smartstack-mcp 1.15.0 → 1.17.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
@@ -4142,11 +4142,11 @@ function generatePermissionsForNavRoute(navRoute, customActions, includeStandard
4142
4142
  }
4143
4143
  async function scanControllersForPermissions(backendRoot) {
4144
4144
  const permissions = [];
4145
- const controllersPath = path11.join(backendRoot, "Api.Core", "Controllers");
4146
- const apiControllersPath = path11.join(backendRoot, "Api", "Controllers");
4147
4145
  const controllerDirs = [
4148
- controllersPath,
4149
- apiControllersPath
4146
+ path11.join(backendRoot, "src", "SmartStack.Api", "Controllers"),
4147
+ path11.join(backendRoot, "SmartStack.Api", "Controllers"),
4148
+ path11.join(backendRoot, "Api", "Controllers"),
4149
+ path11.join(backendRoot, "Api.Core", "Controllers")
4150
4150
  ];
4151
4151
  for (const dir of controllerDirs) {
4152
4152
  try {
@@ -4182,11 +4182,13 @@ async function scanControllersForPermissions(backendRoot) {
4182
4182
  }
4183
4183
  function extractNavRoutesFromController(content) {
4184
4184
  const navRoutes = [];
4185
- const regex = /\[NavRoute\s*\(\s*"([^"]+)"(?:\s*,\s*Suffix\s*=\s*"([^"]+)")?\s*\)\]/g;
4185
+ const regex = /\[NavRoute\s*\(\s*"([^"]+)"([^)]*)\)\]/g;
4186
4186
  let match;
4187
4187
  while ((match = regex.exec(content)) !== null) {
4188
4188
  const navRoute = match[1];
4189
- const suffix = match[2];
4189
+ const params = match[2] || "";
4190
+ const suffixMatch = params.match(/Suffix\s*=\s*"([^"]+)"/);
4191
+ const suffix = suffixMatch ? suffixMatch[1] : null;
4190
4192
  if (suffix) {
4191
4193
  navRoutes.push(`${navRoute}.${suffix}`);
4192
4194
  } else {
@@ -7837,6 +7839,47 @@ function generateNavRouteRegistry(routes) {
7837
7839
  lines.push(" return Object.values(ROUTES).filter(r => r.navRoute.startsWith(`${context}.`));");
7838
7840
  lines.push("}");
7839
7841
  lines.push("");
7842
+ lines.push("/**");
7843
+ lines.push(" * Get web route with optional tenant slug prefix");
7844
+ lines.push(" *");
7845
+ lines.push(" * @param navRoute - NavRoute path (e.g., 'platform.administration.users')");
7846
+ lines.push(" * @param options - Configuration for URL building");
7847
+ lines.push(" * @returns Web route path, optionally prefixed with /t/{slug}");
7848
+ lines.push(" *");
7849
+ lines.push(" * @example");
7850
+ lines.push(" * // Single-tenant mode or no tenant");
7851
+ lines.push(" * getWebRoute('platform.administration.users', { isSingleTenant: true })");
7852
+ lines.push(" * // Returns: '/platform/administration/users'");
7853
+ lines.push(" *");
7854
+ lines.push(" * @example");
7855
+ lines.push(" * // Multi-tenant mode with slug");
7856
+ lines.push(" * getWebRoute('platform.administration.users', { slug: 'acme', isSingleTenant: false })");
7857
+ lines.push(" * // Returns: '/t/acme/platform/administration/users'");
7858
+ lines.push(" */");
7859
+ lines.push("export function getWebRoute(");
7860
+ lines.push(" navRoute: string,");
7861
+ lines.push(" options: {");
7862
+ lines.push(" slug?: string | null;");
7863
+ lines.push(" isSingleTenant: boolean;");
7864
+ lines.push(" isAdminMode?: boolean;");
7865
+ lines.push(" } = { isSingleTenant: true }");
7866
+ lines.push("): string {");
7867
+ lines.push(" const route = ROUTES[navRoute];");
7868
+ lines.push(" if (!route) {");
7869
+ lines.push(" throw new Error(`Route not found: ${navRoute}`);");
7870
+ lines.push(" }");
7871
+ lines.push("");
7872
+ lines.push(" const webPath = route.web;");
7873
+ lines.push("");
7874
+ lines.push(" // No prefix needed in single-tenant mode, admin mode, or without slug");
7875
+ lines.push(" if (options.isSingleTenant || options.isAdminMode || !options.slug) {");
7876
+ lines.push(" return webPath;");
7877
+ lines.push(" }");
7878
+ lines.push("");
7879
+ lines.push(" // Add tenant slug prefix");
7880
+ lines.push(" return `/t/${options.slug}${webPath}`;");
7881
+ lines.push("}");
7882
+ lines.push("");
7840
7883
  return lines.join("\n");
7841
7884
  }
7842
7885
  function generateRouterConfig(routes, includeGuards) {