@bleedingdev/modern-js-server-runtime-extensions 3.9.0-ultramodern.4 → 3.9.0-ultramodern.6

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.
Files changed (178) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/bff-policy/crossProjectPolicy.js +299 -0
  3. package/dist/cjs/bff-policy/index.js +62 -0
  4. package/dist/cjs/bff-policy/node.js +69 -0
  5. package/dist/cjs/bff-policy/operationContracts.js +182 -0
  6. package/dist/cjs/bff-policy/resolveCrossProjectPolicy.js +65 -0
  7. package/dist/cjs/contract-gate-snapshot-store/http-store.js +1 -8
  8. package/dist/cjs/errorResponsePlugin.js +57 -0
  9. package/dist/cjs/localisedLoaderPlugin.js +62 -0
  10. package/dist/cjs/mfCache.js +6 -0
  11. package/dist/cjs/module-federation-css/plugin.js +6 -0
  12. package/dist/cjs/serverConfig.js +18 -0
  13. package/dist/cjs/serverPlugin.js +74 -0
  14. package/dist/cjs/static-serving/plugin.js +57 -0
  15. package/dist/cjs/static-serving/responders.js +158 -0
  16. package/dist/cjs/static-serving/staticModuleFederation.js +173 -0
  17. package/dist/cjs/static-serving/staticPrecompressed.js +152 -0
  18. package/dist/cjs/telemetry/exporters.js +4 -4
  19. package/dist/cjs/telemetry/healthSetup.js +14 -14
  20. package/dist/cjs/telemetry/lifecycle.js +20 -21
  21. package/dist/cjs/telemetry/plugin.js +10 -4
  22. package/dist/cjs/telemetry/runtimeEndpoints.js +3 -2
  23. package/dist/cjs/telemetryCore.js +5 -5
  24. package/dist/esm/bff-policy/crossProjectPolicy.mjs +249 -0
  25. package/dist/esm/bff-policy/index.mjs +1 -0
  26. package/dist/esm/contract-gate-snapshot-store/http-store.mjs +1 -8
  27. package/dist/esm/errorResponsePlugin.mjs +19 -0
  28. package/dist/esm/localisedLoaderPlugin.mjs +24 -0
  29. package/dist/esm/mfCache.mjs +6 -0
  30. package/dist/esm/module-federation-css/plugin.mjs +6 -0
  31. package/dist/esm/serverConfig.mjs +0 -0
  32. package/dist/esm/serverPlugin.mjs +34 -0
  33. package/dist/esm/telemetry/exporters.mjs +2 -2
  34. package/dist/esm/telemetry/healthSetup.mjs +14 -14
  35. package/dist/esm/telemetry/lifecycle.mjs +21 -22
  36. package/dist/esm/telemetry/plugin.mjs +9 -3
  37. package/dist/esm/telemetry/runtimeEndpoints.mjs +3 -2
  38. package/dist/esm/telemetryCore.mjs +1 -1
  39. package/dist/esm-node/bff-policy/crossProjectPolicy.mjs +250 -0
  40. package/dist/esm-node/bff-policy/index.mjs +2 -0
  41. package/dist/esm-node/bff-policy/node.mjs +3 -0
  42. package/dist/esm-node/bff-policy/operationContracts.mjs +129 -0
  43. package/dist/esm-node/bff-policy/resolveCrossProjectPolicy.mjs +28 -0
  44. package/dist/esm-node/contract-gate-snapshot-store/http-store.mjs +1 -8
  45. package/dist/esm-node/errorResponsePlugin.mjs +20 -0
  46. package/dist/esm-node/localisedLoaderPlugin.mjs +25 -0
  47. package/dist/esm-node/mfCache.mjs +6 -0
  48. package/dist/esm-node/module-federation-css/plugin.mjs +6 -0
  49. package/dist/esm-node/serverConfig.mjs +1 -0
  50. package/dist/esm-node/serverPlugin.mjs +35 -0
  51. package/dist/esm-node/static-serving/plugin.mjs +18 -0
  52. package/dist/esm-node/static-serving/responders.mjs +111 -0
  53. package/dist/esm-node/static-serving/staticModuleFederation.mjs +105 -0
  54. package/dist/esm-node/static-serving/staticPrecompressed.mjs +112 -0
  55. package/dist/esm-node/telemetry/exporters.mjs +2 -2
  56. package/dist/esm-node/telemetry/healthSetup.mjs +14 -14
  57. package/dist/esm-node/telemetry/lifecycle.mjs +21 -22
  58. package/dist/esm-node/telemetry/plugin.mjs +9 -3
  59. package/dist/esm-node/telemetry/runtimeEndpoints.mjs +3 -2
  60. package/dist/esm-node/telemetryCore.mjs +1 -1
  61. package/dist/types/bff-policy/crossProjectPolicy.d.ts +101 -0
  62. package/dist/types/bff-policy/index.d.ts +1 -0
  63. package/dist/types/bff-policy/node.d.ts +2 -0
  64. package/dist/types/bff-policy/operationContracts.d.ts +85 -0
  65. package/dist/types/bff-policy/resolveCrossProjectPolicy.d.ts +39 -0
  66. package/dist/types/errorResponsePlugin.d.ts +3 -0
  67. package/dist/types/index.d.ts +1 -0
  68. package/dist/types/localisedLoaderPlugin.d.ts +2 -0
  69. package/dist/types/mfCache.d.ts +2 -3
  70. package/dist/types/module-federation-css/plugin.d.ts +2 -3
  71. package/dist/types/serverConfig.d.ts +17 -0
  72. package/dist/types/serverPlugin.d.ts +5 -0
  73. package/dist/types/static-serving/plugin.d.ts +3 -0
  74. package/dist/types/static-serving/responders.d.ts +2 -0
  75. package/dist/types/static-serving/staticModuleFederation.d.ts +13 -0
  76. package/dist/types/static-serving/staticPrecompressed.d.ts +13 -0
  77. package/dist/types/telemetry/exporters.d.ts +1 -1
  78. package/dist/types/telemetry/healthSetup.d.ts +3 -3
  79. package/dist/types/telemetry/lifecycle.d.ts +4 -4
  80. package/dist/types/telemetry/plugin.d.ts +2 -1
  81. package/dist/types/telemetryCore.d.ts +1 -1
  82. package/dist/types-esm/backend-federation-security/index.d.mts +68 -0
  83. package/dist/types-esm/backend-federation-security/node.d.mts +3 -0
  84. package/dist/types-esm/bff-policy/crossProjectPolicy.d.mts +101 -0
  85. package/dist/types-esm/bff-policy/index.d.mts +1 -0
  86. package/dist/types-esm/bff-policy/node.d.mts +2 -0
  87. package/dist/types-esm/bff-policy/operationContracts.d.mts +85 -0
  88. package/dist/types-esm/bff-policy/resolveCrossProjectPolicy.d.mts +39 -0
  89. package/dist/types-esm/contract-gate-snapshot-normalization.d.mts +15 -0
  90. package/dist/types-esm/contract-gate-snapshot-store/file-store.d.mts +3 -0
  91. package/dist/types-esm/contract-gate-snapshot-store/http-store.d.mts +5 -0
  92. package/dist/types-esm/contract-gate-snapshot-store/index.d.mts +5 -0
  93. package/dist/types-esm/contract-gate-snapshot-store/resolve.d.mts +9 -0
  94. package/dist/types-esm/contract-gate-snapshot-store/types.d.mts +47 -0
  95. package/dist/types-esm/contractGateSnapshotObserver.d.mts +33 -0
  96. package/dist/types-esm/env.d.mts +40 -0
  97. package/dist/types-esm/errorResponsePlugin.d.mts +3 -0
  98. package/dist/types-esm/index.d.mts +8 -0
  99. package/dist/types-esm/localisedLoaderPlugin.d.mts +2 -0
  100. package/dist/types-esm/mfCache.d.mts +26 -0
  101. package/dist/types-esm/module-federation-css/collector.d.mts +25 -0
  102. package/dist/types-esm/module-federation-css/index.d.mts +8 -0
  103. package/dist/types-esm/module-federation-css/manifest.d.mts +28 -0
  104. package/dist/types-esm/module-federation-css/plugin.d.mts +22 -0
  105. package/dist/types-esm/module-federation-css/remote.d.mts +20 -0
  106. package/dist/types-esm/runtime-fallback-signal/index.d.mts +4 -0
  107. package/dist/types-esm/runtime-fallback-signal/model.d.mts +70 -0
  108. package/dist/types-esm/runtime-fallback-signal/resolver.d.mts +29 -0
  109. package/dist/types-esm/runtime-fallback-signal/store.d.mts +4 -0
  110. package/dist/types-esm/runtimeFallbackSignal.d.mts +1 -0
  111. package/dist/types-esm/runtimeLifecycle.d.mts +10 -0
  112. package/dist/types-esm/serverConfig.d.mts +17 -0
  113. package/dist/types-esm/serverPlugin.d.mts +5 -0
  114. package/dist/types-esm/static-serving/plugin.d.mts +3 -0
  115. package/dist/types-esm/static-serving/responders.d.mts +2 -0
  116. package/dist/types-esm/static-serving/staticModuleFederation.d.mts +13 -0
  117. package/dist/types-esm/static-serving/staticPrecompressed.d.mts +13 -0
  118. package/dist/types-esm/telemetry/envelope.d.mts +55 -0
  119. package/dist/types-esm/telemetry/exporters.d.mts +12 -0
  120. package/dist/types-esm/telemetry/healthEvaluation.d.mts +20 -0
  121. package/dist/types-esm/telemetry/healthMonitor.d.mts +88 -0
  122. package/dist/types-esm/telemetry/healthSetup.d.mts +17 -0
  123. package/dist/types-esm/telemetry/lifecycle.d.mts +18 -0
  124. package/dist/types-esm/telemetry/metrics.d.mts +3 -0
  125. package/dist/types-esm/telemetry/plugin.d.mts +13 -0
  126. package/dist/types-esm/telemetry/registry.d.mts +69 -0
  127. package/dist/types-esm/telemetry/registryTypes.d.mts +50 -0
  128. package/dist/types-esm/telemetry/runtimeEndpoints.d.mts +35 -0
  129. package/dist/types-esm/telemetry.d.mts +1 -0
  130. package/dist/types-esm/telemetryCore.d.mts +6 -0
  131. package/package.json +158 -26
  132. package/rslib.config.mts +36 -2
  133. package/rstest.config.mts +11 -0
  134. package/src/bff-policy/crossProjectPolicy.ts +754 -0
  135. package/src/bff-policy/index.ts +1 -0
  136. package/src/bff-policy/node.ts +2 -0
  137. package/src/bff-policy/operationContracts.ts +298 -0
  138. package/src/bff-policy/resolveCrossProjectPolicy.ts +88 -0
  139. package/src/contract-gate-snapshot-store/http-store.ts +1 -11
  140. package/src/errorResponsePlugin.ts +21 -0
  141. package/src/index.ts +4 -0
  142. package/src/localisedLoaderPlugin.ts +34 -0
  143. package/src/mfCache.ts +4 -3
  144. package/src/module-federation-css/plugin.ts +4 -3
  145. package/src/serverConfig.ts +32 -0
  146. package/src/serverPlugin.ts +38 -0
  147. package/src/static-serving/plugin.ts +16 -0
  148. package/src/static-serving/responders.ts +208 -0
  149. package/src/static-serving/staticModuleFederation.ts +255 -0
  150. package/src/static-serving/staticPrecompressed.ts +193 -0
  151. package/src/telemetry/exporters.ts +1 -1
  152. package/src/telemetry/healthSetup.ts +17 -20
  153. package/src/telemetry/lifecycle.ts +27 -39
  154. package/src/telemetry/plugin.ts +6 -4
  155. package/src/telemetry/runtimeEndpoints.ts +3 -2
  156. package/src/telemetryCore.ts +1 -1
  157. package/tests/bff-policy/crossProjectPolicy.matrix.test.ts +487 -0
  158. package/tests/bff-policy/crossProjectPolicy.test.ts +970 -0
  159. package/tests/bff-policy/operationContracts.test.ts +221 -0
  160. package/tests/bff-policy/optionalZodPeer.test.ts +30 -0
  161. package/tests/bff-policy/resolveCrossProjectPolicy.test.ts +134 -0
  162. package/tests/contractGateSnapshotObserver.test.ts +0 -58
  163. package/tests/env.test.ts +45 -64
  164. package/tests/localisedLoader.test.ts +120 -0
  165. package/tests/mfCache.test.ts +1 -88
  166. package/tests/moduleFederationCss.test.ts +4 -48
  167. package/tests/nativeErrorResponse.test.ts +199 -0
  168. package/tests/nativeServerAssembly.test.ts +402 -0
  169. package/tests/registration.test.ts +2 -87
  170. package/tests/runtimeLifecycle.test.ts +69 -17
  171. package/tests/static-serving/ordering.test.ts +214 -0
  172. package/tests/static-serving/provider.test.ts +83 -0
  173. package/tests/static-serving/static.test.ts +400 -0
  174. package/tests/telemetry.test.ts +35 -101
  175. package/tests/telemetryHealthMonitor.test.ts +0 -2
  176. package/tests/{telemetryAutopilot.test.ts → telemetryHealthObservation.test.ts} +43 -182
  177. package/tests/telemetryLifecycle.test.ts +11 -253
  178. package/tests/telemetryRegistryQueueMatrix.test.ts +0 -1
@@ -0,0 +1,5 @@
1
+ import type { ContractGateSnapshotHttpStoreOptions, ContractGateSnapshotStore, ContractGateSnapshotStoreUserConfig } from './types.mjs';
2
+ export declare const createHttpContractGateSnapshotStore: (options: ContractGateSnapshotHttpStoreOptions) => ContractGateSnapshotStore;
3
+ export declare const tryResolveBuiltinSnapshotStore: (input: {
4
+ stateStore: ContractGateSnapshotStoreUserConfig;
5
+ }) => ContractGateSnapshotStore | undefined;
@@ -0,0 +1,5 @@
1
+ export { createFileContractGateSnapshotStore, resolveContractGateSnapshotPath, } from './file-store.mjs';
2
+ export { createHttpContractGateSnapshotStore } from './http-store.mjs';
3
+ export { resolveContractGateSnapshotStore } from './resolve.mjs';
4
+ export type { ContractGateSnapshotHttpStoreOptions, ContractGateSnapshotStore, ContractGateSnapshotStoreFactory, ContractGateSnapshotStoreFactoryContext, ContractGateSnapshotStoreModule, ContractGateSnapshotStoreUserConfig, GateSnapshot, GateSnapshotGateValue, } from './types.mjs';
5
+ export { CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION, DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH, } from './types.mjs';
@@ -0,0 +1,9 @@
1
+ import type { ContractGateSnapshotStore, ContractGateSnapshotStoreUserConfig, GateSnapshot, LoggerLike } from './types.mjs';
2
+ export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
3
+ export declare const normalizeSnapshot: (snapshot: unknown) => GateSnapshot | undefined;
4
+ export declare const resolveContractGateSnapshotStore: (input: {
5
+ appDirectory: string;
6
+ gateSnapshotPath: string;
7
+ stateStore?: ContractGateSnapshotStoreUserConfig;
8
+ logger?: LoggerLike;
9
+ }) => Promise<ContractGateSnapshotStore>;
@@ -0,0 +1,47 @@
1
+ export declare const CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION = 1;
2
+ export declare const DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH = ".modern/contract-gates.json";
3
+ export type GateSnapshotGateValue = boolean | {
4
+ passed?: boolean;
5
+ reason?: string;
6
+ updatedAt?: number;
7
+ expiresAt?: number;
8
+ [key: string]: unknown;
9
+ };
10
+ export type GateSnapshot = {
11
+ schemaVersion?: number;
12
+ updatedAt?: number;
13
+ gates?: Record<string, GateSnapshotGateValue>;
14
+ };
15
+ export type LoggerLike = {
16
+ info?: (message: string) => void;
17
+ warn?: (message: string) => void;
18
+ };
19
+ export type ContractGateSnapshotStore = {
20
+ name: string;
21
+ readSnapshot: () => Promise<GateSnapshot | undefined>;
22
+ writeSnapshot: (snapshot: GateSnapshot) => Promise<void>;
23
+ };
24
+ export type ContractGateSnapshotStoreFactoryContext = {
25
+ appDirectory: string;
26
+ gateSnapshotPath: string;
27
+ options?: Record<string, unknown>;
28
+ logger?: LoggerLike;
29
+ };
30
+ export type ContractGateSnapshotStoreFactory = (context: ContractGateSnapshotStoreFactoryContext) => Promise<ContractGateSnapshotStore> | ContractGateSnapshotStore;
31
+ export type ContractGateSnapshotStoreModule = {
32
+ createContractGateSnapshotStore?: ContractGateSnapshotStoreFactory;
33
+ default?: ContractGateSnapshotStoreFactory | {
34
+ createContractGateSnapshotStore?: ContractGateSnapshotStoreFactory;
35
+ };
36
+ };
37
+ export type ContractGateSnapshotStoreUserConfig = {
38
+ module: string;
39
+ options?: Record<string, unknown>;
40
+ };
41
+ export type ContractGateSnapshotHttpStoreOptions = {
42
+ endpoint: string;
43
+ readMethod?: string;
44
+ writeMethod?: string;
45
+ headers?: Record<string, string>;
46
+ timeoutMs?: number;
47
+ };
@@ -0,0 +1,33 @@
1
+ import type { ContractGateSnapshotStore } from './contract-gate-snapshot-store/types.mjs';
2
+ import type { TelemetryHealthMonitor } from './telemetry/healthMonitor.mjs';
3
+ type LoggerLike = {
4
+ info?: (message: string) => void;
5
+ warn?: (message: string) => void;
6
+ };
7
+ export type ContractGateSnapshotObserverOptions = {
8
+ monitor: TelemetryHealthMonitor;
9
+ gateSnapshotPath?: string;
10
+ gateSnapshotStore?: ContractGateSnapshotStore;
11
+ pollIntervalMs?: number;
12
+ gateStaleAfterMs?: number;
13
+ logger?: LoggerLike;
14
+ };
15
+ /** Polls contract-gate snapshots and exposes them to telemetry health checks. */
16
+ export declare class ContractGateSnapshotObserver {
17
+ private readonly monitor;
18
+ private readonly gateSnapshotStore;
19
+ private readonly gateSnapshotPath?;
20
+ private readonly pollIntervalMs;
21
+ private readonly gateStaleAfterMs;
22
+ private readonly logger?;
23
+ private poller?;
24
+ private syncGeneration;
25
+ private readonly appliedGateFingerprints;
26
+ constructor(options: ContractGateSnapshotObserverOptions);
27
+ start(): Promise<void>;
28
+ stop(): void;
29
+ syncOnce(): Promise<number>;
30
+ private clearOmittedGates;
31
+ private loadSnapshot;
32
+ }
33
+ export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Single typed pass over the statically-known environment variables consumed
3
+ * by the ultramodern.js server runtime extensions (telemetry pipeline and
4
+ * contract-gate canary autopilot).
5
+ *
6
+ * Modules in this package read this environment state through
7
+ * `parseServerRuntimeExtensionsEnv()` so the surface is documented and
8
+ * testable in one place, with one documented exception: the telemetry
9
+ * runtime-fallback-signal auth config can name an arbitrary token variable
10
+ * via `auth.expectedValueEnv`, which is necessarily read dynamically from
11
+ * `process.env` when that config is normalized. See the package README for
12
+ * per-variable docs.
13
+ */
14
+ export declare const DEFAULT_ENVIRONMENT_NAME = "development";
15
+ export interface ServerRuntimeExtensionsEnv {
16
+ /**
17
+ * `MODERN_ENV` — deployment environment name loaded by the Modern.js env
18
+ * bootstrap (`.env.{MODERN_ENV}`). Undefined when unset or blank.
19
+ */
20
+ modernEnv?: string;
21
+ /** `NODE_ENV` — standard Node.js environment name. Undefined when unset or blank. */
22
+ nodeEnv?: string;
23
+ /**
24
+ * Effective telemetry environment label:
25
+ * `MODERN_ENV` || `NODE_ENV` || `"development"`.
26
+ */
27
+ environmentName: string;
28
+ /**
29
+ * `MODERN_CONTRACT_GATES_FILE` — path of the contract-gate snapshot file
30
+ * (absolute, or relative to the app directory). Undefined when unset.
31
+ */
32
+ contractGatesFile?: string;
33
+ }
34
+ /**
35
+ * Parse the statically-known environment variables consumed by this package
36
+ * in one typed, documented pass. Defaults are applied here so consumers never
37
+ * touch `process.env` directly (except the documented `expectedValueEnv`
38
+ * indirection above).
39
+ */
40
+ export declare const parseServerRuntimeExtensionsEnv: (env?: Record<string, string | undefined>) => ServerRuntimeExtensionsEnv;
@@ -0,0 +1,3 @@
1
+ import type { ServerPlugin } from '@modern-js/server-core';
2
+ /** Serialize unhandled BFF failures using the fork's public error contract. */
3
+ export declare const injectErrorResponsePlugin: () => ServerPlugin;
@@ -0,0 +1,8 @@
1
+ export { type BackendFederationCommonJsEvaluator, type BackendFederationEntryExports, type BackendFederationEntryIntegrity, type BackendFederationRemoteEntry, BackendFederationRemoteEntryError, type BackendFederationRemoteEntryErrorCode, type BackendFederationRemoteEntryExpectation, type BackendFederationRemoteEntryFetch, type BackendFederationRemoteEntryPolicy, type BackendFederationRemoteEntryVerification, type BackendFederationResourceFetch, type BackendFederationResourcePolicy, type BackendFederationResourceResponse, evaluateBackendFederationCommonJsEntry, type LoadBoundedBackendFederationResourceOptions, type LoadVerifiedBackendFederationEntryOptions, loadBoundedBackendFederationResource, loadVerifiedBackendFederationEntry, redactBackendFederationUrl, resolveBackendFederationRemoteEntryVerification, } from './backend-federation-security/index.mjs';
2
+ export { ContractGateSnapshotObserver, type ContractGateSnapshotObserverOptions, } from './contractGateSnapshotObserver.mjs';
3
+ export { DEFAULT_ENVIRONMENT_NAME, parseServerRuntimeExtensionsEnv, type ServerRuntimeExtensionsEnv, } from './env.mjs';
4
+ export { getRequestPathname, injectMfAssetCacheHeadersPlugin, isMfManifestAsset, isMfRemoteEntryAsset, resolveMfAssetCacheHeaders, } from './mfCache.mjs';
5
+ export { type CollectDirectRemoteModuleFederationCssOptions, collectDirectRemoteModuleFederationCss, collectDirectRemoteModuleFederationCssWithMeta, collectModuleFederationManifestCss, createModuleFederationCssCollector, injectModuleFederationCssPlugin, type ModuleFederationCssCollectorOptions, type ModuleFederationCssPluginOptions, type ModuleFederationManifest, type RemoteModuleFederationCssCollection, } from './module-federation-css/index.mjs';
6
+ export { createDisposableServerRuntimeHandle, type DisposableServerRuntimeHandle, disposeServerRuntime, initializeDisposableServerRuntime, registerServerRuntimeDisposer, type ServerRuntimeHandle, } from './runtimeLifecycle.mjs';
7
+ export type { UltramodernBffUserConfig, UltramodernServerUserConfig, } from './serverConfig.mjs';
8
+ export { createOtlpTelemetryExporter, createRuntimeFallbackSignalRuntimeState, createRuntimeSignalError, createTelemetryAwareMetrics, createVictoriaMetricsTelemetryExporter, DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT, DEFAULT_RUNTIME_STATUS_ENDPOINT, enforceRuntimeFallbackSignalAuthToken, enforceRuntimeFallbackSignalTrustPolicy, getRuntimeSignalErrorStatusCode, hasEnabledTelemetryExporters, injectTelemetryPlugin, normalizeRequiredRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackTrustPolicy, type OtlpExporterOptions, parseRuntimeFallbackSignalPayloadFromRawBody, type RuntimeFallbackSignalAuthConfig, type RuntimeFallbackSignalRuntimeState, type RuntimeFallbackSignalSource, type RuntimeFallbackSignalTrustContext, type RuntimeFallbackSignalTrustPolicy, type RuntimeSignalError, type RuntimeSignalErrorCode, resolveRuntimeFallbackSignalEndpoint, resolveTelemetrySloOptions, type TelemetryContractGateStatus, type TelemetryEnvelope, type TelemetryExporter, type TelemetryHealthEvaluation, type TelemetryHealthFailure, type TelemetryHealthFailureReason, TelemetryHealthMonitor, type TelemetryHealthMonitorOptions, type TelemetryHealthState, type TelemetryHealthStatusSnapshot, type TelemetryHealthTransition, type TelemetryQueueStats, TelemetryRegistry, type TelemetryRegistryOptions, type TelemetrySignalType, type TelemetrySloAlert, TelemetryStartupHealthError, type VictoriaMetricsExporterOptions, } from './telemetry.mjs';
@@ -0,0 +1,2 @@
1
+ import { type ServerPlugin } from '@modern-js/server-core';
2
+ export declare function injectLocalisedLoaderPlugin(): ServerPlugin;
@@ -0,0 +1,26 @@
1
+ import type { ServerPlugin } from '@modern-js/server-core';
2
+ export declare function getRequestPathname(url: string): string;
3
+ export declare function isMfManifestAsset(pathname: string): boolean;
4
+ export declare function isMfRemoteEntryAsset(pathname: string): boolean;
5
+ export declare function resolveMfAssetCacheHeaders(url: string, query?: Record<string, unknown>): {
6
+ 'cache-control': string;
7
+ pragma: string;
8
+ expires: string;
9
+ } | {
10
+ pragma?: undefined;
11
+ expires?: undefined;
12
+ 'cache-control': string;
13
+ } | undefined;
14
+ /**
15
+ * Applies the documented MF asset cache-header policy (ADR-0002) to responses
16
+ * for module federation manifest/remoteEntry endpoints:
17
+ *
18
+ * - `mf-manifest.json` / `mf-stats.json` are never cached (`no-store`), so
19
+ * hosts always observe remote redeploys;
20
+ * - `remoteEntry*.js` revalidates unless explicitly version-pinned via a
21
+ * `mfv`/`v`/`version` query parameter, in which case it is immutable.
22
+ *
23
+ * Composed with the other fork server plugins. The middleware runs in the
24
+ * `pre` phase so it wraps the static-file middleware serving these assets.
25
+ */
26
+ export declare const injectMfAssetCacheHeadersPlugin: () => ServerPlugin;
@@ -0,0 +1,25 @@
1
+ import type { Monitors } from '@modern-js/types';
2
+ import type { CollectDirectRemoteModuleFederationCssOptions } from './remote.mjs';
3
+ export type ModuleFederationCssCollectorOptions = CollectDirectRemoteModuleFederationCssOptions & {
4
+ /**
5
+ * How long a successful remote CSS collection may be served from cache.
6
+ * `0` disables caching (beyond in-flight request coalescing).
7
+ */
8
+ ttlMs?: number;
9
+ /** Clock override for tests. */
10
+ now?: () => number;
11
+ };
12
+ /**
13
+ * TTL cache around remote MF CSS collection. Remote manifests mutate
14
+ * independently of the host (that is the point of module federation), so the
15
+ * collection must expire: a boot-time-forever cache serves stale or broken
16
+ * CSS links after any remote redeploy.
17
+ *
18
+ * Error handling: a collection where any remote fetch failed is never cached.
19
+ * The last known-good asset list is served instead (stale-on-error) and the
20
+ * next request retries the collection.
21
+ */
22
+ export declare const createModuleFederationCssCollector: (pwd: string, options?: ModuleFederationCssCollectorOptions) => {
23
+ collect(monitors?: Monitors): Promise<string[]>;
24
+ };
25
+ export declare const DEFAULT_REMOTE_CSS_CACHE_TTL_MS = 30000;
@@ -0,0 +1,8 @@
1
+ export type { ModuleFederationCssCollectorOptions } from './collector.mjs';
2
+ export { createModuleFederationCssCollector } from './collector.mjs';
3
+ export type { ModuleFederationManifest } from './manifest.mjs';
4
+ export { collectModuleFederationManifestCss } from './manifest.mjs';
5
+ export type { ModuleFederationCssPluginOptions } from './plugin.mjs';
6
+ export { injectModuleFederationCssPlugin } from './plugin.mjs';
7
+ export type { CollectDirectRemoteModuleFederationCssOptions, RemoteModuleFederationCssCollection, } from './remote.mjs';
8
+ export { collectDirectRemoteModuleFederationCss, collectDirectRemoteModuleFederationCssWithMeta, } from './remote.mjs';
@@ -0,0 +1,28 @@
1
+ import type { Monitors } from '@modern-js/types';
2
+ type ModuleFederationAssets = {
3
+ css?: {
4
+ sync?: string[];
5
+ async?: string[];
6
+ };
7
+ };
8
+ export type ModuleFederationManifest = {
9
+ metaData?: {
10
+ publicPath?: string;
11
+ };
12
+ shared?: Array<{
13
+ assets?: ModuleFederationAssets;
14
+ }>;
15
+ remotes?: Array<{
16
+ entry?: string;
17
+ assets?: ModuleFederationAssets;
18
+ }>;
19
+ exposes?: Array<{
20
+ assets?: ModuleFederationAssets;
21
+ }>;
22
+ };
23
+ export declare const warn: (monitors: Monitors | undefined, message: string, ...args: unknown[]) => void;
24
+ export declare const ensureTrailingSlash: (value: string) => string;
25
+ export declare const normalizeRemoteEntry: (entry: string) => string | undefined;
26
+ export declare const collectModuleFederationManifestCss: (manifest: ModuleFederationManifest, manifestUrl: string) => string[];
27
+ export declare const getHostManifest: (pwd: string, monitors?: Monitors) => Promise<ModuleFederationManifest | undefined>;
28
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { ServerPlugin } from '@modern-js/server-core';
2
+ export type ModuleFederationCssPluginOptions = {
3
+ /**
4
+ * TTL for the cached remote CSS collection in production.
5
+ *
6
+ * @default 30000 in production, 0 (no caching) otherwise
7
+ */
8
+ remoteCssCacheTtlMs?: number;
9
+ };
10
+ /**
11
+ * Enriches the request-scoped server manifest with CSS assets collected from
12
+ * direct module federation remotes, so SSR/CSR-RSC rendering can inline
13
+ * `<link>` tags for remote CSS.
14
+ *
15
+ * In production the collection is cached with a TTL (default 30s) instead of
16
+ * being pinned at boot: remote manifests change on every remote redeploy, and
17
+ * fetch failures must not pin an empty/partial list for the process lifetime.
18
+ *
19
+ * Existing plugin ordering places this after the native resource plugin
20
+ * (which sets `serverManifest`) and before the native RSC manifest plugin.
21
+ */
22
+ export declare const injectModuleFederationCssPlugin: (options?: ModuleFederationCssPluginOptions) => ServerPlugin;
@@ -0,0 +1,20 @@
1
+ import type { Monitors } from '@modern-js/types';
2
+ type FetchLike = (input: string, init?: {
3
+ signal?: AbortSignal;
4
+ }) => Promise<Response>;
5
+ export type CollectDirectRemoteModuleFederationCssOptions = {
6
+ fetcher?: FetchLike;
7
+ monitors?: Monitors;
8
+ timeout?: number;
9
+ };
10
+ export type RemoteModuleFederationCssCollection = {
11
+ assets: string[];
12
+ /**
13
+ * True when at least one remote manifest fetch failed, i.e. `assets` may be
14
+ * incomplete and should not be cached long-term.
15
+ */
16
+ errored: boolean;
17
+ };
18
+ export declare const collectDirectRemoteModuleFederationCssWithMeta: (pwd: string, options?: CollectDirectRemoteModuleFederationCssOptions) => Promise<RemoteModuleFederationCssCollection>;
19
+ export declare const collectDirectRemoteModuleFederationCss: (pwd: string, options?: CollectDirectRemoteModuleFederationCssOptions) => Promise<string[]>;
20
+ export {};
@@ -0,0 +1,4 @@
1
+ export type { RuntimeFallbackSignalAuthConfig, RuntimeFallbackSignalConfig, RuntimeFallbackSignalRuntimeState, RuntimeFallbackSignalSource, RuntimeFallbackSignalTrustContext, RuntimeFallbackSignalTrustPolicy, RuntimeSignalError, RuntimeSignalErrorCode, } from './model.mjs';
2
+ export { createRuntimeSignalError, DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS, DEFAULT_RUNTIME_FALLBACK_GATE_NAME, DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES, DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT, DEFAULT_RUNTIME_STATUS_ENDPOINT, getRuntimeSignalErrorStatusCode, parseRuntimeFallbackSignalPayload, parseRuntimeFallbackSignalPayloadFromRawBody, } from './model.mjs';
3
+ export { enforceRuntimeFallbackSignalAuth, enforceRuntimeFallbackSignalAuthToken, enforceRuntimeFallbackSignalTrustPolicy, normalizeRequiredRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackTrustPolicy, resolveRuntimeFallbackSignalEndpoint, } from './resolver.mjs';
4
+ export { createRuntimeFallbackSignalRuntimeState, persistRuntimeFallbackContractGate, } from './store.mjs';
@@ -0,0 +1,70 @@
1
+ import type { Context, ServerEnv } from '@modern-js/server-core';
2
+ import type { ContractGateSnapshotStore } from '../contract-gate-snapshot-store/index.mjs';
3
+ export declare const DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = "/_modern/contract-gates/runtime-fallback";
4
+ export declare const DEFAULT_RUNTIME_STATUS_ENDPOINT = "/_modern/runtime/status";
5
+ export declare const DEFAULT_RUNTIME_FALLBACK_GATE_NAME = "runtime-mf-fallback-health";
6
+ export declare const DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS: number;
7
+ export declare const DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES: number;
8
+ export declare const DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER = "x-modernjs-runtime-signal-token";
9
+ export declare const DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW = 30;
10
+ export declare const DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS = 60000;
11
+ export declare const DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS = 10000;
12
+ export type RuntimeSignalErrorCode = 'PAYLOAD_TOO_LARGE' | 'INVALID_PAYLOAD' | 'RATE_LIMITED' | 'UNAUTHORIZED' | 'UNTRUSTED_SOURCE';
13
+ export type RuntimeSignalError = Error & {
14
+ code?: RuntimeSignalErrorCode;
15
+ };
16
+ export type RuntimeFallbackSignalTrustPolicy = {
17
+ allowedApps: string[];
18
+ allowedEntryOrigins: string[];
19
+ expectedRuntimeDigests: Record<string, string>;
20
+ enforceRuntimeDigest: boolean;
21
+ maxSignalsPerWindow: number;
22
+ windowMs: number;
23
+ dedupeWindowMs: number;
24
+ };
25
+ type RuntimeFallbackSignalRateLimitState = {
26
+ count: number;
27
+ windowStartedAt: number;
28
+ };
29
+ export type RuntimeFallbackSignalAuthConfig = {
30
+ enabled: boolean;
31
+ headerName: string;
32
+ expectedValue?: string;
33
+ };
34
+ export type RuntimeFallbackSignalRuntimeState = {
35
+ rateLimitBySource: Map<string, RuntimeFallbackSignalRateLimitState>;
36
+ dedupeByFingerprint: Map<string, number>;
37
+ };
38
+ export type RuntimeFallbackSignalTrustContext = {
39
+ trustPolicy: RuntimeFallbackSignalTrustPolicy;
40
+ runtimeState: RuntimeFallbackSignalRuntimeState;
41
+ };
42
+ export type RuntimeFallbackSignalConfig = {
43
+ endpoint: string;
44
+ gateName: string;
45
+ gateSnapshotStore: Promise<ContractGateSnapshotStore>;
46
+ failureHoldMs: number;
47
+ maxBodyBytes: number;
48
+ auth: RuntimeFallbackSignalAuthConfig;
49
+ trustPolicy: RuntimeFallbackSignalTrustPolicy;
50
+ runtimeState: RuntimeFallbackSignalRuntimeState;
51
+ };
52
+ export type RuntimeFallbackSignalSource = {
53
+ /**
54
+ * Server-trusted connection identity (socket remote address). Never derive
55
+ * request headers or payload: both are attacker-controlled and would let
56
+ * callers reset their own rate-limit budget.
57
+ */
58
+ remoteAddress?: string;
59
+ };
60
+ export declare function createRuntimeSignalError(message: string, code: RuntimeSignalError['code']): RuntimeSignalError;
61
+ export declare function getRuntimeSignalErrorStatusCode(signalError: RuntimeSignalError): 400 | 401 | 403 | 413 | 429 | 500;
62
+ export declare function normalizeRuntimeSignalOrigin(value: unknown): string | undefined;
63
+ export declare function normalizeRuntimeSignalAppName(payload: Record<string, unknown>): string;
64
+ export declare function normalizeRuntimeSignalRuntimeDigest(payload: Record<string, unknown>): string | undefined;
65
+ export declare function parseRuntimeFallbackSignalPayload(c: Context<ServerEnv>, maxBodyBytes: number): Promise<{
66
+ rawBody: string;
67
+ payload: Record<string, unknown>;
68
+ }>;
69
+ export declare function parseRuntimeFallbackSignalPayloadFromRawBody(rawBody: string, maxBodyBytes: number): Record<string, unknown>;
70
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { Context, ServerEnv } from '@modern-js/server-core';
2
+ import type { RuntimeFallbackSignalAuthConfig, RuntimeFallbackSignalConfig, RuntimeFallbackSignalSource, RuntimeFallbackSignalTrustContext, RuntimeFallbackSignalTrustPolicy } from './model.mjs';
3
+ export declare function resolveRuntimeFallbackSignalEndpoint(configuredEndpoint?: string): string;
4
+ export declare function normalizeRuntimeFallbackSignalAuthConfig(configured: {
5
+ enabled?: boolean;
6
+ headerName?: string;
7
+ expectedValue?: string;
8
+ expectedValueEnv?: string;
9
+ } | undefined): RuntimeFallbackSignalAuthConfig;
10
+ /**
11
+ * Normalizes auth config for the runtime fallback signal endpoint when the
12
+ * endpoint itself is enabled. The endpoint records observed failing contract
13
+ * gates, so it always requires a token.
14
+ */
15
+ export declare function normalizeRequiredRuntimeFallbackSignalAuthConfig(configured: Parameters<typeof normalizeRuntimeFallbackSignalAuthConfig>[0]): RuntimeFallbackSignalAuthConfig;
16
+ export declare function enforceRuntimeFallbackSignalAuthToken(token: string | undefined, authConfig: RuntimeFallbackSignalAuthConfig): void;
17
+ export declare function enforceRuntimeFallbackSignalAuth(c: Context<ServerEnv>, runtimeSignalConfig: RuntimeFallbackSignalConfig): void;
18
+ export declare function normalizeRuntimeFallbackTrustPolicy(configured: {
19
+ allowedApps?: string[];
20
+ allowedEntryOrigins?: string[];
21
+ expectedRuntimeDigests?: Record<string, string>;
22
+ enforceRuntimeDigest?: boolean;
23
+ maxSignalsPerWindow?: number;
24
+ windowMs?: number;
25
+ dedupeWindowMs?: number;
26
+ } | undefined): RuntimeFallbackSignalTrustPolicy;
27
+ export declare function enforceRuntimeFallbackSignalTrustPolicy(payload: Record<string, unknown>, runtimeSignalContext: RuntimeFallbackSignalTrustContext, source?: RuntimeFallbackSignalSource): {
28
+ deduped: boolean;
29
+ };
@@ -0,0 +1,4 @@
1
+ import type { RuntimeFallbackSignalConfig, RuntimeFallbackSignalRuntimeState, RuntimeFallbackSignalTrustPolicy } from './model.mjs';
2
+ export declare function createRuntimeFallbackSignalRuntimeState(): RuntimeFallbackSignalRuntimeState;
3
+ export declare function cleanupRuntimeFallbackSignalRuntimeState(now: number, runtimeState: RuntimeFallbackSignalRuntimeState, trustPolicy: RuntimeFallbackSignalTrustPolicy): void;
4
+ export declare function persistRuntimeFallbackContractGate(payload: Record<string, unknown>, runtimeSignalConfig: RuntimeFallbackSignalConfig): Promise<void>;
@@ -0,0 +1 @@
1
+ export * from './runtime-fallback-signal/index.mjs';
@@ -0,0 +1,10 @@
1
+ export type ServerRuntimeHandle = (request: Request, ...args: any[]) => Response | Promise<Response>;
2
+ export type DisposableServerRuntimeHandle = ServerRuntimeHandle & {
3
+ dispose: () => Promise<void>;
4
+ };
5
+ type RuntimeDisposer = () => void | Promise<void>;
6
+ export declare const registerServerRuntimeDisposer: (owner: object, disposer: RuntimeDisposer) => () => void;
7
+ export declare const disposeServerRuntime: (owner: object) => Promise<void>;
8
+ export declare const createDisposableServerRuntimeHandle: (owner: object, handle: ServerRuntimeHandle) => DisposableServerRuntimeHandle;
9
+ export declare const initializeDisposableServerRuntime: (owner: object, handle: ServerRuntimeHandle, initialize: () => Promise<void>) => Promise<DisposableServerRuntimeHandle>;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { BffRuntimeUserConfig, BffRuntimeFramework as CanonicalBffRuntimeFramework, ServerTelemetryConfigExtension } from '@modern-js/runtime-extensions/server-config';
2
+ import type { BffUserConfig, ServerUserConfig } from '@modern-js/server-core';
3
+ type BffConfigExtension = Omit<BffRuntimeUserConfig, 'runtimeFramework'>;
4
+ type ForkBffRuntimeRegistry = Record<Exclude<CanonicalBffRuntimeFramework, 'hono'>, true>;
5
+ declare module '@modern-js/plugin/server' {
6
+ interface BffRuntimeRegistry extends ForkBffRuntimeRegistry {
7
+ }
8
+ }
9
+ declare module '@modern-js/server-core' {
10
+ interface BffUserConfig extends BffConfigExtension {
11
+ }
12
+ interface ServerUserConfig extends ServerTelemetryConfigExtension {
13
+ }
14
+ }
15
+ export type UltramodernBffUserConfig = Omit<BffUserConfig, keyof BffRuntimeUserConfig> & BffRuntimeUserConfig;
16
+ export type UltramodernServerUserConfig = ServerUserConfig & ServerTelemetryConfigExtension;
17
+ export {};
@@ -0,0 +1,5 @@
1
+ import './serverConfig.mjs';
2
+ import type { ServerPlugin } from '@modern-js/server-core';
3
+ /** Compose fork server policies through the native ServerPlugin extension. */
4
+ export declare const ultramodernServerPlugin: () => ServerPlugin;
5
+ export default ultramodernServerPlugin;
@@ -0,0 +1,3 @@
1
+ import type { ServerPlugin } from '@modern-js/server-core';
2
+ export declare function injectStaticServingPlugin(): ServerPlugin;
3
+ export default injectStaticServingPlugin;
@@ -0,0 +1,2 @@
1
+ import { type ServerStaticPluginOptions } from '@modern-js/server-core/node';
2
+ export declare function createStaticExtensionResponders(): ServerStaticPluginOptions;
@@ -0,0 +1,13 @@
1
+ import type { Middleware } from '@modern-js/server-core';
2
+ export declare const MODULE_FEDERATION_MANIFEST_FILE = "mf-manifest.json";
3
+ export type ModuleFederationServeAssets = {
4
+ assets: Set<string>;
5
+ remoteEntries: Set<string>;
6
+ };
7
+ export declare const getModuleFederationRequestPath: (pathname: string, pathPrefix: string) => string;
8
+ export declare const isModuleFederationManifestRequest: (requestPath: string) => boolean;
9
+ export declare const isBackendModuleFederationManifestRequest: (requestPath: string) => requestPath is "backend-mf-manifest.json";
10
+ export declare const applyModuleFederationAssetHeaders: (c: Parameters<Middleware>[0]) => void;
11
+ export declare const patchModuleFederationManifestPublicPath: (c: Parameters<Middleware>[0], manifestBuffer: Buffer, pathPrefix: string) => Buffer<ArrayBufferLike>;
12
+ export declare const patchModuleFederationRemoteEntryPublicPath: (c: Parameters<Middleware>[0], remoteEntryBuffer: Buffer, pathPrefix: string) => Buffer<ArrayBufferLike>;
13
+ export declare const getModuleFederationAssetList: (pwd: string) => Promise<ModuleFederationServeAssets>;
@@ -0,0 +1,13 @@
1
+ import type { Middleware } from '@modern-js/server-core';
2
+ type SupportedEncoding = 'br' | 'gzip';
3
+ type ResolvePreCompressedAssetResult = {
4
+ selected: {
5
+ filepath: string;
6
+ encoding: SupportedEncoding;
7
+ } | null;
8
+ hasVariant: boolean;
9
+ acceptable: boolean;
10
+ };
11
+ export declare const resolvePreCompressedAsset: (c: Parameters<Middleware>[0], filepath: string) => Promise<ResolvePreCompressedAssetResult>;
12
+ export declare const applyPreCompressedAssetHeaders: (c: Parameters<Middleware>[0], preCompressedAsset: ResolvePreCompressedAssetResult) => void;
13
+ export {};
@@ -0,0 +1,55 @@
1
+ import type { MonitorEvent } from '@modern-js/types';
2
+ export type TelemetrySignalType = 'log' | 'metric' | 'trace';
3
+ export interface TelemetryEnvelope {
4
+ timestamp: number;
5
+ service: string;
6
+ module: string;
7
+ environment: string;
8
+ signalType: TelemetrySignalType;
9
+ name: string;
10
+ level?: string;
11
+ value?: number;
12
+ unit?: string;
13
+ traceId?: string;
14
+ spanId?: string;
15
+ parentSpanId?: string;
16
+ tags?: Record<string, string>;
17
+ attributes?: Record<string, unknown>;
18
+ error?: {
19
+ name?: string;
20
+ message: string;
21
+ stack?: string;
22
+ };
23
+ }
24
+ export interface TelemetryExporter {
25
+ name: string;
26
+ init?: (context: {
27
+ service: string;
28
+ module: string;
29
+ environment: string;
30
+ }) => void | Promise<void>;
31
+ emit: (batch: TelemetryEnvelope[]) => void | Promise<void>;
32
+ flush?: () => void | Promise<void>;
33
+ shutdown?: () => void | Promise<void>;
34
+ }
35
+ export type TelemetryEnvelopeBuilderContext = {
36
+ service: string;
37
+ module: string;
38
+ environment: string;
39
+ maxQueueSize: number;
40
+ };
41
+ export declare function buildDroppedEnvelope(context: TelemetryEnvelopeBuilderContext, droppedCount: number): TelemetryEnvelope;
42
+ export declare function buildQueueDepthEnvelope(context: TelemetryEnvelopeBuilderContext, queueDepth: number): TelemetryEnvelope;
43
+ export declare function buildQueueUtilizationEnvelope(context: TelemetryEnvelopeBuilderContext, queueDepth: number): TelemetryEnvelope;
44
+ export declare function buildStartupProbeEnvelope(context: TelemetryEnvelopeBuilderContext): TelemetryEnvelope;
45
+ export declare function clamp(value: number, min: number, max: number): number;
46
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
47
+ export declare function redactObject(value: unknown, redactionKeys: Set<string>): Record<string, unknown> | undefined;
48
+ export declare function toTelemetryEnvelope(event: MonitorEvent, input: {
49
+ service: string;
50
+ module: string;
51
+ environment: string;
52
+ traceId?: string;
53
+ spanId?: string;
54
+ attributes?: Record<string, unknown>;
55
+ }): TelemetryEnvelope;
@@ -0,0 +1,12 @@
1
+ import type { TelemetryExporter } from './envelope.mjs';
2
+ export interface OtlpExporterOptions {
3
+ endpoint?: string;
4
+ headers?: Record<string, string>;
5
+ timeoutMs?: number;
6
+ }
7
+ export interface VictoriaMetricsExporterOptions extends OtlpExporterOptions {
8
+ metricPrefix?: string;
9
+ }
10
+ export declare function createOtlpTelemetryExporter(options?: OtlpExporterOptions): TelemetryExporter;
11
+ export declare function createVictoriaMetricsTelemetryExporter(options?: VictoriaMetricsExporterOptions): TelemetryExporter;
12
+ export declare function warnOnMetricsOtlpEndpoint(endpoint: string | undefined): void;
@@ -0,0 +1,20 @@
1
+ import type { TelemetryContractGateStatus, TelemetryHealthFailure } from './healthMonitor.mjs';
2
+ import type { TelemetryQueueStats } from './registryTypes.mjs';
3
+ interface TelemetryHealthMetrics {
4
+ queueStats: TelemetryQueueStats;
5
+ unhealthyExporterCount: number;
6
+ requiredContractGates: readonly string[];
7
+ contractGates: ReadonlyMap<string, TelemetryContractGateStatus>;
8
+ }
9
+ interface TelemetryHealthThresholds {
10
+ maxQueueUtilization: number;
11
+ maxTotalDropped: number;
12
+ maxUnhealthyExporters: number;
13
+ }
14
+ export interface TelemetryHealthEvaluationResult {
15
+ failures: TelemetryHealthFailure[];
16
+ queueStats: TelemetryQueueStats;
17
+ unhealthyExporterCount: number;
18
+ }
19
+ export declare const evaluateTelemetryHealth: (metrics: TelemetryHealthMetrics, thresholds: TelemetryHealthThresholds) => TelemetryHealthEvaluationResult;
20
+ export {};