@chromahq/core 1.0.55 → 1.0.56
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/{boot-BMZdye6C.js → boot-CUFlC4bu.js} +55 -36
- package/dist/boot-CUFlC4bu.js.map +1 -0
- package/dist/{boot-Bty0U5M4.js → boot-c2gJZWBc.js} +55 -36
- package/dist/boot-c2gJZWBc.js.map +1 -0
- package/dist/boot.cjs.js +1 -1
- package/dist/boot.es.js +1 -1
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +2 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/boot-BMZdye6C.js.map +0 -1
- package/dist/boot-Bty0U5M4.js.map +0 -1
|
@@ -2232,7 +2232,7 @@ class ApplicationBootstrap {
|
|
|
2232
2232
|
}) {
|
|
2233
2233
|
try {
|
|
2234
2234
|
this.logger = new BootstrapLogger(enableLogs);
|
|
2235
|
-
this.logger.info("
|
|
2235
|
+
this.logger.info("Starting Chroma application bootstrap...");
|
|
2236
2236
|
await this.discoverAndInitializeStores();
|
|
2237
2237
|
await this.discoverServices();
|
|
2238
2238
|
const store = this.storeDefinitions[0].store;
|
|
@@ -2253,9 +2253,9 @@ class ApplicationBootstrap {
|
|
|
2253
2253
|
await this.bootMessages();
|
|
2254
2254
|
await this.bootServices();
|
|
2255
2255
|
}
|
|
2256
|
-
this.logger.success("
|
|
2256
|
+
this.logger.success("Chroma application initialization complete");
|
|
2257
2257
|
} catch (error) {
|
|
2258
|
-
this.logger.error("
|
|
2258
|
+
this.logger.error("Application bootstrap failed:", error);
|
|
2259
2259
|
throw error;
|
|
2260
2260
|
}
|
|
2261
2261
|
}
|
|
@@ -2263,7 +2263,7 @@ class ApplicationBootstrap {
|
|
|
2263
2263
|
* Boot all registered services by calling their onBoot method if present
|
|
2264
2264
|
*/
|
|
2265
2265
|
async bootServices() {
|
|
2266
|
-
this.logger.info("
|
|
2266
|
+
this.logger.info("Booting services...");
|
|
2267
2267
|
const bootPromises = Array.from(this.serviceRegistry.entries()).map(
|
|
2268
2268
|
async ([serviceName, ServiceClass]) => {
|
|
2269
2269
|
try {
|
|
@@ -2286,7 +2286,7 @@ class ApplicationBootstrap {
|
|
|
2286
2286
|
* Discover all services in the application directory
|
|
2287
2287
|
*/
|
|
2288
2288
|
async discoverServices() {
|
|
2289
|
-
this.logger.info("
|
|
2289
|
+
this.logger.info("Discovering services...");
|
|
2290
2290
|
const serviceModules = undefined(
|
|
2291
2291
|
"/src/app/services/**/*.service.{ts,js}",
|
|
2292
2292
|
{ eager: true }
|
|
@@ -2301,7 +2301,7 @@ class ApplicationBootstrap {
|
|
|
2301
2301
|
}
|
|
2302
2302
|
const circularDepsResult = this.detectCircularDependencies(serviceClasses);
|
|
2303
2303
|
if (circularDepsResult.hasCircularDependencies) {
|
|
2304
|
-
this.logger.error("
|
|
2304
|
+
this.logger.error("Circular dependencies detected!");
|
|
2305
2305
|
circularDepsResult.cycles.forEach((cycle, index) => {
|
|
2306
2306
|
this.logger.error(`Cycle ${index + 1}: ${cycle.cycle.join(" \u2192 ")} \u2192 ${cycle.cycle[0]}`);
|
|
2307
2307
|
});
|
|
@@ -2309,10 +2309,10 @@ class ApplicationBootstrap {
|
|
|
2309
2309
|
}
|
|
2310
2310
|
for (const ServiceClass of serviceClasses) {
|
|
2311
2311
|
container.bind(ServiceClass).toSelf().inSingletonScope();
|
|
2312
|
-
this.logger.debug(
|
|
2312
|
+
this.logger.debug(`Discovered service: ${ServiceClass.name}`);
|
|
2313
2313
|
}
|
|
2314
2314
|
this.logger.success(
|
|
2315
|
-
|
|
2315
|
+
`Registered ${serviceClasses.length} services without circular dependencies`
|
|
2316
2316
|
);
|
|
2317
2317
|
}
|
|
2318
2318
|
/**
|
|
@@ -2444,17 +2444,17 @@ class ApplicationBootstrap {
|
|
|
2444
2444
|
analyzeDependencies() {
|
|
2445
2445
|
const serviceClasses = Array.from(this.serviceRegistry.values());
|
|
2446
2446
|
const result = this.detectCircularDependencies(serviceClasses);
|
|
2447
|
-
this.logger.info("
|
|
2447
|
+
this.logger.info("Dependency Analysis Report:");
|
|
2448
2448
|
this.logger.info(`Total Services: ${result.dependencyGraph.size}`);
|
|
2449
2449
|
if (result.hasCircularDependencies) {
|
|
2450
|
-
this.logger.error(
|
|
2450
|
+
this.logger.error(`Circular Dependencies Found: ${result.cycles.length}`);
|
|
2451
2451
|
result.cycles.forEach((cycle, index) => {
|
|
2452
2452
|
this.logger.error(` Cycle ${index + 1}: ${cycle.cycle.join(" \u2192 ")} \u2192 ${cycle.cycle[0]}`);
|
|
2453
2453
|
});
|
|
2454
2454
|
} else {
|
|
2455
|
-
this.logger.success("
|
|
2455
|
+
this.logger.success("No circular dependencies detected");
|
|
2456
2456
|
}
|
|
2457
|
-
this.logger.info("
|
|
2457
|
+
this.logger.info("Service Dependency Tree:");
|
|
2458
2458
|
for (const [serviceName, node] of result.dependencyGraph) {
|
|
2459
2459
|
if (node.dependencies.length > 0) {
|
|
2460
2460
|
this.logger.info(` ${serviceName} depends on:`);
|
|
@@ -2472,7 +2472,7 @@ class ApplicationBootstrap {
|
|
|
2472
2472
|
async discoverAndInitializeStores() {
|
|
2473
2473
|
try {
|
|
2474
2474
|
if (this.storeDefinitions.length === 0) {
|
|
2475
|
-
this.logger.debug("
|
|
2475
|
+
this.logger.debug("No store definitions provided");
|
|
2476
2476
|
return;
|
|
2477
2477
|
}
|
|
2478
2478
|
this.logger.info(`Initializing ${this.storeDefinitions.length} store(s)...`);
|
|
@@ -2483,7 +2483,7 @@ class ApplicationBootstrap {
|
|
|
2483
2483
|
const classes = store.classes;
|
|
2484
2484
|
container.bind(diKey).toConstantValue(storeInstance);
|
|
2485
2485
|
if (isFirstStore) {
|
|
2486
|
-
container.bind(Symbol.for("Store")).toConstantValue(storeInstance);
|
|
2486
|
+
container.bind(/* @__PURE__ */ Symbol.for("Store")).toConstantValue(storeInstance);
|
|
2487
2487
|
isFirstStore = false;
|
|
2488
2488
|
}
|
|
2489
2489
|
await this.registerMessageClass(
|
|
@@ -2500,18 +2500,18 @@ class ApplicationBootstrap {
|
|
|
2500
2500
|
`store:${store.def.name}:reset`
|
|
2501
2501
|
);
|
|
2502
2502
|
}
|
|
2503
|
-
this.logger.debug(
|
|
2503
|
+
this.logger.debug(`Initialized store: ${store.def.name}`);
|
|
2504
2504
|
}
|
|
2505
|
-
this.logger.success(
|
|
2505
|
+
this.logger.success(`Initialized ${this.storeDefinitions.length} store(s)`);
|
|
2506
2506
|
} catch (error) {
|
|
2507
|
-
this.logger.error("
|
|
2507
|
+
this.logger.error("Failed to initialize stores:", error);
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
/**
|
|
2511
2511
|
* Register message handlers
|
|
2512
2512
|
*/
|
|
2513
2513
|
async registerMessages() {
|
|
2514
|
-
this.logger.info("
|
|
2514
|
+
this.logger.info("Registering messages...");
|
|
2515
2515
|
const messageModules = undefined(
|
|
2516
2516
|
"/src/app/messages/**/*.message.{ts,js}",
|
|
2517
2517
|
{ eager: true }
|
|
@@ -2524,7 +2524,7 @@ class ApplicationBootstrap {
|
|
|
2524
2524
|
if (messageClasses.length > 0) {
|
|
2525
2525
|
const circularDepsResult = this.detectCircularDependencies(messageClasses);
|
|
2526
2526
|
if (circularDepsResult.hasCircularDependencies) {
|
|
2527
|
-
this.logger.error("
|
|
2527
|
+
this.logger.error("Circular dependencies detected in messages!");
|
|
2528
2528
|
circularDepsResult.cycles.forEach((cycle, index) => {
|
|
2529
2529
|
this.logger.error(
|
|
2530
2530
|
`Message Cycle ${index + 1}: ${cycle.cycle.join(" \u2192 ")} \u2192 ${cycle.cycle[0]}`
|
|
@@ -2539,30 +2539,30 @@ class ApplicationBootstrap {
|
|
|
2539
2539
|
try {
|
|
2540
2540
|
for (const [name, ServiceClass] of this.serviceRegistry) {
|
|
2541
2541
|
if (!ServiceClass) {
|
|
2542
|
-
this.logger.warn(
|
|
2542
|
+
this.logger.warn(`Service not found in registry: ${name}`);
|
|
2543
2543
|
}
|
|
2544
2544
|
if (!container.isBound(ServiceClass)) {
|
|
2545
|
-
this.logger.warn(
|
|
2545
|
+
this.logger.warn(`Service not bound in container: ${name}`);
|
|
2546
2546
|
}
|
|
2547
2547
|
}
|
|
2548
2548
|
const messageMetadata = Reflect.getMetadata("name", MessageClass);
|
|
2549
2549
|
const messageName = messageMetadata || MessageClass.name;
|
|
2550
2550
|
container.bind(messageName).to(MessageClass).inSingletonScope();
|
|
2551
|
-
this.logger.success(
|
|
2551
|
+
this.logger.success(`Registered message: ${messageName}`);
|
|
2552
2552
|
} catch (error) {
|
|
2553
|
-
this.logger.error(
|
|
2553
|
+
this.logger.error(`Failed to register message ${MessageClass.name}:`, error);
|
|
2554
2554
|
}
|
|
2555
2555
|
}
|
|
2556
2556
|
}
|
|
2557
2557
|
async registerMessageClass(MessageClass, name) {
|
|
2558
2558
|
container.bind(name).to(MessageClass).inSingletonScope();
|
|
2559
|
-
this.logger.success(
|
|
2559
|
+
this.logger.success(`Registered message: ${name}`);
|
|
2560
2560
|
}
|
|
2561
2561
|
/**
|
|
2562
2562
|
* Boot all registered messages
|
|
2563
2563
|
*/
|
|
2564
2564
|
async bootMessages() {
|
|
2565
|
-
this.logger.info("
|
|
2565
|
+
this.logger.info("Booting messages...");
|
|
2566
2566
|
const messageModules = undefined(
|
|
2567
2567
|
"/src/app/messages/**/*.message.{ts,js}",
|
|
2568
2568
|
{ eager: true }
|
|
@@ -2577,10 +2577,10 @@ class ApplicationBootstrap {
|
|
|
2577
2577
|
const messageName = messageMetadata || MessageClass.name;
|
|
2578
2578
|
const messageInstance = container.get(messageName);
|
|
2579
2579
|
await messageInstance.boot();
|
|
2580
|
-
this.logger.success(
|
|
2580
|
+
this.logger.success(`Booted message: ${messageName}`);
|
|
2581
2581
|
return { messageName, success: true };
|
|
2582
2582
|
} catch (error) {
|
|
2583
|
-
this.logger.error(
|
|
2583
|
+
this.logger.error(`Failed to boot message ${MessageClass.name}:`, error);
|
|
2584
2584
|
return { messageName: MessageClass.name, success: false, error };
|
|
2585
2585
|
}
|
|
2586
2586
|
});
|
|
@@ -2590,7 +2590,7 @@ class ApplicationBootstrap {
|
|
|
2590
2590
|
* Register jobs for scheduled execution
|
|
2591
2591
|
*/
|
|
2592
2592
|
async registerJobs() {
|
|
2593
|
-
this.logger.info("
|
|
2593
|
+
this.logger.info("Registering jobs...");
|
|
2594
2594
|
const jobModules = undefined(
|
|
2595
2595
|
"/src/app/jobs/**/*.job.{ts,js}",
|
|
2596
2596
|
{ eager: true }
|
|
@@ -2601,10 +2601,10 @@ class ApplicationBootstrap {
|
|
|
2601
2601
|
this.logger.debug("container isBound(Scheduler)", { isBound: container.isBound(Scheduler) });
|
|
2602
2602
|
for (const [name, ServiceClass] of this.serviceRegistry) {
|
|
2603
2603
|
if (!ServiceClass) {
|
|
2604
|
-
this.logger.warn(
|
|
2604
|
+
this.logger.warn(`Service not found in registry: ${name}`);
|
|
2605
2605
|
}
|
|
2606
2606
|
if (!container.isBound(ServiceClass)) {
|
|
2607
|
-
this.logger.warn(
|
|
2607
|
+
this.logger.warn(`Service not bound in container: ${name}`);
|
|
2608
2608
|
} else {
|
|
2609
2609
|
container.get(ServiceClass);
|
|
2610
2610
|
}
|
|
@@ -2624,23 +2624,42 @@ class ApplicationBootstrap {
|
|
|
2624
2624
|
container.bind(id).to(JobClass).inSingletonScope();
|
|
2625
2625
|
const options = Reflect.getMetadata("job:options", JobClass) || {};
|
|
2626
2626
|
jobEntries.push({ JobClass, jobName, id, options });
|
|
2627
|
-
this.logger.debug(
|
|
2627
|
+
this.logger.debug(`Bound job: ${jobName}`);
|
|
2628
2628
|
} catch (error) {
|
|
2629
|
-
this.logger.error(
|
|
2629
|
+
this.logger.error(`Failed to bind job ${JobClass.name}:`, error);
|
|
2630
2630
|
}
|
|
2631
2631
|
}
|
|
2632
2632
|
for (const { JobClass, jobName, id, options } of jobEntries) {
|
|
2633
2633
|
try {
|
|
2634
2634
|
const instance = container.get(JobClass);
|
|
2635
2635
|
JobRegistry.instance.register(id, instance, options);
|
|
2636
|
+
if (typeof instance.onBoot === "function") {
|
|
2637
|
+
this.logger.info(`Executing onBoot for job: ${jobName}`);
|
|
2638
|
+
try {
|
|
2639
|
+
if (options.requiresPopup) {
|
|
2640
|
+
const isPopupVisible = PopupVisibilityService.instance.isPopupVisible();
|
|
2641
|
+
if (!isPopupVisible) {
|
|
2642
|
+
this.logger.debug(`Skipping onBoot for job ${jobName} - popup not visible`);
|
|
2643
|
+
} else {
|
|
2644
|
+
await instance.onBoot();
|
|
2645
|
+
this.logger.debug(`Executed onBoot for job: ${jobName}`);
|
|
2646
|
+
}
|
|
2647
|
+
} else {
|
|
2648
|
+
await instance.onBoot();
|
|
2649
|
+
this.logger.debug(`Executed onBoot for job: ${jobName}`);
|
|
2650
|
+
}
|
|
2651
|
+
} catch (error) {
|
|
2652
|
+
this.logger.error(`Failed to execute onBoot for job ${jobName}:`, error);
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2636
2655
|
if (!options.startPaused) {
|
|
2637
2656
|
this.scheduler.schedule(id, options);
|
|
2638
2657
|
} else {
|
|
2639
|
-
this.logger.info(
|
|
2658
|
+
this.logger.info(`Job ${jobName} registered but paused (startPaused: true)`);
|
|
2640
2659
|
}
|
|
2641
|
-
this.logger.success(
|
|
2660
|
+
this.logger.success(`Registered job: ${jobName}`);
|
|
2642
2661
|
} catch (error) {
|
|
2643
|
-
this.logger.error(
|
|
2662
|
+
this.logger.error(`Failed to register job ${JobClass.name}:`, error);
|
|
2644
2663
|
}
|
|
2645
2664
|
}
|
|
2646
2665
|
}
|
|
@@ -2739,4 +2758,4 @@ exports.getNonceService = getNonceService;
|
|
|
2739
2758
|
exports.getPopupVisibilityService = getPopupVisibilityService;
|
|
2740
2759
|
exports.isEarlyListenerSetup = isEarlyListenerSetup;
|
|
2741
2760
|
exports.setupEarlyListener = setupEarlyListener;
|
|
2742
|
-
//# sourceMappingURL=boot-
|
|
2761
|
+
//# sourceMappingURL=boot-CUFlC4bu.js.map
|