lifecycleion 0.0.7 → 0.0.9
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/README.md +2 -1
- package/dist/lib/dev-mode.cjs +77 -0
- package/dist/lib/dev-mode.cjs.map +1 -0
- package/dist/lib/dev-mode.d.cts +38 -0
- package/dist/lib/dev-mode.d.ts +38 -0
- package/dist/lib/dev-mode.js +50 -0
- package/dist/lib/dev-mode.js.map +1 -0
- package/dist/lib/lifecycle-manager/index.cjs +118 -61
- package/dist/lib/lifecycle-manager/index.cjs.map +1 -1
- package/dist/lib/lifecycle-manager/index.js +118 -61
- package/dist/lib/lifecycle-manager/index.js.map +1 -1
- package/package.json +6 -1
|
@@ -2347,9 +2347,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
2347
2347
|
startupOrder: this.getStartupOrderInternal()
|
|
2348
2348
|
};
|
|
2349
2349
|
} catch (error) {
|
|
2350
|
-
const err = error;
|
|
2350
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
2351
2351
|
const code = err instanceof DependencyCycleError ? "dependency_cycle" : "unknown_error";
|
|
2352
|
-
this.logger.error("Failed to resolve startup order", {
|
|
2352
|
+
this.logger.error("Failed to resolve startup order: {{error.message}}", {
|
|
2353
2353
|
params: { error: err }
|
|
2354
2354
|
});
|
|
2355
2355
|
return {
|
|
@@ -2557,11 +2557,14 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
2557
2557
|
try {
|
|
2558
2558
|
startupOrder = this.getStartupOrderInternal();
|
|
2559
2559
|
} catch (error) {
|
|
2560
|
-
const err = error;
|
|
2560
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
2561
2561
|
const code = err instanceof DependencyCycleError ? "dependency_cycle" : "unknown_error";
|
|
2562
|
-
this.logger.error(
|
|
2563
|
-
|
|
2564
|
-
|
|
2562
|
+
this.logger.error(
|
|
2563
|
+
"Failed to resolve startup order: {{error.message}}",
|
|
2564
|
+
{
|
|
2565
|
+
params: { error: err }
|
|
2566
|
+
}
|
|
2567
|
+
);
|
|
2565
2568
|
return {
|
|
2566
2569
|
success: false,
|
|
2567
2570
|
startedComponents: [],
|
|
@@ -2664,9 +2667,14 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
2664
2667
|
};
|
|
2665
2668
|
} else {
|
|
2666
2669
|
if (component.isOptional()) {
|
|
2667
|
-
this.logger.entity(name).warn(
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
+
this.logger.entity(name).warn(
|
|
2671
|
+
"Optional component failed to start, continuing: {{error.message}}",
|
|
2672
|
+
{
|
|
2673
|
+
params: {
|
|
2674
|
+
error: result.error || new Error(result.reason || "Unknown error")
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
);
|
|
2670
2678
|
this.lifecycleEvents.componentStartFailedOptional(
|
|
2671
2679
|
name,
|
|
2672
2680
|
result.error
|
|
@@ -2680,9 +2688,14 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
2680
2688
|
error: result.error || new Error(result.reason || "Unknown error")
|
|
2681
2689
|
});
|
|
2682
2690
|
} else {
|
|
2683
|
-
this.logger.entity(name).error(
|
|
2684
|
-
|
|
2685
|
-
|
|
2691
|
+
this.logger.entity(name).error(
|
|
2692
|
+
"Required component failed to start, rolling back: {{error.message}}",
|
|
2693
|
+
{
|
|
2694
|
+
params: {
|
|
2695
|
+
error: result.error || new Error(result.reason || "Unknown error")
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2698
|
+
);
|
|
2686
2699
|
await this.rollbackStartup(startedComponents);
|
|
2687
2700
|
return {
|
|
2688
2701
|
success: false,
|
|
@@ -3177,8 +3190,8 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3177
3190
|
};
|
|
3178
3191
|
} catch (error) {
|
|
3179
3192
|
const durationMS = Date.now() - startTime;
|
|
3180
|
-
const err = error;
|
|
3181
|
-
this.logger.entity(name).error("Health check failed", {
|
|
3193
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
3194
|
+
this.logger.entity(name).error("Health check failed: {{error.message}}", {
|
|
3182
3195
|
params: { error: err }
|
|
3183
3196
|
});
|
|
3184
3197
|
this.lifecycleEvents.componentHealthCheckFailed(name, err);
|
|
@@ -3327,7 +3340,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3327
3340
|
result = component.onMessage(payload, from);
|
|
3328
3341
|
} catch (error) {
|
|
3329
3342
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3330
|
-
this.logger.entity(componentName).error("Message handler failed", {
|
|
3343
|
+
this.logger.entity(componentName).error("Message handler failed: {{error.message}}", {
|
|
3331
3344
|
params: { error: err, from }
|
|
3332
3345
|
});
|
|
3333
3346
|
this.lifecycleEvents.componentMessageFailed(componentName, from, err, {
|
|
@@ -3387,7 +3400,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3387
3400
|
};
|
|
3388
3401
|
} catch (error) {
|
|
3389
3402
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3390
|
-
this.logger.entity(componentName).error("Message handler failed", {
|
|
3403
|
+
this.logger.entity(componentName).error("Message handler failed: {{error.message}}", {
|
|
3391
3404
|
params: { error: err, from, timeoutMS }
|
|
3392
3405
|
});
|
|
3393
3406
|
this.lifecycleEvents.componentMessageFailed(componentName, from, err, {
|
|
@@ -3595,7 +3608,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3595
3608
|
};
|
|
3596
3609
|
} catch (error) {
|
|
3597
3610
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3598
|
-
this.logger.entity(componentName).error("getValue handler failed", {
|
|
3611
|
+
this.logger.entity(componentName).error("getValue handler failed: {{error.message}}", {
|
|
3599
3612
|
params: { error: err, key, from }
|
|
3600
3613
|
});
|
|
3601
3614
|
this.lifecycleEvents.componentValueReturned(componentName, key, from, {
|
|
@@ -3761,9 +3774,13 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3761
3774
|
try {
|
|
3762
3775
|
startupOrder2 = this.getStartupOrderInternal();
|
|
3763
3776
|
} catch (error) {
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3777
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
3778
|
+
this.logger.warn(
|
|
3779
|
+
"Failed to compute startup order in error handler: {{error.message}}",
|
|
3780
|
+
{
|
|
3781
|
+
params: { error: err }
|
|
3782
|
+
}
|
|
3783
|
+
);
|
|
3767
3784
|
startupOrder2 = [];
|
|
3768
3785
|
}
|
|
3769
3786
|
return {
|
|
@@ -3927,9 +3944,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3927
3944
|
startResult
|
|
3928
3945
|
};
|
|
3929
3946
|
} catch (error) {
|
|
3930
|
-
const err = error;
|
|
3947
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
3931
3948
|
const code = err instanceof DependencyCycleError ? "dependency_cycle" : "unknown_error";
|
|
3932
|
-
this.logger.entity(componentName).error("Registration failed with unexpected error", {
|
|
3949
|
+
this.logger.entity(componentName).error("Registration failed with unexpected error: {{error.message}}", {
|
|
3933
3950
|
params: { error: err }
|
|
3934
3951
|
});
|
|
3935
3952
|
this.lifecycleEvents.componentRegistrationRejected({
|
|
@@ -3996,10 +4013,11 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
3996
4013
|
const startupOrder = this.getStartupOrderInternal();
|
|
3997
4014
|
shutdownOrder = [...startupOrder].reverse();
|
|
3998
4015
|
} catch (error) {
|
|
4016
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
3999
4017
|
this.logger.warn(
|
|
4000
|
-
"Could not resolve shutdown order, using registration order",
|
|
4018
|
+
"Could not resolve shutdown order, using registration order: {{error.message}}",
|
|
4001
4019
|
{
|
|
4002
|
-
params: { error }
|
|
4020
|
+
params: { error: err }
|
|
4003
4021
|
}
|
|
4004
4022
|
);
|
|
4005
4023
|
shutdownOrder = this.components.map((c) => c.getName()).reverse();
|
|
@@ -4056,9 +4074,14 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4056
4074
|
if (result2.success) {
|
|
4057
4075
|
stoppedComponents.push(name);
|
|
4058
4076
|
} else {
|
|
4059
|
-
this.logger.entity(name).error(
|
|
4060
|
-
|
|
4061
|
-
|
|
4077
|
+
this.logger.entity(name).error(
|
|
4078
|
+
"Component failed to stop, continuing with others: {{error.message}}",
|
|
4079
|
+
{
|
|
4080
|
+
params: {
|
|
4081
|
+
error: result2.error || new Error(result2.reason || "Unknown error")
|
|
4082
|
+
}
|
|
4083
|
+
}
|
|
4084
|
+
);
|
|
4062
4085
|
const stallInfo = this.stalledComponents.get(name);
|
|
4063
4086
|
if (stallInfo) {
|
|
4064
4087
|
stalledComponents.push(stallInfo);
|
|
@@ -4280,9 +4303,13 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4280
4303
|
try {
|
|
4281
4304
|
component.onStartupAborted();
|
|
4282
4305
|
} catch (error) {
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4306
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4307
|
+
this.logger.entity(name).warn(
|
|
4308
|
+
"Error in onStartupAborted callback: {{error.message}}",
|
|
4309
|
+
{
|
|
4310
|
+
params: { error: err }
|
|
4311
|
+
}
|
|
4312
|
+
);
|
|
4286
4313
|
}
|
|
4287
4314
|
} else {
|
|
4288
4315
|
this.monitorLateStartupCompletion(
|
|
@@ -4352,11 +4379,11 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4352
4379
|
status: this.getComponentStatus(name)
|
|
4353
4380
|
};
|
|
4354
4381
|
} catch (error) {
|
|
4355
|
-
const err = error;
|
|
4382
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4356
4383
|
this.componentErrors.set(name, err);
|
|
4357
4384
|
if (err instanceof ComponentStartTimeoutError && err.additionalInfo.componentName === name) {
|
|
4358
4385
|
this.componentStates.set(name, "starting-timed-out");
|
|
4359
|
-
this.logger.entity(name).error("Component startup timed out", {
|
|
4386
|
+
this.logger.entity(name).error("Component startup timed out: {{error.message}}", {
|
|
4360
4387
|
params: { error: err }
|
|
4361
4388
|
});
|
|
4362
4389
|
this.lifecycleEvents.componentStartTimeout(name, err, {
|
|
@@ -4365,7 +4392,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4365
4392
|
});
|
|
4366
4393
|
} else {
|
|
4367
4394
|
this.componentStates.set(name, "registered");
|
|
4368
|
-
this.logger.entity(name).error("Component failed to start", {
|
|
4395
|
+
this.logger.entity(name).error("Component failed to start: {{error.message}}", {
|
|
4369
4396
|
params: { error: err }
|
|
4370
4397
|
});
|
|
4371
4398
|
this.lifecycleEvents.componentStartFailed(name, err, {
|
|
@@ -4497,8 +4524,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4497
4524
|
Promise.resolve().then(() => component.onShutdownWarning?.()).then(() => {
|
|
4498
4525
|
this.lifecycleEvents.componentShutdownWarningCompleted(name);
|
|
4499
4526
|
}).catch((error) => {
|
|
4500
|
-
|
|
4501
|
-
|
|
4527
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4528
|
+
this.logger.entity(name).warn("Shutdown warning phase failed: {{error.message}}", {
|
|
4529
|
+
params: { error: err }
|
|
4502
4530
|
});
|
|
4503
4531
|
});
|
|
4504
4532
|
}
|
|
@@ -4520,8 +4548,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4520
4548
|
this.lifecycleEvents.componentShutdownWarningCompleted(name);
|
|
4521
4549
|
}).catch((error) => {
|
|
4522
4550
|
statuses.set(name, "rejected");
|
|
4523
|
-
|
|
4524
|
-
|
|
4551
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4552
|
+
this.logger.entity(name).warn("Shutdown warning phase failed: {{error.message}}", {
|
|
4553
|
+
params: { error: err }
|
|
4525
4554
|
});
|
|
4526
4555
|
})
|
|
4527
4556
|
);
|
|
@@ -4580,9 +4609,13 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4580
4609
|
try {
|
|
4581
4610
|
component.onGracefulStopTimeout();
|
|
4582
4611
|
} catch (error) {
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4612
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4613
|
+
this.logger.entity(name).warn(
|
|
4614
|
+
"Error in onGracefulStopTimeout callback: {{error.message}}",
|
|
4615
|
+
{
|
|
4616
|
+
params: { error: err }
|
|
4617
|
+
}
|
|
4618
|
+
);
|
|
4586
4619
|
}
|
|
4587
4620
|
}
|
|
4588
4621
|
Promise.resolve(stopPromise).catch(() => {
|
|
@@ -4626,7 +4659,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4626
4659
|
status: this.getComponentStatus(name)
|
|
4627
4660
|
};
|
|
4628
4661
|
} catch (error) {
|
|
4629
|
-
const err = error;
|
|
4662
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4630
4663
|
this.componentErrors.set(name, err);
|
|
4631
4664
|
if (err instanceof ComponentStopTimeoutError && err.additionalInfo.componentName === name) {
|
|
4632
4665
|
this.logger.entity(name).warn("Graceful shutdown timed out");
|
|
@@ -4643,7 +4676,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4643
4676
|
status: this.getComponentStatus(name)
|
|
4644
4677
|
};
|
|
4645
4678
|
} else {
|
|
4646
|
-
this.logger.entity(name).warn("Graceful shutdown threw error", {
|
|
4679
|
+
this.logger.entity(name).warn("Graceful shutdown threw error: {{error.message}}", {
|
|
4647
4680
|
params: { error: err }
|
|
4648
4681
|
});
|
|
4649
4682
|
return {
|
|
@@ -4724,9 +4757,13 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4724
4757
|
try {
|
|
4725
4758
|
component.onShutdownForceAborted();
|
|
4726
4759
|
} catch (error) {
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4760
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4761
|
+
this.logger.entity(name).warn(
|
|
4762
|
+
"Error in onShutdownForceAborted callback: {{error.message}}",
|
|
4763
|
+
{
|
|
4764
|
+
params: { error: err }
|
|
4765
|
+
}
|
|
4766
|
+
);
|
|
4730
4767
|
}
|
|
4731
4768
|
}
|
|
4732
4769
|
Promise.resolve(forcePromise).catch(() => {
|
|
@@ -4766,7 +4803,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4766
4803
|
status: this.getComponentStatus(name)
|
|
4767
4804
|
};
|
|
4768
4805
|
} catch (error) {
|
|
4769
|
-
const err = error;
|
|
4806
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4770
4807
|
const isTimeout = err.message === "Force shutdown timed out";
|
|
4771
4808
|
const stallInfo = {
|
|
4772
4809
|
name,
|
|
@@ -4787,7 +4824,7 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4787
4824
|
});
|
|
4788
4825
|
this.lifecycleEvents.componentShutdownForceTimeout(name, timeoutMS);
|
|
4789
4826
|
} else {
|
|
4790
|
-
this.logger.entity(name).error("Force shutdown failed - stalled", {
|
|
4827
|
+
this.logger.entity(name).error("Force shutdown failed - stalled: {{error.message}}", {
|
|
4791
4828
|
params: { error: err }
|
|
4792
4829
|
});
|
|
4793
4830
|
}
|
|
@@ -4876,9 +4913,14 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4876
4913
|
this.lifecycleEvents.componentStartupRollback(name);
|
|
4877
4914
|
const result = await this.stopComponentInternal(name);
|
|
4878
4915
|
if (!result.success) {
|
|
4879
|
-
this.logger.entity(name).warn(
|
|
4880
|
-
|
|
4881
|
-
|
|
4916
|
+
this.logger.entity(name).warn(
|
|
4917
|
+
"Failed to stop component during rollback, continuing: {{error.message}}",
|
|
4918
|
+
{
|
|
4919
|
+
params: {
|
|
4920
|
+
error: result.error || new Error(result.reason || "Unknown error")
|
|
4921
|
+
}
|
|
4922
|
+
}
|
|
4923
|
+
);
|
|
4882
4924
|
}
|
|
4883
4925
|
}
|
|
4884
4926
|
this.logger.info("Rollback completed");
|
|
@@ -4941,8 +4983,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4941
4983
|
try {
|
|
4942
4984
|
this.emit(event, data);
|
|
4943
4985
|
} catch (error) {
|
|
4944
|
-
|
|
4945
|
-
|
|
4986
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4987
|
+
this.logger.error("Event handler error: {{error.message}}", {
|
|
4988
|
+
params: { event, error: err }
|
|
4946
4989
|
});
|
|
4947
4990
|
}
|
|
4948
4991
|
}
|
|
@@ -4951,9 +4994,13 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4951
4994
|
try {
|
|
4952
4995
|
startupOrder = this.getStartupOrderInternal();
|
|
4953
4996
|
} catch (error) {
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4997
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
4998
|
+
this.logger.warn(
|
|
4999
|
+
"Failed to compute startup order in error handler: {{error.message}}",
|
|
5000
|
+
{
|
|
5001
|
+
params: { error: err }
|
|
5002
|
+
}
|
|
5003
|
+
);
|
|
4957
5004
|
startupOrder = [];
|
|
4958
5005
|
}
|
|
4959
5006
|
return {
|
|
@@ -4974,9 +5021,13 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
4974
5021
|
try {
|
|
4975
5022
|
startupOrder = this.getStartupOrderInternal();
|
|
4976
5023
|
} catch (error) {
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
5024
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
5025
|
+
this.logger.warn(
|
|
5026
|
+
"Failed to compute startup order in error handler: {{error.message}}",
|
|
5027
|
+
{
|
|
5028
|
+
params: { error: err }
|
|
5029
|
+
}
|
|
5030
|
+
);
|
|
4980
5031
|
startupOrder = [];
|
|
4981
5032
|
}
|
|
4982
5033
|
return {
|
|
@@ -5370,7 +5421,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
5370
5421
|
}
|
|
5371
5422
|
} catch (error) {
|
|
5372
5423
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
5373
|
-
this.logger.entity(name).error("Reload failed
|
|
5424
|
+
this.logger.entity(name).error("Reload failed: {{error.message}}", {
|
|
5425
|
+
params: { error: err }
|
|
5426
|
+
});
|
|
5374
5427
|
this.lifecycleEvents.componentReloadFailed(name, err);
|
|
5375
5428
|
results.push({
|
|
5376
5429
|
name,
|
|
@@ -5465,7 +5518,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
5465
5518
|
}
|
|
5466
5519
|
} catch (error) {
|
|
5467
5520
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
5468
|
-
this.logger.entity(name).error("Info handler failed
|
|
5521
|
+
this.logger.entity(name).error("Info handler failed: {{error.message}}", {
|
|
5522
|
+
params: { error: err }
|
|
5523
|
+
});
|
|
5469
5524
|
this.lifecycleEvents.componentInfoFailed(name, err);
|
|
5470
5525
|
results.push({
|
|
5471
5526
|
name,
|
|
@@ -5560,7 +5615,9 @@ var LifecycleManager = class extends EventEmitterProtected {
|
|
|
5560
5615
|
}
|
|
5561
5616
|
} catch (error) {
|
|
5562
5617
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
5563
|
-
this.logger.entity(name).error("Debug handler failed
|
|
5618
|
+
this.logger.entity(name).error("Debug handler failed: {{error.message}}", {
|
|
5619
|
+
params: { error: err }
|
|
5620
|
+
});
|
|
5564
5621
|
this.lifecycleEvents.componentDebugFailed(name, err);
|
|
5565
5622
|
results.push({
|
|
5566
5623
|
name,
|