@btravstack/core 0.31.0 → 0.32.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/README.md +8 -0
- package/dist/index.cjs +9 -0
- package/dist/index.d.cts +12 -2
- package/dist/index.d.mts +12 -2
- package/dist/index.mjs +9 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -142,6 +142,14 @@ them and none should own a private copy:
|
|
|
142
142
|
`ff` — so your runtime falls back to its own id instead of adopting one that
|
|
143
143
|
means nothing. A higher version's extra fields are read rather than refused.
|
|
144
144
|
|
|
145
|
+
## Application infrastructure exports
|
|
146
|
+
|
|
147
|
+
`infrastructureExports(imports, provides)` returns the publicly available
|
|
148
|
+
`Logger` and `HealthChecks` ports from imported modules and root providers.
|
|
149
|
+
`InfrastructureExports<I, P>` describes those ports at the type level.
|
|
150
|
+
It follows whole-module re-exports while keeping private providers and business
|
|
151
|
+
ports hidden. Application starters use it alongside their own runtime exports.
|
|
152
|
+
|
|
145
153
|
## What you get
|
|
146
154
|
|
|
147
155
|
- **A drain that survives Kubernetes.** On SIGTERM: readiness flips false, the
|
package/dist/index.cjs
CHANGED
|
@@ -1050,6 +1050,14 @@ const noObserverMember = _btravstack_di.Provider.member(Observers)({
|
|
|
1050
1050
|
value: noObserver
|
|
1051
1051
|
});
|
|
1052
1052
|
//#endregion
|
|
1053
|
+
//#region src/infrastructure-exports.ts
|
|
1054
|
+
const exportedPorts = (module) => module.exports.flatMap((entry) => "portId" in entry ? [entry] : exportedPorts(entry));
|
|
1055
|
+
/** Export visible Logger and HealthChecks ports without exposing private or business ports. */
|
|
1056
|
+
const infrastructureExports = (imports, provides) => {
|
|
1057
|
+
const visible = /* @__PURE__ */ new Set([...imports.flatMap(exportedPorts).map((port) => port.portId), ...provides.map((provider) => provider.port.portId)]);
|
|
1058
|
+
return [Logger, HealthChecks].filter((port) => visible.has(port.portId));
|
|
1059
|
+
};
|
|
1060
|
+
//#endregion
|
|
1053
1061
|
exports.HealthCheckFailed = HealthCheckFailed;
|
|
1054
1062
|
exports.HealthChecks = HealthChecks;
|
|
1055
1063
|
exports.Instrumentations = Instrumentations;
|
|
@@ -1065,6 +1073,7 @@ exports.UnitOverrides = UnitOverrides;
|
|
|
1065
1073
|
exports.composeByPrefix = composeByPrefix;
|
|
1066
1074
|
exports.currentUnit = currentUnit;
|
|
1067
1075
|
exports.dispatchUnit = dispatchUnit;
|
|
1076
|
+
exports.infrastructureExports = infrastructureExports;
|
|
1068
1077
|
exports.mintPiece = mintPiece;
|
|
1069
1078
|
exports.noObserver = noObserver;
|
|
1070
1079
|
exports.noObserverMember = noObserverMember;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncResult, FailureView, Result } from "unthrown";
|
|
2
|
-
import { AnyPort, AnyProvider, Context, DependencyGate, Module, PortClass, PortInstance, Provider, Scope, SeedEntry, ServiceOf } from "@btravstack/di";
|
|
2
|
+
import { AnyModule, AnyPort, AnyProvider, Context, DependencyGate, Module, PortClass, PortInstance, Provider, Scope, SeedEntry, ServiceOf } from "@btravstack/di";
|
|
3
3
|
import { Env, Environment, EnvironmentFor } from "@btravstack/config";
|
|
4
4
|
//#region src/instrumentation.d.ts
|
|
5
5
|
/**
|
|
@@ -1014,4 +1014,14 @@ export declare const noObserverMember: Provider<Observers, never, never> & {
|
|
|
1014
1014
|
readonly port: typeof Observers;
|
|
1015
1015
|
};
|
|
1016
1016
|
//#endregion
|
|
1017
|
-
|
|
1017
|
+
//#region src/infrastructure-exports.d.ts
|
|
1018
|
+
type ModuleExports<M> = M extends Module<infer X, infer _E, infer _N> ? X : never;
|
|
1019
|
+
type ProviderPorts<P> = P extends Provider<infer X, infer _E, infer _N> ? X : never;
|
|
1020
|
+
type Available<I extends readonly AnyModule[], P extends readonly AnyProvider[]> = ModuleExports<I[number]> | ProviderPorts<P[number]>;
|
|
1021
|
+
type VisibleInfrastructure<P, Visible> = P extends AnyPort ? InstanceType<P> extends Visible ? P : never : never;
|
|
1022
|
+
/** Kernel infrastructure publicly available through an application root. */
|
|
1023
|
+
type InfrastructureExports<I extends readonly AnyModule[], P extends readonly AnyProvider[]> = readonly VisibleInfrastructure<typeof Logger | typeof HealthChecks, Available<I, P>>[];
|
|
1024
|
+
/** Export visible Logger and HealthChecks ports without exposing private or business ports. */
|
|
1025
|
+
export declare const infrastructureExports: <const I extends readonly AnyModule[], const P extends readonly AnyProvider[]>(imports: I, provides: P) => InfrastructureExports<I, P>;
|
|
1026
|
+
//#endregion
|
|
1027
|
+
export type { AnyUnitModule, Attributes, Clock, ComponentHealth, Counter, DrainReport, EventSink, ExitReport, HealthCheck, HealthReport, Histogram, InfrastructureExports, 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,4 +1,4 @@
|
|
|
1
|
-
import { AnyPort, AnyProvider, Context, DependencyGate, Module, PortClass, PortInstance, Provider, Scope, SeedEntry, ServiceOf } from "@btravstack/di";
|
|
1
|
+
import { AnyModule, AnyPort, AnyProvider, Context, DependencyGate, Module, PortClass, PortInstance, Provider, Scope, SeedEntry, ServiceOf } from "@btravstack/di";
|
|
2
2
|
import { AsyncResult, FailureView, Result } from "unthrown";
|
|
3
3
|
import { Env, Environment, EnvironmentFor } from "@btravstack/config";
|
|
4
4
|
//#region src/instrumentation.d.ts
|
|
@@ -1014,4 +1014,14 @@ export declare const noObserverMember: Provider<Observers, never, never> & {
|
|
|
1014
1014
|
readonly port: typeof Observers;
|
|
1015
1015
|
};
|
|
1016
1016
|
//#endregion
|
|
1017
|
-
|
|
1017
|
+
//#region src/infrastructure-exports.d.ts
|
|
1018
|
+
type ModuleExports<M> = M extends Module<infer X, infer _E, infer _N> ? X : never;
|
|
1019
|
+
type ProviderPorts<P> = P extends Provider<infer X, infer _E, infer _N> ? X : never;
|
|
1020
|
+
type Available<I extends readonly AnyModule[], P extends readonly AnyProvider[]> = ModuleExports<I[number]> | ProviderPorts<P[number]>;
|
|
1021
|
+
type VisibleInfrastructure<P, Visible> = P extends AnyPort ? InstanceType<P> extends Visible ? P : never : never;
|
|
1022
|
+
/** Kernel infrastructure publicly available through an application root. */
|
|
1023
|
+
type InfrastructureExports<I extends readonly AnyModule[], P extends readonly AnyProvider[]> = readonly VisibleInfrastructure<typeof Logger | typeof HealthChecks, Available<I, P>>[];
|
|
1024
|
+
/** Export visible Logger and HealthChecks ports without exposing private or business ports. */
|
|
1025
|
+
export declare const infrastructureExports: <const I extends readonly AnyModule[], const P extends readonly AnyProvider[]>(imports: I, provides: P) => InfrastructureExports<I, P>;
|
|
1026
|
+
//#endregion
|
|
1027
|
+
export type { AnyUnitModule, Attributes, Clock, ComponentHealth, Counter, DrainReport, EventSink, ExitReport, HealthCheck, HealthReport, Histogram, InfrastructureExports, 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.mjs
CHANGED
|
@@ -1049,4 +1049,12 @@ const noObserverMember = Provider.member(Observers)({
|
|
|
1049
1049
|
value: noObserver
|
|
1050
1050
|
});
|
|
1051
1051
|
//#endregion
|
|
1052
|
-
|
|
1052
|
+
//#region src/infrastructure-exports.ts
|
|
1053
|
+
const exportedPorts = (module) => module.exports.flatMap((entry) => "portId" in entry ? [entry] : exportedPorts(entry));
|
|
1054
|
+
/** Export visible Logger and HealthChecks ports without exposing private or business ports. */
|
|
1055
|
+
const infrastructureExports = (imports, provides) => {
|
|
1056
|
+
const visible = /* @__PURE__ */ new Set([...imports.flatMap(exportedPorts).map((port) => port.portId), ...provides.map((provider) => provider.port.portId)]);
|
|
1057
|
+
return [Logger, HealthChecks].filter((port) => visible.has(port.portId));
|
|
1058
|
+
};
|
|
1059
|
+
//#endregion
|
|
1060
|
+
export { HealthCheckFailed, HealthChecks, Instrumentations, LEVELS, Logger, Meter, Observers, RuntimePort, RuntimeStartFailed, SPAN_STATUS, Tracer, UnitOverrides, composeByPrefix, currentUnit, dispatchUnit, infrastructureExports, mintPiece, noObserver, noObserverMember, observe, observed, releasedBy, runHealthChecks, runMain, start, stderrSink, systemClock, traceIdOfTraceparent, unitOutcome, withUnitRecord };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.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.32.0",
|
|
49
|
+
"@btravstack/di": "0.32.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.32.0",
|
|
64
|
+
"@btravstack/di": "^0.32.0",
|
|
65
65
|
"unthrown": "^5.0.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|