Files
co-lite/solvway-admin-portal/app/lib/protectedModules.ts
T
ngqileandClaude Opus 5.5 5ee51d1913 chore: copy kept Tastefully modules and portals into Co-Lite
Backend modules from tastefully 8bd93d15: core-libs, core-session,
api-gateway, mobile-api, services-auth, services-system,
services-counter, services-member, services-log, services-email.
solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal
from tastefully 8bd93d15. Copied as tracked files only.

Literal secrets replaced with environment placeholders:
- services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY,
  MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default)
- services-system: JUMIO_TOKEN, JUMIO_SECRET (optional)
- services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed
- core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default
  removed, ipgeolocation key read from IPGEOLOCATION_API_KEY
- services-system EkycAppConfig: commented Jumio credentials removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-11-26 15:55:45 +08:00

38 lines
1.6 KiB
TypeScript

import { ROUTE_ANY_MODULES, ROUTE_MODULES } from "@/app/lib/routeModules";
// Client-side mirror of the server-side protected-names denylist
// (solvway-mobile-api AdminModuleService.PROTECTED_NAMES, spec
// "Protected Nodes Are Guarded Against Structural Change"). These nodes have
// hardcoded code dependencies (server literals, nav structure, route gates)
// whose breakage the DB cannot detect, so delete AND structural edits
// (reparent/type/url) are refused server-side; desc/icon edits stay allowed.
// The /modules page derives the same set so protected nodes render their
// structural fields disabled.
//
// Derived from ROUTE_MODULES rather than hand-listed: a new route-gated module
// is protected automatically (the server list must be updated in the same
// change — the AdminModuleService.PROTECTED_NAMES javadoc says so).
export const FIXED_PROTECTED_MODULE_NAMES: readonly string[] = [
"BO_ROOT",
"BO_ADMINISTRATION",
"BO_SYSTEM",
"BO_WALLET",
"BO_ROLES",
// Catalogue nav group (add-admin-catalog-setup) — not route-gated (type M,
// no url), so it is not auto-derived from ROUTE_MODULES and must be listed
// explicitly, same as the other group headers above.
"BO_CATALOG",
];
export const PROTECTED_MODULE_NAMES: ReadonlySet<string> = new Set([
...FIXED_PROTECTED_MODULE_NAMES,
...Object.values(ROUTE_MODULES),
...Object.values(ROUTE_ANY_MODULES).flat(),
]);
/** {@code true} when the node's {@code name} has hardcoded code dependencies. */
export function isProtectedModuleName(name: string | undefined): boolean {
return name != null && PROTECTED_MODULE_NAMES.has(name);
}