@mostajs/setup 2.1.21 → 2.1.22
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/lib/setup.js +17 -4
- package/package.json +1 -1
package/dist/lib/setup.js
CHANGED
|
@@ -142,8 +142,20 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
142
142
|
extraVars['MOSTAJS_MODULES'] = installConfig.modules.join(',');
|
|
143
143
|
}
|
|
144
144
|
const seeded = [];
|
|
145
|
-
// 2. Verify NET server is reachable
|
|
146
|
-
|
|
145
|
+
// 2. Verify NET server is reachable (retry up to 10s if just restarted)
|
|
146
|
+
let health = null;
|
|
147
|
+
for (let i = 0; i < 10; i++) {
|
|
148
|
+
try {
|
|
149
|
+
health = await net.health();
|
|
150
|
+
if (health.entities?.length > 0)
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
catch { }
|
|
154
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
155
|
+
}
|
|
156
|
+
if (!health) {
|
|
157
|
+
return { ok: false, error: 'Serveur NET non joignable', needsRestart: false };
|
|
158
|
+
}
|
|
147
159
|
// 3. Read setup.json for RBAC definitions
|
|
148
160
|
const fs = await import('fs');
|
|
149
161
|
const path = await import('path');
|
|
@@ -155,8 +167,8 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
155
167
|
}
|
|
156
168
|
catch { }
|
|
157
169
|
}
|
|
158
|
-
// 4. If server has no entities, try sending
|
|
159
|
-
if (!health
|
|
170
|
+
// 4. If server has no entities (schemas not yet uploaded), try sending them
|
|
171
|
+
if (!health?.entities?.length) {
|
|
160
172
|
let schemasToSend = [];
|
|
161
173
|
// Try schemas.json local
|
|
162
174
|
const schemasJsonPath = path.resolve(process.cwd(), 'schemas.json');
|
|
@@ -217,6 +229,7 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
217
229
|
}
|
|
218
230
|
}
|
|
219
231
|
await net.loadCollectionMap();
|
|
232
|
+
console.log(`[Setup NET] Serveur prêt — ${health?.entities?.length ?? 0} entités, collectionMap chargée`);
|
|
220
233
|
if (setupJson?.rbac) {
|
|
221
234
|
const rbac = setupJson.rbac;
|
|
222
235
|
// 3a. Upsert categories
|
package/package.json
CHANGED