@btravstack/core 0.24.0 → 0.26.0
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/index.d.cts +28 -6
- package/dist/index.d.mts +28 -6
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncResult, FailureView, Result } from "unthrown";
|
|
2
2
|
import { AnyPort, AnyProvider, Context, DependencyGate, Module, PortClass, PortInstance, Provider, Scope, SeedEntry, ServiceOf } from "@btravstack/di";
|
|
3
|
-
import { Env, Environment } from "@btravstack/config";
|
|
3
|
+
import { Env, Environment, EnvironmentFor } from "@btravstack/config";
|
|
4
4
|
//#region src/instrumentation.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* One package's offer of an OpenTelemetry instrumentation.
|
|
@@ -761,12 +761,34 @@ type ExitReport = {
|
|
|
761
761
|
*/
|
|
762
762
|
readonly abandonedAt?: "build" | "stop";
|
|
763
763
|
};
|
|
764
|
-
|
|
764
|
+
/**
|
|
765
|
+
* The kernel's own variables, all optional: each has a default, and each is
|
|
766
|
+
* pinned by the matching {@link StartOptions} field.
|
|
767
|
+
*/
|
|
768
|
+
type KernelEnvironment = {
|
|
769
|
+
readonly PROBE_PORT?: string | undefined;
|
|
770
|
+
readonly PROBE_HOST?: string | undefined;
|
|
771
|
+
readonly PRE_DRAIN_DELAY_MS?: string | undefined;
|
|
772
|
+
readonly DRAIN_TIMEOUT_MS?: string | undefined;
|
|
773
|
+
readonly STOP_TIMEOUT_MS?: string | undefined;
|
|
774
|
+
};
|
|
775
|
+
/**
|
|
776
|
+
* The `env` a `start` of `M` accepts — what the module's configuration reads,
|
|
777
|
+
* plus the kernel's own variables. For typing an environment kept apart from
|
|
778
|
+
* the call, such as a test's shared one.
|
|
779
|
+
*/
|
|
780
|
+
type StartEnvironment<M> = M extends Module<infer _X, infer _E, infer N> ? EnvironmentFor<N> & KernelEnvironment : never;
|
|
781
|
+
type StartOptions<Ev = Environment> = {
|
|
765
782
|
/**
|
|
766
783
|
* The environment the graph is configured from, provided to it as the `Env`
|
|
767
784
|
* port and read for the kernel's own variables. Defaults to `process.env`.
|
|
785
|
+
*
|
|
786
|
+
* Typed by what the graph reads: at `start(module, { env })` it accepts the
|
|
787
|
+
* variables the module's configuration names and the kernel's own, requires
|
|
788
|
+
* the ones nothing defaults or pins, and refuses any other — unless some
|
|
789
|
+
* reader named none, when any record is accepted.
|
|
768
790
|
*/
|
|
769
|
-
readonly env?:
|
|
791
|
+
readonly env?: Ev;
|
|
770
792
|
readonly clock?: Clock;
|
|
771
793
|
readonly signals?: boolean;
|
|
772
794
|
/**
|
|
@@ -875,7 +897,7 @@ type PortIdOf<P> = P extends PortInstance<infer Id, infer _Service> ? Id : P;
|
|
|
875
897
|
type StartGate<X, N = never> = [Exclude<N, Scope | Env>] extends [never] ? [Extract<X, RuntimeInstance>] extends [never] ? "NO RUNTIME — the module exports no port declared over RuntimePort" : [InstanceType<RuntimeResolvesOf<X>>] extends [X] ? unknown : "UNSATISFIED RUNTIME PORTS — the runtime resolves a port the module does not export" : {
|
|
876
898
|
readonly "UNSATISFIED DEPENDENCIES — nothing provides": PortIdOf<Exclude<N, Scope | Env>>;
|
|
877
899
|
};
|
|
878
|
-
export declare const start: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions) => RunningApp<E, RuntimeInfoOf<X>>;
|
|
900
|
+
export declare const start: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions<EnvironmentFor<N> & KernelEnvironment>) => RunningApp<E, RuntimeInfoOf<X>>;
|
|
879
901
|
//#endregion
|
|
880
902
|
//#region src/run-main.d.ts
|
|
881
903
|
/**
|
|
@@ -911,7 +933,7 @@ export declare const start: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>,
|
|
|
911
933
|
* await runMain(OrderApi);
|
|
912
934
|
* ```
|
|
913
935
|
*/
|
|
914
|
-
export declare const runMain: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions
|
|
936
|
+
export declare const runMain: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions<EnvironmentFor<N> & KernelEnvironment>, exit?: (code: number) => void) => Promise<void>;
|
|
915
937
|
//#endregion
|
|
916
938
|
//#region src/unit-overrides.d.ts
|
|
917
939
|
declare const UnitOverrides_base: import("@btravstack/di").ManyPortClass<"UnitOverrides">;
|
|
@@ -978,4 +1000,4 @@ export declare const noObserverMember: Provider<Observers, never, never> & {
|
|
|
978
1000
|
readonly port: typeof Observers;
|
|
979
1001
|
};
|
|
980
1002
|
//#endregion
|
|
981
|
-
export type { AnyUnitModule, Attributes, Clock, ComponentHealth, Counter, DrainReport, EventSink, ExitReport, HealthCheck, HealthReport, Histogram, InstrumentationLoader, KernelEvent, Level, LoggerService, MeterService, Operation, Phase, Refuse, RunUnit, RunningApp, Runtime, RuntimeHost, RuntimeInfoOf, Serving, Settle, Settled, Span, SpanStatusCode, StartGate, StartOptions, TeardownError, TracerService, UnitExportsOf, UnitGate, UnitHost, UnitMeta, UnitNeedsOf, UnitOutcome, UnitRecord, UnitRecordOf, UnitRegistry, UnitWork };
|
|
1003
|
+
export type { AnyUnitModule, Attributes, Clock, ComponentHealth, Counter, DrainReport, EventSink, ExitReport, HealthCheck, HealthReport, Histogram, InstrumentationLoader, KernelEnvironment, KernelEvent, Level, LoggerService, MeterService, Operation, Phase, Refuse, RunUnit, RunningApp, Runtime, RuntimeHost, RuntimeInfoOf, Serving, Settle, Settled, Span, SpanStatusCode, StartEnvironment, StartGate, StartOptions, TeardownError, TracerService, UnitExportsOf, UnitGate, UnitHost, UnitMeta, UnitNeedsOf, UnitOutcome, UnitRecord, UnitRecordOf, UnitRegistry, UnitWork };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyPort, AnyProvider, Context, DependencyGate, Module, PortClass, PortInstance, Provider, Scope, SeedEntry, ServiceOf } from "@btravstack/di";
|
|
2
2
|
import { AsyncResult, FailureView, Result } from "unthrown";
|
|
3
|
-
import { Env, Environment } from "@btravstack/config";
|
|
3
|
+
import { Env, Environment, EnvironmentFor } from "@btravstack/config";
|
|
4
4
|
//#region src/instrumentation.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* One package's offer of an OpenTelemetry instrumentation.
|
|
@@ -761,12 +761,34 @@ type ExitReport = {
|
|
|
761
761
|
*/
|
|
762
762
|
readonly abandonedAt?: "build" | "stop";
|
|
763
763
|
};
|
|
764
|
-
|
|
764
|
+
/**
|
|
765
|
+
* The kernel's own variables, all optional: each has a default, and each is
|
|
766
|
+
* pinned by the matching {@link StartOptions} field.
|
|
767
|
+
*/
|
|
768
|
+
type KernelEnvironment = {
|
|
769
|
+
readonly PROBE_PORT?: string | undefined;
|
|
770
|
+
readonly PROBE_HOST?: string | undefined;
|
|
771
|
+
readonly PRE_DRAIN_DELAY_MS?: string | undefined;
|
|
772
|
+
readonly DRAIN_TIMEOUT_MS?: string | undefined;
|
|
773
|
+
readonly STOP_TIMEOUT_MS?: string | undefined;
|
|
774
|
+
};
|
|
775
|
+
/**
|
|
776
|
+
* The `env` a `start` of `M` accepts — what the module's configuration reads,
|
|
777
|
+
* plus the kernel's own variables. For typing an environment kept apart from
|
|
778
|
+
* the call, such as a test's shared one.
|
|
779
|
+
*/
|
|
780
|
+
type StartEnvironment<M> = M extends Module<infer _X, infer _E, infer N> ? EnvironmentFor<N> & KernelEnvironment : never;
|
|
781
|
+
type StartOptions<Ev = Environment> = {
|
|
765
782
|
/**
|
|
766
783
|
* The environment the graph is configured from, provided to it as the `Env`
|
|
767
784
|
* port and read for the kernel's own variables. Defaults to `process.env`.
|
|
785
|
+
*
|
|
786
|
+
* Typed by what the graph reads: at `start(module, { env })` it accepts the
|
|
787
|
+
* variables the module's configuration names and the kernel's own, requires
|
|
788
|
+
* the ones nothing defaults or pins, and refuses any other — unless some
|
|
789
|
+
* reader named none, when any record is accepted.
|
|
768
790
|
*/
|
|
769
|
-
readonly env?:
|
|
791
|
+
readonly env?: Ev;
|
|
770
792
|
readonly clock?: Clock;
|
|
771
793
|
readonly signals?: boolean;
|
|
772
794
|
/**
|
|
@@ -875,7 +897,7 @@ type PortIdOf<P> = P extends PortInstance<infer Id, infer _Service> ? Id : P;
|
|
|
875
897
|
type StartGate<X, N = never> = [Exclude<N, Scope | Env>] extends [never] ? [Extract<X, RuntimeInstance>] extends [never] ? "NO RUNTIME — the module exports no port declared over RuntimePort" : [InstanceType<RuntimeResolvesOf<X>>] extends [X] ? unknown : "UNSATISFIED RUNTIME PORTS — the runtime resolves a port the module does not export" : {
|
|
876
898
|
readonly "UNSATISFIED DEPENDENCIES — nothing provides": PortIdOf<Exclude<N, Scope | Env>>;
|
|
877
899
|
};
|
|
878
|
-
export declare const start: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions) => RunningApp<E, RuntimeInfoOf<X>>;
|
|
900
|
+
export declare const start: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions<EnvironmentFor<N> & KernelEnvironment>) => RunningApp<E, RuntimeInfoOf<X>>;
|
|
879
901
|
//#endregion
|
|
880
902
|
//#region src/run-main.d.ts
|
|
881
903
|
/**
|
|
@@ -911,7 +933,7 @@ export declare const start: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>,
|
|
|
911
933
|
* await runMain(OrderApi);
|
|
912
934
|
* ```
|
|
913
935
|
*/
|
|
914
|
-
export declare const runMain: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions
|
|
936
|
+
export declare const runMain: <X, E, N>(module: Module<X, E, N> & StartGate<X, N>, options?: StartOptions<EnvironmentFor<N> & KernelEnvironment>, exit?: (code: number) => void) => Promise<void>;
|
|
915
937
|
//#endregion
|
|
916
938
|
//#region src/unit-overrides.d.ts
|
|
917
939
|
declare const UnitOverrides_base: import("@btravstack/di").ManyPortClass<"UnitOverrides">;
|
|
@@ -978,4 +1000,4 @@ export declare const noObserverMember: Provider<Observers, never, never> & {
|
|
|
978
1000
|
readonly port: typeof Observers;
|
|
979
1001
|
};
|
|
980
1002
|
//#endregion
|
|
981
|
-
export type { AnyUnitModule, Attributes, Clock, ComponentHealth, Counter, DrainReport, EventSink, ExitReport, HealthCheck, HealthReport, Histogram, InstrumentationLoader, KernelEvent, Level, LoggerService, MeterService, Operation, Phase, Refuse, RunUnit, RunningApp, Runtime, RuntimeHost, RuntimeInfoOf, Serving, Settle, Settled, Span, SpanStatusCode, StartGate, StartOptions, TeardownError, TracerService, UnitExportsOf, UnitGate, UnitHost, UnitMeta, UnitNeedsOf, UnitOutcome, UnitRecord, UnitRecordOf, UnitRegistry, UnitWork };
|
|
1003
|
+
export type { AnyUnitModule, Attributes, Clock, ComponentHealth, Counter, DrainReport, EventSink, ExitReport, HealthCheck, HealthReport, Histogram, InstrumentationLoader, KernelEnvironment, KernelEvent, Level, LoggerService, MeterService, Operation, Phase, Refuse, RunUnit, RunningApp, Runtime, RuntimeHost, RuntimeInfoOf, Serving, Settle, Settled, Span, SpanStatusCode, StartEnvironment, StartGate, StartOptions, TeardownError, TracerService, UnitExportsOf, UnitGate, UnitHost, UnitMeta, UnitNeedsOf, UnitOutcome, UnitRecord, UnitRecordOf, UnitRegistry, UnitWork };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "The application kernel: boot a di module into a running process, and stop it without losing work",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"application",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"./package.json": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@btravstack/config": "0.
|
|
49
|
-
"@btravstack/di": "0.
|
|
48
|
+
"@btravstack/config": "0.26.0",
|
|
49
|
+
"@btravstack/di": "0.26.0",
|
|
50
50
|
"@btravstack/tsconfig": "0.4.0",
|
|
51
51
|
"@stryker-mutator/core": "10.0.0",
|
|
52
52
|
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"vitest": "5.0.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@btravstack/config": "^0.
|
|
64
|
-
"@btravstack/di": "^0.
|
|
63
|
+
"@btravstack/config": "^0.26.0",
|
|
64
|
+
"@btravstack/di": "^0.26.0",
|
|
65
65
|
"unthrown": "^5.0.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|