@digitaldefiance/express-suite-starter 3.0.0 → 3.0.1
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/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseApplication,
|
|
3
3
|
MongoDatabasePlugin,
|
|
4
|
-
MongooseDocumentStore,
|
|
5
4
|
DatabaseInitializationService,
|
|
6
5
|
Environment,
|
|
7
6
|
IServerInitResult,
|
|
8
7
|
getSchemaMap,
|
|
9
8
|
} from '@digitaldefiance/node-express-suite';
|
|
10
|
-
import type { IMongoApplication } from '@digitaldefiance/node-express-suite';
|
|
11
9
|
|
|
12
10
|
// Simple debugLog implementation
|
|
13
11
|
function debugLog(debug: boolean, type: 'log' | 'warn' | 'error', ...args: any[]): void {
|
|
@@ -160,8 +158,14 @@ async function main() {
|
|
|
160
158
|
'log',
|
|
161
159
|
getSuiteCoreTranslation(SuiteCoreStringKey.Admin_StartingDbInitialization),
|
|
162
160
|
);
|
|
161
|
+
const mongoApp = mongoPlugin.mongoApplication;
|
|
162
|
+
if (!mongoApp) {
|
|
163
|
+
console.error('MongoPlugin was not initialized — mongoApplication is undefined');
|
|
164
|
+
await mongoPlugin.disconnect();
|
|
165
|
+
process.exit(2);
|
|
166
|
+
}
|
|
163
167
|
const result: IFailableResult<IServerInitResult> =
|
|
164
|
-
await DatabaseInitializationService.initUserDb(
|
|
168
|
+
await DatabaseInitializationService.initUserDb(mongoApp);
|
|
165
169
|
if (result.success && result.data) {
|
|
166
170
|
debugLog(
|
|
167
171
|
app.environment.debug,
|