@bleedingdev/modern-js-server-core 3.2.0-ultramodern.98 → 3.4.0-ultramodern.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.
Files changed (113) hide show
  1. package/dist/cjs/adapters/node/helper/index.js +9 -5
  2. package/dist/cjs/adapters/node/helper/loadCache.js +9 -5
  3. package/dist/cjs/adapters/node/helper/loadConfig.js +9 -5
  4. package/dist/cjs/adapters/node/helper/loadEnv.js +9 -5
  5. package/dist/cjs/adapters/node/helper/loadPlugin.js +9 -5
  6. package/dist/cjs/adapters/node/helper/utils.js +12 -8
  7. package/dist/cjs/adapters/node/hono.js +9 -5
  8. package/dist/cjs/adapters/node/index.js +9 -5
  9. package/dist/cjs/adapters/node/node.js +9 -5
  10. package/dist/cjs/adapters/node/plugins/index.js +9 -5
  11. package/dist/cjs/adapters/node/plugins/nodeServer.js +12 -8
  12. package/dist/cjs/adapters/node/plugins/resource.js +10 -11
  13. package/dist/cjs/adapters/node/plugins/static.js +20 -190
  14. package/dist/cjs/adapters/node/plugins/staticModuleFederation.js +165 -0
  15. package/dist/cjs/adapters/node/plugins/staticPrecompressed.js +135 -0
  16. package/dist/cjs/constants.js +18 -13
  17. package/dist/cjs/context.js +9 -5
  18. package/dist/cjs/helper.js +12 -8
  19. package/dist/cjs/hono.js +9 -5
  20. package/dist/cjs/index.js +60 -32
  21. package/dist/cjs/plugins/compat/hooks.js +14 -10
  22. package/dist/cjs/plugins/compat/index.js +9 -5
  23. package/dist/cjs/plugins/default.js +9 -7
  24. package/dist/cjs/plugins/favicon.js +12 -8
  25. package/dist/cjs/plugins/index.js +11 -88
  26. package/dist/cjs/plugins/log.js +9 -5
  27. package/dist/cjs/plugins/middlewares.js +12 -8
  28. package/dist/cjs/plugins/monitors.js +9 -5
  29. package/dist/cjs/plugins/processedBy.js +12 -8
  30. package/dist/cjs/plugins/render/csrRscRender.js +9 -5
  31. package/dist/cjs/plugins/render/dataHandler.js +9 -5
  32. package/dist/cjs/plugins/render/index.js +12 -8
  33. package/dist/cjs/plugins/render/inject.js +12 -7
  34. package/dist/cjs/plugins/render/render.js +14 -6
  35. package/dist/cjs/plugins/render/renderRscHandler.js +9 -5
  36. package/dist/cjs/plugins/render/serverActionHandler.js +9 -5
  37. package/dist/cjs/plugins/render/ssrCache.js +9 -5
  38. package/dist/cjs/plugins/render/ssrRender.js +9 -5
  39. package/dist/cjs/plugins/render/utils.js +12 -8
  40. package/dist/cjs/plugins/route.js +9 -5
  41. package/dist/cjs/serverBase.js +9 -5
  42. package/dist/cjs/types/config/bffRuntime.js +18 -0
  43. package/dist/cjs/types/config/index.js +9 -5
  44. package/dist/cjs/types/config/serverTelemetry.js +18 -0
  45. package/dist/cjs/types/index.js +9 -5
  46. package/dist/cjs/types/plugins/index.js +9 -5
  47. package/dist/cjs/utils/entry.js +13 -9
  48. package/dist/cjs/utils/env.js +13 -9
  49. package/dist/cjs/utils/error.js +71 -5
  50. package/dist/cjs/utils/index.js +9 -5
  51. package/dist/cjs/utils/middlewareCollector.js +13 -9
  52. package/dist/cjs/utils/publicDir.js +9 -5
  53. package/dist/cjs/utils/request.js +16 -12
  54. package/dist/cjs/utils/serverConfig.js +9 -5
  55. package/dist/cjs/utils/storage.js +9 -5
  56. package/dist/cjs/utils/transformStream.js +13 -9
  57. package/dist/cjs/utils/warmup.js +12 -8
  58. package/dist/esm/adapters/node/plugins/resource.mjs +1 -6
  59. package/dist/esm/adapters/node/plugins/static.mjs +7 -181
  60. package/dist/esm/adapters/node/plugins/staticModuleFederation.mjs +96 -0
  61. package/dist/esm/adapters/node/plugins/staticPrecompressed.mjs +91 -0
  62. package/dist/esm/index.mjs +1 -1
  63. package/dist/esm/plugins/default.mjs +0 -2
  64. package/dist/esm/plugins/index.mjs +0 -3
  65. package/dist/esm/plugins/render/inject.mjs +3 -2
  66. package/dist/esm/plugins/render/render.mjs +7 -3
  67. package/dist/esm/types/config/bffRuntime.mjs +0 -0
  68. package/dist/esm/types/config/serverTelemetry.mjs +0 -0
  69. package/dist/esm/utils/error.mjs +54 -1
  70. package/dist/esm-node/adapters/node/plugins/resource.mjs +1 -6
  71. package/dist/esm-node/adapters/node/plugins/static.mjs +7 -181
  72. package/dist/esm-node/adapters/node/plugins/staticModuleFederation.mjs +97 -0
  73. package/dist/esm-node/adapters/node/plugins/staticPrecompressed.mjs +92 -0
  74. package/dist/esm-node/index.mjs +1 -1
  75. package/dist/esm-node/plugins/default.mjs +0 -2
  76. package/dist/esm-node/plugins/index.mjs +0 -3
  77. package/dist/esm-node/plugins/render/inject.mjs +3 -2
  78. package/dist/esm-node/plugins/render/render.mjs +5 -1
  79. package/dist/esm-node/types/config/bffRuntime.mjs +1 -0
  80. package/dist/esm-node/types/config/serverTelemetry.mjs +1 -0
  81. package/dist/esm-node/utils/error.mjs +54 -1
  82. package/dist/types/adapters/node/plugins/staticModuleFederation.d.ts +13 -0
  83. package/dist/types/adapters/node/plugins/staticPrecompressed.d.ts +13 -0
  84. package/dist/types/index.d.ts +2 -1
  85. package/dist/types/plugins/index.d.ts +0 -3
  86. package/dist/types/types/config/bff.d.ts +2 -97
  87. package/dist/types/types/config/bffRuntime.d.ts +105 -0
  88. package/dist/types/types/config/server.d.ts +3 -337
  89. package/dist/types/types/config/serverTelemetry.d.ts +319 -0
  90. package/dist/types/types/plugins/base.d.ts +7 -2
  91. package/dist/types/types/plugins/index.d.ts +1 -1
  92. package/dist/types/utils/error.d.ts +16 -0
  93. package/package.json +11 -11
  94. package/dist/cjs/adapters/node/plugins/moduleFederationCss.js +0 -172
  95. package/dist/cjs/plugins/contractGateAutopilot.js +0 -158
  96. package/dist/cjs/plugins/contractGateSnapshotStore.js +0 -239
  97. package/dist/cjs/plugins/mfCache.js +0 -78
  98. package/dist/cjs/plugins/telemetry.js +0 -1283
  99. package/dist/esm/adapters/node/plugins/moduleFederationCss.mjs +0 -125
  100. package/dist/esm/plugins/contractGateAutopilot.mjs +0 -124
  101. package/dist/esm/plugins/contractGateSnapshotStore.mjs +0 -180
  102. package/dist/esm/plugins/mfCache.mjs +0 -35
  103. package/dist/esm/plugins/telemetry.mjs +0 -1195
  104. package/dist/esm-node/adapters/node/plugins/moduleFederationCss.mjs +0 -126
  105. package/dist/esm-node/plugins/contractGateAutopilot.mjs +0 -125
  106. package/dist/esm-node/plugins/contractGateSnapshotStore.mjs +0 -182
  107. package/dist/esm-node/plugins/mfCache.mjs +0 -36
  108. package/dist/esm-node/plugins/telemetry.mjs +0 -1196
  109. package/dist/types/adapters/node/plugins/moduleFederationCss.d.ts +0 -33
  110. package/dist/types/plugins/contractGateAutopilot.d.ts +0 -35
  111. package/dist/types/plugins/contractGateSnapshotStore.d.ts +0 -57
  112. package/dist/types/plugins/mfCache.d.ts +0 -12
  113. package/dist/types/plugins/telemetry.d.ts +0 -309
@@ -1,33 +0,0 @@
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
- type FetchLike = (input: string, init?: {
24
- signal?: AbortSignal;
25
- }) => Promise<Response>;
26
- export type CollectDirectRemoteModuleFederationCssOptions = {
27
- fetcher?: FetchLike;
28
- monitors?: Monitors;
29
- timeout?: number;
30
- };
31
- export declare const collectModuleFederationManifestCss: (manifest: ModuleFederationManifest, manifestUrl: string) => string[];
32
- export declare const collectDirectRemoteModuleFederationCss: (pwd: string, options?: CollectDirectRemoteModuleFederationCssOptions) => Promise<string[]>;
33
- export {};
@@ -1,35 +0,0 @@
1
- import { type ContractGateSnapshotStore } from './contractGateSnapshotStore';
2
- import type { TelemetryCanaryOrchestrator } from './telemetry';
3
- type LoggerLike = {
4
- info?: (message: string) => void;
5
- warn?: (message: string) => void;
6
- };
7
- export type ContractGateAutopilotOptions = {
8
- orchestrator: TelemetryCanaryOrchestrator;
9
- gateSnapshotPath?: string;
10
- gateSnapshotStore?: ContractGateSnapshotStore;
11
- pollIntervalMs?: number;
12
- gateStaleAfterMs?: number;
13
- logger?: LoggerLike;
14
- };
15
- export declare class ContractGateAutopilot {
16
- private readonly orchestrator;
17
- private readonly gateSnapshotStore;
18
- private readonly gateSnapshotPath?;
19
- private readonly pollIntervalMs;
20
- private readonly gateStaleAfterMs;
21
- private readonly logger?;
22
- private poller?;
23
- private lastSnapshotFingerprint?;
24
- private readonly appliedGateFingerprints;
25
- constructor(options: ContractGateAutopilotOptions);
26
- start(): Promise<void>;
27
- stop(): void;
28
- syncOnce(): Promise<number>;
29
- private loadSnapshot;
30
- private normalizeSnapshot;
31
- private normalizeGateValue;
32
- private normalizeUpdatedAt;
33
- private normalizeExpiresAt;
34
- }
35
- export {};
@@ -1,57 +0,0 @@
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
- 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
- };
48
- export declare const createHttpContractGateSnapshotStore: (options: ContractGateSnapshotHttpStoreOptions) => ContractGateSnapshotStore;
49
- export declare const resolveContractGateSnapshotPath: (appDirectory: string, configuredPath: string | undefined) => string;
50
- export declare const createFileContractGateSnapshotStore: (gateSnapshotPath: string) => ContractGateSnapshotStore;
51
- export declare const resolveContractGateSnapshotStore: (input: {
52
- appDirectory: string;
53
- gateSnapshotPath: string;
54
- stateStore?: ContractGateSnapshotStoreUserConfig;
55
- logger?: LoggerLike;
56
- }) => Promise<ContractGateSnapshotStore>;
57
- export {};
@@ -1,12 +0,0 @@
1
- export declare function getRequestPathname(url: string): string;
2
- export declare function isMfManifestAsset(pathname: string): boolean;
3
- export declare function isMfRemoteEntryAsset(pathname: string): boolean;
4
- export declare function resolveMfAssetCacheHeaders(url: string, query?: Record<string, unknown>): {
5
- 'cache-control': string;
6
- pragma: string;
7
- expires: string;
8
- } | {
9
- pragma?: undefined;
10
- expires?: undefined;
11
- 'cache-control': string;
12
- } | undefined;
@@ -1,309 +0,0 @@
1
- import type { Metrics } from '@modern-js/types';
2
- import type { ServerTelemetryUserConfig } from '../types/config';
3
- import type { ServerPlugin } from '../types/plugins';
4
- export type TelemetrySignalType = 'log' | 'metric' | 'trace';
5
- export interface TelemetryEnvelope {
6
- timestamp: number;
7
- service: string;
8
- module: string;
9
- environment: string;
10
- signalType: TelemetrySignalType;
11
- name: string;
12
- level?: string;
13
- value?: number;
14
- unit?: string;
15
- traceId?: string;
16
- spanId?: string;
17
- parentSpanId?: string;
18
- tags?: Record<string, string>;
19
- attributes?: Record<string, unknown>;
20
- error?: {
21
- name?: string;
22
- message: string;
23
- stack?: string;
24
- };
25
- }
26
- export interface TelemetryExporter {
27
- name: string;
28
- init?: (context: {
29
- service: string;
30
- module: string;
31
- environment: string;
32
- }) => void | Promise<void>;
33
- emit: (batch: TelemetryEnvelope[]) => void | Promise<void>;
34
- flush?: () => void | Promise<void>;
35
- shutdown?: () => void | Promise<void>;
36
- }
37
- export interface TelemetryRegistryOptions {
38
- service: string;
39
- module: string;
40
- environment: string;
41
- samplingRate?: number;
42
- flushIntervalMs?: number;
43
- maxBatchSize?: number;
44
- maxQueueSize?: number;
45
- redactionKeys?: string[];
46
- slo?: {
47
- queueUtilizationWarnThreshold?: number;
48
- queueDroppedWarnThreshold?: number;
49
- alertCooldownMs?: number;
50
- onAlert?: (alert: TelemetrySloAlert) => void;
51
- };
52
- }
53
- export type TelemetrySloAlertType = 'queue.utilization' | 'queue.drop';
54
- export interface TelemetrySloAlert {
55
- timestamp: number;
56
- service: string;
57
- module: string;
58
- environment: string;
59
- type: TelemetrySloAlertType;
60
- value: number;
61
- threshold: number;
62
- queueDepth: number;
63
- queueCapacity: number;
64
- queueUtilization: number;
65
- totalDropped: number;
66
- }
67
- export interface TelemetryQueueStats {
68
- depth: number;
69
- capacity: number;
70
- utilization: number;
71
- pendingDropped: number;
72
- totalDropped: number;
73
- }
74
- export type TelemetryCanaryState = 'canary' | 'promoted' | 'rolled_back';
75
- export type TelemetryCanaryAction = 'hold' | 'promote' | 'rollback';
76
- export type TelemetryCanaryFailureReason = 'queue_utilization' | 'queue_dropped' | 'unhealthy_exporter' | 'contract_gate_missing' | 'contract_gate_failed';
77
- export interface TelemetryCanaryFailure {
78
- reason: TelemetryCanaryFailureReason;
79
- gate?: string;
80
- message?: string;
81
- threshold?: number;
82
- value?: number;
83
- }
84
- export interface TelemetryCanaryContractGateStatus {
85
- name: string;
86
- passed: boolean;
87
- reason?: string;
88
- updatedAt: number;
89
- }
90
- export interface TelemetryCanaryDecision {
91
- timestamp: number;
92
- action: TelemetryCanaryAction;
93
- state: TelemetryCanaryState;
94
- consecutiveHealthy: number;
95
- consecutiveFailures: number;
96
- failures: TelemetryCanaryFailure[];
97
- queueStats: TelemetryQueueStats;
98
- unhealthyExporterCount: number;
99
- contractGates: TelemetryCanaryContractGateStatus[];
100
- }
101
- export interface TelemetryCanaryStatusSnapshot {
102
- timestamp: number;
103
- state: TelemetryCanaryState;
104
- consecutiveHealthy: number;
105
- consecutiveFailures: number;
106
- queueStats: TelemetryQueueStats;
107
- unhealthyExporterCount: number;
108
- requiredContractGates: string[];
109
- contractGates: TelemetryCanaryContractGateStatus[];
110
- failurePreview: TelemetryCanaryFailure[];
111
- }
112
- export interface TelemetryCanaryOrchestratorOptions {
113
- registry: TelemetryRegistry;
114
- evaluationIntervalMs?: number;
115
- minConsecutiveHealthyEvaluations?: number;
116
- rollbackConsecutiveFailures?: number;
117
- maxQueueUtilization?: number;
118
- maxTotalDropped?: number;
119
- maxUnhealthyExporters?: number;
120
- requiredContractGates?: string[];
121
- onEvaluate?: (decision: TelemetryCanaryDecision) => void;
122
- onPromote?: (decision: TelemetryCanaryDecision) => void;
123
- onRollback?: (decision: TelemetryCanaryDecision) => void;
124
- }
125
- export interface TelemetryExporterHealthStatus {
126
- name: string;
127
- healthy: boolean;
128
- failures: number;
129
- lastError?: string;
130
- lastSuccessAt?: number;
131
- lastFailureAt?: number;
132
- }
133
- export declare class TelemetryStartupHealthError extends Error {
134
- readonly code = "TELEMETRY_EXPORTER_STARTUP_HEALTH_FAILED";
135
- readonly failedExporters: TelemetryExporterHealthStatus[];
136
- constructor(failedExporters: TelemetryExporterHealthStatus[]);
137
- }
138
- export interface OtlpExporterOptions {
139
- endpoint?: string;
140
- headers?: Record<string, string>;
141
- timeoutMs?: number;
142
- }
143
- export interface VictoriaMetricsExporterOptions extends OtlpExporterOptions {
144
- metricPrefix?: string;
145
- }
146
- export declare const DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = "/_modern/contract-gates/runtime-fallback";
147
- export declare const DEFAULT_RUNTIME_STATUS_ENDPOINT = "/_modern/runtime/status";
148
- export type RuntimeSignalErrorCode = 'PAYLOAD_TOO_LARGE' | 'INVALID_PAYLOAD' | 'RATE_LIMITED' | 'UNAUTHORIZED' | 'UNTRUSTED_SOURCE';
149
- export type RuntimeSignalError = Error & {
150
- code?: RuntimeSignalErrorCode;
151
- };
152
- export type RuntimeFallbackSignalTrustPolicy = {
153
- allowedApps: string[];
154
- allowedEntryOrigins: string[];
155
- expectedRuntimeDigests: Record<string, string>;
156
- enforceRuntimeDigest: boolean;
157
- maxSignalsPerWindow: number;
158
- windowMs: number;
159
- dedupeWindowMs: number;
160
- };
161
- type RuntimeFallbackSignalRateLimitState = {
162
- count: number;
163
- windowStartedAt: number;
164
- };
165
- export type RuntimeFallbackSignalAuthConfig = {
166
- enabled: boolean;
167
- headerName: string;
168
- expectedValue?: string;
169
- };
170
- export type RuntimeFallbackSignalRuntimeState = {
171
- rateLimitBySource: Map<string, RuntimeFallbackSignalRateLimitState>;
172
- dedupeByFingerprint: Map<string, number>;
173
- };
174
- export type RuntimeFallbackSignalTrustContext = {
175
- trustPolicy: RuntimeFallbackSignalTrustPolicy;
176
- runtimeState: RuntimeFallbackSignalRuntimeState;
177
- };
178
- export declare function createOtlpTelemetryExporter(options?: OtlpExporterOptions): TelemetryExporter;
179
- export declare function createVictoriaMetricsTelemetryExporter(options?: VictoriaMetricsExporterOptions): TelemetryExporter;
180
- export declare class TelemetryRegistry {
181
- private readonly exporters;
182
- private readonly queue;
183
- private readonly redactionKeys;
184
- private readonly service;
185
- private readonly module;
186
- private readonly environment;
187
- private readonly samplingRate;
188
- private readonly maxBatchSize;
189
- private readonly maxQueueSize;
190
- private readonly flushIntervalMs;
191
- private readonly flushTimer?;
192
- private droppedCount;
193
- private totalDroppedCount;
194
- private flushing;
195
- private readonly exporterHealth;
196
- private readonly queueUtilizationWarnThreshold;
197
- private readonly queueDroppedWarnThreshold;
198
- private readonly alertCooldownMs;
199
- private readonly onSloAlert?;
200
- private readonly lastSloAlertAt;
201
- constructor(options: TelemetryRegistryOptions);
202
- register(exporter: TelemetryExporter): Promise<void>;
203
- private getOrCreateExporterHealth;
204
- private markExporterHealthy;
205
- private markExporterFailure;
206
- private maybeEmitSloAlert;
207
- enqueue(envelope: TelemetryEnvelope): void;
208
- enqueueMetric(input: {
209
- name: string;
210
- value: number;
211
- unit?: string;
212
- traceId?: string;
213
- spanId?: string;
214
- parentSpanId?: string;
215
- tags?: Record<string, string>;
216
- attributes?: Record<string, unknown>;
217
- }): void;
218
- enqueueLog(input: {
219
- name: string;
220
- level: string;
221
- traceId?: string;
222
- spanId?: string;
223
- parentSpanId?: string;
224
- tags?: Record<string, string>;
225
- attributes?: Record<string, unknown>;
226
- error?: TelemetryEnvelope['error'];
227
- }): void;
228
- enqueueTrace(input: {
229
- name: string;
230
- traceId?: string;
231
- spanId?: string;
232
- parentSpanId?: string;
233
- tags?: Record<string, string>;
234
- attributes?: Record<string, unknown>;
235
- }): void;
236
- private buildDroppedEnvelope;
237
- private buildQueueDepthEnvelope;
238
- private buildQueueUtilizationEnvelope;
239
- private emitBatch;
240
- private buildStartupProbeEnvelope;
241
- startupHealthCheck(options?: {
242
- failLoud?: boolean;
243
- }): Promise<void>;
244
- getExporterHealth(): TelemetryExporterHealthStatus[];
245
- getQueueStats(): TelemetryQueueStats;
246
- private flushInternal;
247
- flush(): Promise<void>;
248
- shutdown(): Promise<void>;
249
- }
250
- export declare class TelemetryCanaryOrchestrator {
251
- private readonly registry;
252
- private readonly evaluationIntervalMs;
253
- private readonly minConsecutiveHealthyEvaluations;
254
- private readonly rollbackConsecutiveFailures;
255
- private readonly maxQueueUtilization;
256
- private readonly maxTotalDropped;
257
- private readonly maxUnhealthyExporters;
258
- private requiredContractGates;
259
- private readonly onEvaluate?;
260
- private readonly onPromote?;
261
- private readonly onRollback?;
262
- private readonly contractGates;
263
- private state;
264
- private consecutiveHealthy;
265
- private consecutiveFailures;
266
- private evaluationTimer?;
267
- constructor(options: TelemetryCanaryOrchestratorOptions);
268
- setRequiredContractGates(gates: string[]): void;
269
- addRequiredContractGate(name: string): void;
270
- setContractGate(name: string, passed: boolean, reason?: string): void;
271
- setContractGates(gates: Record<string, boolean | {
272
- passed: boolean;
273
- reason?: string;
274
- }>): void;
275
- resetToCanary(): void;
276
- private collectFailures;
277
- evaluate(): TelemetryCanaryDecision;
278
- getStatusSnapshot(): TelemetryCanaryStatusSnapshot;
279
- start(): void;
280
- stop(): void;
281
- }
282
- export declare const createTelemetryAwareMetrics: <T extends Metrics>(baseMetrics: T, registry: TelemetryRegistry) => T;
283
- export declare function resolveRuntimeFallbackSignalEndpoint(configuredEndpoint?: string): string;
284
- export declare function createRuntimeSignalError(message: string, code: RuntimeSignalError['code']): RuntimeSignalError;
285
- export declare function normalizeRuntimeFallbackSignalAuthConfig(configured: {
286
- enabled?: boolean;
287
- headerName?: string;
288
- expectedValue?: string;
289
- expectedValueEnv?: string;
290
- } | undefined): RuntimeFallbackSignalAuthConfig;
291
- export declare function enforceRuntimeFallbackSignalAuthToken(token: string | undefined, authConfig: RuntimeFallbackSignalAuthConfig): void;
292
- export declare function normalizeRuntimeFallbackTrustPolicy(configured: {
293
- allowedApps?: string[];
294
- allowedEntryOrigins?: string[];
295
- expectedRuntimeDigests?: Record<string, string>;
296
- enforceRuntimeDigest?: boolean;
297
- maxSignalsPerWindow?: number;
298
- windowMs?: number;
299
- dedupeWindowMs?: number;
300
- } | undefined): RuntimeFallbackSignalTrustPolicy;
301
- export declare function createRuntimeFallbackSignalRuntimeState(): RuntimeFallbackSignalRuntimeState;
302
- export declare function enforceRuntimeFallbackSignalTrustPolicy(payload: Record<string, unknown>, runtimeSignalContext: RuntimeFallbackSignalTrustContext): {
303
- deduped: boolean;
304
- };
305
- export declare function parseRuntimeFallbackSignalPayloadFromRawBody(rawBody: string, maxBodyBytes: number): Record<string, unknown>;
306
- export declare function getRuntimeSignalErrorStatusCode(signalError: RuntimeSignalError): 400 | 401 | 403 | 413 | 429 | 500;
307
- export declare const hasEnabledTelemetryExporters: (config: ServerTelemetryUserConfig | undefined) => boolean;
308
- export declare const injectTelemetryPlugin: () => ServerPlugin;
309
- export {};