@mostajs/setup 1.4.12 → 1.4.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.
@@ -11,6 +11,8 @@ export interface SetupWizardProps {
11
11
  install?: string;
12
12
  uploadJar?: string;
13
13
  wireModule?: string;
14
+ /** Seed endpoint — runs module seeds from the runtime registry */
15
+ seed?: string;
14
16
  };
15
17
  /** Default database name prefix (e.g. 'secuaccessdb') */
16
18
  dbNamePrefix?: string;
@@ -353,6 +353,7 @@ export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNa
353
353
  install: endpoints.install || '/api/setup/install',
354
354
  uploadJar: endpoints.uploadJar || '/api/setup/upload-jar',
355
355
  wireModule: endpoints.wireModule || '/api/setup/wire-module',
356
+ seed: endpoints.seed || '/api/setup/seed',
356
357
  };
357
358
  // --- State ---
358
359
  const [currentStep, setCurrentStep] = useState(0);
package/dist/lib/setup.js CHANGED
@@ -79,8 +79,12 @@ export async function runInstall(installConfig, setupConfig) {
79
79
  });
80
80
  seeded.push('admin');
81
81
  }
82
- // 6. Optional seeds
83
- if (setupConfig.optionalSeeds && installConfig.seed) {
82
+ // 6. Optional seeds (runtime registry or legacy)
83
+ if (setupConfig.runModuleSeeds) {
84
+ await setupConfig.runModuleSeeds(installConfig.modules);
85
+ seeded.push('module-seeds');
86
+ }
87
+ else if (setupConfig.optionalSeeds && installConfig.seed) {
84
88
  for (const seedDef of setupConfig.optionalSeeds) {
85
89
  if (installConfig.seed[seedDef.key]) {
86
90
  await seedDef.run({});
@@ -0,0 +1,8 @@
1
+ import type { ModuleRegistration } from '@mostajs/socle';
2
+ /**
3
+ * Setup provides the installation wizard and reconfiguration panel.
4
+ * No schemas of its own — orchestrates other modules' seeds.
5
+ */
6
+ export declare function register(registry: {
7
+ register(r: ModuleRegistration): void;
8
+ }): void;
@@ -0,0 +1,24 @@
1
+ // @mostajs/setup — Runtime module registration
2
+ // Author: Dr Hamid MADANI drmdh@msn.com
3
+ import { setupMenuContribution } from './lib/menu.js';
4
+ /**
5
+ * Setup provides the installation wizard and reconfiguration panel.
6
+ * No schemas of its own — orchestrates other modules' seeds.
7
+ */
8
+ export function register(registry) {
9
+ registry.register({
10
+ manifest: {
11
+ name: 'setup',
12
+ package: '@mostajs/setup',
13
+ version: '2.0.0',
14
+ type: 'core',
15
+ priority: 10,
16
+ dependencies: ['auth', 'settings'],
17
+ displayName: 'Setup',
18
+ description: 'Installation wizard — DB config, module selection, admin creation, seeding',
19
+ icon: 'Wrench',
20
+ register: './dist/register.js',
21
+ },
22
+ menu: setupMenuContribution,
23
+ });
24
+ }
@@ -54,8 +54,10 @@ export interface MostaSetupConfig {
54
54
  firstName: string;
55
55
  lastName: string;
56
56
  }) => Promise<void>;
57
- /** Optional seeds shown in the wizard */
57
+ /** Optional seeds shown in the wizard (legacy — prefer runModuleSeeds) */
58
58
  optionalSeeds?: SeedDefinition[];
59
+ /** Run seeds from the module registry (Phase 4 runtime) */
60
+ runModuleSeeds?: (modules?: string[]) => Promise<void>;
59
61
  /** Extra env vars to write to .env.local */
60
62
  extraEnvVars?: Record<string, string>;
61
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/setup",
3
- "version": "1.4.12",
3
+ "version": "1.4.13",
4
4
  "description": "Reusable setup wizard module — multi-dialect DB configuration, .env.local writer, seed runner",
5
5
  "author": "Dr Hamid MADANI <drmdh@msn.com>",
6
6
  "license": "MIT",
@@ -62,10 +62,16 @@
62
62
  "types": "./dist/api/wire-module.route.d.ts",
63
63
  "import": "./dist/api/wire-module.route.js",
64
64
  "default": "./dist/api/wire-module.route.js"
65
+ },
66
+ "./register": {
67
+ "types": "./dist/register.d.ts",
68
+ "import": "./dist/register.js",
69
+ "default": "./dist/register.js"
65
70
  }
66
71
  },
67
72
  "files": [
68
73
  "dist",
74
+ "wire.json",
69
75
  "setup.wire.json",
70
76
  "LICENSE",
71
77
  "README.md"
@@ -97,6 +103,7 @@
97
103
  },
98
104
  "devDependencies": {
99
105
  "@mostajs/menu": "^1.0.2",
106
+ "@mostajs/socle": "^2.0.0",
100
107
  "@types/bcryptjs": "^2.4.0",
101
108
  "@types/node": "^25.3.3",
102
109
  "@types/react": "^19.2.14",
@@ -104,7 +111,7 @@
104
111
  },
105
112
  "peerDependencies": {
106
113
  "@mostajs/menu": ">=1.0.2",
107
- "@mostajs/socle": ">=1.0.0",
114
+ "@mostajs/socle": ">=2.0.0",
108
115
  "react": ">=18.0.0"
109
116
  },
110
117
  "peerDependenciesMeta": {
package/wire.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "setup",
3
+ "package": "@mostajs/setup",
4
+ "version": "2.0.0",
5
+ "type": "core",
6
+ "priority": 10,
7
+ "dependencies": ["auth", "settings"],
8
+ "displayName": "Setup",
9
+ "description": "Installation wizard — DB config, module selection, admin creation, seeding",
10
+ "icon": "Wrench",
11
+ "register": "./dist/register.js"
12
+ }