@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.
- package/dist/cjs/adapters/node/helper/index.js +9 -5
- package/dist/cjs/adapters/node/helper/loadCache.js +9 -5
- package/dist/cjs/adapters/node/helper/loadConfig.js +9 -5
- package/dist/cjs/adapters/node/helper/loadEnv.js +9 -5
- package/dist/cjs/adapters/node/helper/loadPlugin.js +9 -5
- package/dist/cjs/adapters/node/helper/utils.js +12 -8
- package/dist/cjs/adapters/node/hono.js +9 -5
- package/dist/cjs/adapters/node/index.js +9 -5
- package/dist/cjs/adapters/node/node.js +9 -5
- package/dist/cjs/adapters/node/plugins/index.js +9 -5
- package/dist/cjs/adapters/node/plugins/nodeServer.js +12 -8
- package/dist/cjs/adapters/node/plugins/resource.js +10 -11
- package/dist/cjs/adapters/node/plugins/static.js +20 -190
- package/dist/cjs/adapters/node/plugins/staticModuleFederation.js +165 -0
- package/dist/cjs/adapters/node/plugins/staticPrecompressed.js +135 -0
- package/dist/cjs/constants.js +18 -13
- package/dist/cjs/context.js +9 -5
- package/dist/cjs/helper.js +12 -8
- package/dist/cjs/hono.js +9 -5
- package/dist/cjs/index.js +60 -32
- package/dist/cjs/plugins/compat/hooks.js +14 -10
- package/dist/cjs/plugins/compat/index.js +9 -5
- package/dist/cjs/plugins/default.js +9 -7
- package/dist/cjs/plugins/favicon.js +12 -8
- package/dist/cjs/plugins/index.js +11 -88
- package/dist/cjs/plugins/log.js +9 -5
- package/dist/cjs/plugins/middlewares.js +12 -8
- package/dist/cjs/plugins/monitors.js +9 -5
- package/dist/cjs/plugins/processedBy.js +12 -8
- package/dist/cjs/plugins/render/csrRscRender.js +9 -5
- package/dist/cjs/plugins/render/dataHandler.js +9 -5
- package/dist/cjs/plugins/render/index.js +12 -8
- package/dist/cjs/plugins/render/inject.js +12 -7
- package/dist/cjs/plugins/render/render.js +14 -6
- package/dist/cjs/plugins/render/renderRscHandler.js +9 -5
- package/dist/cjs/plugins/render/serverActionHandler.js +9 -5
- package/dist/cjs/plugins/render/ssrCache.js +9 -5
- package/dist/cjs/plugins/render/ssrRender.js +9 -5
- package/dist/cjs/plugins/render/utils.js +12 -8
- package/dist/cjs/plugins/route.js +9 -5
- package/dist/cjs/serverBase.js +9 -5
- package/dist/cjs/types/config/bffRuntime.js +18 -0
- package/dist/cjs/types/config/index.js +9 -5
- package/dist/cjs/types/config/serverTelemetry.js +18 -0
- package/dist/cjs/types/index.js +9 -5
- package/dist/cjs/types/plugins/index.js +9 -5
- package/dist/cjs/utils/entry.js +13 -9
- package/dist/cjs/utils/env.js +13 -9
- package/dist/cjs/utils/error.js +71 -5
- package/dist/cjs/utils/index.js +9 -5
- package/dist/cjs/utils/middlewareCollector.js +13 -9
- package/dist/cjs/utils/publicDir.js +9 -5
- package/dist/cjs/utils/request.js +16 -12
- package/dist/cjs/utils/serverConfig.js +9 -5
- package/dist/cjs/utils/storage.js +9 -5
- package/dist/cjs/utils/transformStream.js +13 -9
- package/dist/cjs/utils/warmup.js +12 -8
- package/dist/esm/adapters/node/plugins/resource.mjs +1 -6
- package/dist/esm/adapters/node/plugins/static.mjs +7 -181
- package/dist/esm/adapters/node/plugins/staticModuleFederation.mjs +96 -0
- package/dist/esm/adapters/node/plugins/staticPrecompressed.mjs +91 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/plugins/default.mjs +0 -2
- package/dist/esm/plugins/index.mjs +0 -3
- package/dist/esm/plugins/render/inject.mjs +3 -2
- package/dist/esm/plugins/render/render.mjs +7 -3
- package/dist/esm/types/config/bffRuntime.mjs +0 -0
- package/dist/esm/types/config/serverTelemetry.mjs +0 -0
- package/dist/esm/utils/error.mjs +54 -1
- package/dist/esm-node/adapters/node/plugins/resource.mjs +1 -6
- package/dist/esm-node/adapters/node/plugins/static.mjs +7 -181
- package/dist/esm-node/adapters/node/plugins/staticModuleFederation.mjs +97 -0
- package/dist/esm-node/adapters/node/plugins/staticPrecompressed.mjs +92 -0
- package/dist/esm-node/index.mjs +1 -1
- package/dist/esm-node/plugins/default.mjs +0 -2
- package/dist/esm-node/plugins/index.mjs +0 -3
- package/dist/esm-node/plugins/render/inject.mjs +3 -2
- package/dist/esm-node/plugins/render/render.mjs +5 -1
- package/dist/esm-node/types/config/bffRuntime.mjs +1 -0
- package/dist/esm-node/types/config/serverTelemetry.mjs +1 -0
- package/dist/esm-node/utils/error.mjs +54 -1
- package/dist/types/adapters/node/plugins/staticModuleFederation.d.ts +13 -0
- package/dist/types/adapters/node/plugins/staticPrecompressed.d.ts +13 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/plugins/index.d.ts +0 -3
- package/dist/types/types/config/bff.d.ts +2 -97
- package/dist/types/types/config/bffRuntime.d.ts +105 -0
- package/dist/types/types/config/server.d.ts +3 -337
- package/dist/types/types/config/serverTelemetry.d.ts +319 -0
- package/dist/types/types/plugins/base.d.ts +7 -2
- package/dist/types/types/plugins/index.d.ts +1 -1
- package/dist/types/utils/error.d.ts +16 -0
- package/package.json +11 -11
- package/dist/cjs/adapters/node/plugins/moduleFederationCss.js +0 -172
- package/dist/cjs/plugins/contractGateAutopilot.js +0 -158
- package/dist/cjs/plugins/contractGateSnapshotStore.js +0 -239
- package/dist/cjs/plugins/mfCache.js +0 -78
- package/dist/cjs/plugins/telemetry.js +0 -1283
- package/dist/esm/adapters/node/plugins/moduleFederationCss.mjs +0 -125
- package/dist/esm/plugins/contractGateAutopilot.mjs +0 -124
- package/dist/esm/plugins/contractGateSnapshotStore.mjs +0 -180
- package/dist/esm/plugins/mfCache.mjs +0 -35
- package/dist/esm/plugins/telemetry.mjs +0 -1195
- package/dist/esm-node/adapters/node/plugins/moduleFederationCss.mjs +0 -126
- package/dist/esm-node/plugins/contractGateAutopilot.mjs +0 -125
- package/dist/esm-node/plugins/contractGateSnapshotStore.mjs +0 -182
- package/dist/esm-node/plugins/mfCache.mjs +0 -36
- package/dist/esm-node/plugins/telemetry.mjs +0 -1196
- package/dist/types/adapters/node/plugins/moduleFederationCss.d.ts +0 -33
- package/dist/types/plugins/contractGateAutopilot.d.ts +0 -35
- package/dist/types/plugins/contractGateSnapshotStore.d.ts +0 -57
- package/dist/types/plugins/mfCache.d.ts +0 -12
- package/dist/types/plugins/telemetry.d.ts +0 -309
|
@@ -1,101 +1,6 @@
|
|
|
1
1
|
import type { HttpMethodDecider } from '@modern-js/types';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
/**
|
|
5
|
-
* Enable cross-project envelope and operation-context policy checks.
|
|
6
|
-
*
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
enabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Require cross-project envelope header when policy is enabled.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
requireEnvelope?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Require operation-context header when policy is enabled.
|
|
18
|
-
*
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
requireOperationContext?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Require operation-context detail header carrying schema/version metadata.
|
|
24
|
-
*
|
|
25
|
-
* @default true
|
|
26
|
-
*/
|
|
27
|
-
requireOperationContextDetails?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Require operation schema hash in operation-context details.
|
|
30
|
-
*
|
|
31
|
-
* @default true
|
|
32
|
-
*/
|
|
33
|
-
requireOperationSchemaHash?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Require operation version in operation-context details.
|
|
36
|
-
*
|
|
37
|
-
* @default true
|
|
38
|
-
*/
|
|
39
|
-
requireOperationVersion?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Optional allowlist of producer namespaces derived from requestId.
|
|
42
|
-
*/
|
|
43
|
-
allowedNamespaces?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* Optional operation-contract map keyed by:
|
|
46
|
-
* - `${METHOD}:${routePath}`
|
|
47
|
-
* - `operation:${requestId}:${operationId}`
|
|
48
|
-
*/
|
|
49
|
-
expectedOperationContracts?: Record<string, {
|
|
50
|
-
schemaHash?: string;
|
|
51
|
-
operationVersion?: number;
|
|
52
|
-
}>;
|
|
53
|
-
/**
|
|
54
|
-
* Allow operations missing from expectedOperationContracts.
|
|
55
|
-
*
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
allowUnknownOperations?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* HTTP status code used for denied requests.
|
|
61
|
-
*
|
|
62
|
-
* @default 403
|
|
63
|
-
*/
|
|
64
|
-
denyStatus?: number;
|
|
65
|
-
}
|
|
66
|
-
export type BffEffectOpenApiUserConfig = boolean | {
|
|
67
|
-
path?: string;
|
|
68
|
-
};
|
|
69
|
-
export interface BffEffectDataPlatformSelectionUserConfig {
|
|
70
|
-
maxDepth?: number;
|
|
71
|
-
maxFields?: number;
|
|
72
|
-
allowedLeafPaths?: string[];
|
|
73
|
-
}
|
|
74
|
-
export interface BffEffectDataPlatformBatchUserConfig {
|
|
75
|
-
enabled?: boolean;
|
|
76
|
-
endpoint?: `/${string}`;
|
|
77
|
-
maxBatchSize?: number;
|
|
78
|
-
maxBatchBytes?: number;
|
|
79
|
-
flushIntervalMs?: number;
|
|
80
|
-
maxConcurrency?: number;
|
|
81
|
-
requestTimeoutMs?: number;
|
|
82
|
-
allowedMethods?: string[];
|
|
83
|
-
}
|
|
84
|
-
export interface BffEffectDataPlatformUserConfig {
|
|
85
|
-
enabled?: boolean;
|
|
86
|
-
requireEnvelope?: boolean;
|
|
87
|
-
envelopeHeader?: string;
|
|
88
|
-
expectedNamespace?: string;
|
|
89
|
-
validateOrigin?: boolean;
|
|
90
|
-
requireTraceContext?: boolean;
|
|
91
|
-
selection?: BffEffectDataPlatformSelectionUserConfig;
|
|
92
|
-
batch?: BffEffectDataPlatformBatchUserConfig;
|
|
93
|
-
}
|
|
94
|
-
export interface BffEffectUserConfig {
|
|
95
|
-
entry?: string;
|
|
96
|
-
openapi?: BffEffectOpenApiUserConfig;
|
|
97
|
-
dataPlatform?: BffEffectDataPlatformUserConfig;
|
|
98
|
-
}
|
|
2
|
+
import type { BffCrossProjectPolicyUserConfig, BffEffectUserConfig, BffRuntimeFramework } from './bffRuntime';
|
|
3
|
+
export type { BffCrossProjectPolicyUserConfig, BffEffectDataPlatformBatchUserConfig, BffEffectDataPlatformSelectionUserConfig, BffEffectDataPlatformUserConfig, BffEffectOpenApiUserConfig, BffEffectUserConfig, BffRuntimeFramework, } from './bffRuntime';
|
|
99
4
|
export interface BffUserConfig {
|
|
100
5
|
prefix?: string | string[];
|
|
101
6
|
httpMethodDecider?: HttpMethodDecider;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type BffRuntimeFramework = 'hono' | 'effect';
|
|
2
|
+
export interface BffCrossProjectPolicyUserConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Enable cross-project envelope and operation-context policy checks.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Require cross-project envelope header when policy is enabled.
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
requireEnvelope?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Require operation-context header when policy is enabled.
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
requireOperationContext?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Require operation-context detail header carrying schema/version metadata.
|
|
23
|
+
*
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
requireOperationContextDetails?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Require operation schema hash in operation-context details.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
requireOperationSchemaHash?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Require operation version in operation-context details.
|
|
35
|
+
*
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
requireOperationVersion?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Optional allowlist of producer namespaces derived from requestId.
|
|
41
|
+
*/
|
|
42
|
+
allowedNamespaces?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Optional hook deriving a verified producer identity (namespace) from
|
|
45
|
+
* request headers, e.g. an mTLS subject or gateway-verified JWT claim.
|
|
46
|
+
* When provided, namespace checks bind to this verified value instead of
|
|
47
|
+
* the client-asserted requestId namespace; returning `undefined` denies
|
|
48
|
+
* the request. Without it the namespace checks are advisory only.
|
|
49
|
+
*/
|
|
50
|
+
verifyProducerIdentity?: (headers: Record<string, unknown>) => string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Optional operation-contract map keyed by:
|
|
53
|
+
* - `${METHOD}:${routePath}`
|
|
54
|
+
* - `operation:${requestId}:${operationId}`
|
|
55
|
+
*/
|
|
56
|
+
expectedOperationContracts?: Record<string, {
|
|
57
|
+
schemaHash?: string;
|
|
58
|
+
operationVersion?: number;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Allow operations missing from expectedOperationContracts.
|
|
62
|
+
*
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
allowUnknownOperations?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* HTTP status code used for denied requests.
|
|
68
|
+
*
|
|
69
|
+
* @default 403
|
|
70
|
+
*/
|
|
71
|
+
denyStatus?: number;
|
|
72
|
+
}
|
|
73
|
+
export type BffEffectOpenApiUserConfig = boolean | {
|
|
74
|
+
path?: string;
|
|
75
|
+
};
|
|
76
|
+
export interface BffEffectDataPlatformSelectionUserConfig {
|
|
77
|
+
maxDepth?: number;
|
|
78
|
+
maxFields?: number;
|
|
79
|
+
allowedLeafPaths?: string[];
|
|
80
|
+
}
|
|
81
|
+
export interface BffEffectDataPlatformBatchUserConfig {
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
endpoint?: `/${string}`;
|
|
84
|
+
maxBatchSize?: number;
|
|
85
|
+
maxBatchBytes?: number;
|
|
86
|
+
flushIntervalMs?: number;
|
|
87
|
+
maxConcurrency?: number;
|
|
88
|
+
requestTimeoutMs?: number;
|
|
89
|
+
allowedMethods?: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface BffEffectDataPlatformUserConfig {
|
|
92
|
+
enabled?: boolean;
|
|
93
|
+
requireEnvelope?: boolean;
|
|
94
|
+
envelopeHeader?: string;
|
|
95
|
+
expectedNamespace?: string;
|
|
96
|
+
validateOrigin?: boolean;
|
|
97
|
+
requireTraceContext?: boolean;
|
|
98
|
+
selection?: BffEffectDataPlatformSelectionUserConfig;
|
|
99
|
+
batch?: BffEffectDataPlatformBatchUserConfig;
|
|
100
|
+
}
|
|
101
|
+
export interface BffEffectUserConfig {
|
|
102
|
+
entry?: string;
|
|
103
|
+
openapi?: BffEffectOpenApiUserConfig;
|
|
104
|
+
dataPlatform?: BffEffectDataPlatformUserConfig;
|
|
105
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SSRMode } from '@modern-js/types';
|
|
2
2
|
import type { WatchOptions } from '@modern-js/utils';
|
|
3
|
+
import type { ServerTelemetryUserConfig } from './serverTelemetry';
|
|
4
|
+
export type { ServerTelemetryCanaryAutopilotStateStoreUserConfig, ServerTelemetryCanaryAutopilotUserConfig, ServerTelemetryCanaryContractGateUserConfig, ServerTelemetryCanaryRuntimeFallbackSignalAuthUserConfig, ServerTelemetryCanaryRuntimeFallbackSignalTrustPolicyUserConfig, ServerTelemetryCanaryRuntimeFallbackSignalUserConfig, ServerTelemetryCanaryUserConfig, ServerTelemetryExporterOptions, ServerTelemetrySloUserConfig, ServerTelemetryUserConfig, ServerTelemetryVictoriaMetricsOptions, } from './serverTelemetry';
|
|
3
5
|
type Route = string | string[] | {
|
|
4
6
|
route?: string | string[];
|
|
5
7
|
disableSpa?: boolean;
|
|
@@ -17,6 +19,7 @@ export type SSR = boolean | {
|
|
|
17
19
|
* Sensitive headers are denylisted by default.
|
|
18
20
|
*/
|
|
19
21
|
unsafeHeaders?: string[];
|
|
22
|
+
loaderFailureMode?: 'clientRender' | 'errorBoundary';
|
|
20
23
|
/**
|
|
21
24
|
* Enable app-level Module Federation SSR bridge path.
|
|
22
25
|
* This flag should be enabled in both host and remote applications.
|
|
@@ -26,342 +29,6 @@ export type SSR = boolean | {
|
|
|
26
29
|
};
|
|
27
30
|
export type SSRByEntries = Record<string, SSR>;
|
|
28
31
|
type SSRPreload = Record<string, unknown>;
|
|
29
|
-
export interface ServerTelemetryExporterOptions {
|
|
30
|
-
enabled?: boolean;
|
|
31
|
-
endpoint?: string;
|
|
32
|
-
headers?: Record<string, string>;
|
|
33
|
-
timeoutMs?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface ServerTelemetryVictoriaMetricsOptions extends ServerTelemetryExporterOptions {
|
|
36
|
-
metricPrefix?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface ServerTelemetrySloUserConfig {
|
|
39
|
-
/**
|
|
40
|
-
* Queue utilization ratio threshold that emits SLO degradation alerts.
|
|
41
|
-
*
|
|
42
|
-
* @default 0.8
|
|
43
|
-
*/
|
|
44
|
-
queueUtilizationWarnThreshold?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Total dropped-envelope threshold that emits SLO degradation alerts.
|
|
47
|
-
*
|
|
48
|
-
* @default 1
|
|
49
|
-
*/
|
|
50
|
-
queueDroppedWarnThreshold?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Cooldown between SLO alert emissions for the same alert type.
|
|
53
|
-
*
|
|
54
|
-
* @default 60000
|
|
55
|
-
*/
|
|
56
|
-
alertCooldownMs?: number;
|
|
57
|
-
}
|
|
58
|
-
export interface ServerTelemetryCanaryContractGateUserConfig {
|
|
59
|
-
/**
|
|
60
|
-
* Whether this contract gate currently passes.
|
|
61
|
-
*/
|
|
62
|
-
passed: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Optional failure reason used for rollback diagnostics.
|
|
65
|
-
*/
|
|
66
|
-
reason?: string;
|
|
67
|
-
}
|
|
68
|
-
export interface ServerTelemetryCanaryAutopilotUserConfig {
|
|
69
|
-
/**
|
|
70
|
-
* Enable automatic contract gate synchronization from a gate snapshot file.
|
|
71
|
-
*
|
|
72
|
-
* @default true
|
|
73
|
-
*/
|
|
74
|
-
enabled?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Path to contract gate snapshot JSON file.
|
|
77
|
-
*
|
|
78
|
-
* @default ".modern/contract-gates.json"
|
|
79
|
-
*/
|
|
80
|
-
gateSnapshotPath?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Poll interval for reading gate snapshot changes.
|
|
83
|
-
*
|
|
84
|
-
* @default 15000
|
|
85
|
-
*/
|
|
86
|
-
pollIntervalMs?: number;
|
|
87
|
-
/**
|
|
88
|
-
* Marks gate entries as failed when they are older than this threshold.
|
|
89
|
-
*
|
|
90
|
-
* @default 600000
|
|
91
|
-
*/
|
|
92
|
-
gateStaleAfterMs?: number;
|
|
93
|
-
/**
|
|
94
|
-
* Runtime MF fallback signal ingestion.
|
|
95
|
-
*/
|
|
96
|
-
runtimeFallbackSignal?: ServerTelemetryCanaryRuntimeFallbackSignalUserConfig;
|
|
97
|
-
/**
|
|
98
|
-
* Optional pluggable state store backend for contract gate snapshots.
|
|
99
|
-
* When omitted, snapshots are read/written from gateSnapshotPath on local disk.
|
|
100
|
-
*/
|
|
101
|
-
stateStore?: ServerTelemetryCanaryAutopilotStateStoreUserConfig;
|
|
102
|
-
}
|
|
103
|
-
export interface ServerTelemetryCanaryAutopilotStateStoreUserConfig {
|
|
104
|
-
/**
|
|
105
|
-
* Path or package name of a module that exports
|
|
106
|
-
* `createContractGateSnapshotStore(context)`.
|
|
107
|
-
*/
|
|
108
|
-
module: string;
|
|
109
|
-
/**
|
|
110
|
-
* Optional adapter-specific configuration.
|
|
111
|
-
*/
|
|
112
|
-
options?: Record<string, unknown>;
|
|
113
|
-
}
|
|
114
|
-
export interface ServerTelemetryCanaryRuntimeFallbackSignalUserConfig {
|
|
115
|
-
/**
|
|
116
|
-
* Enable runtime MF fallback signal ingestion endpoint.
|
|
117
|
-
*
|
|
118
|
-
* @default true
|
|
119
|
-
*/
|
|
120
|
-
enabled?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* HTTP endpoint path for runtime fallback events.
|
|
123
|
-
*
|
|
124
|
-
* @default "/_modern/contract-gates/runtime-fallback"
|
|
125
|
-
*/
|
|
126
|
-
endpoint?: string;
|
|
127
|
-
/**
|
|
128
|
-
* Contract gate name updated by runtime fallback events.
|
|
129
|
-
*
|
|
130
|
-
* @default "runtime-mf-fallback-health"
|
|
131
|
-
*/
|
|
132
|
-
gateName?: string;
|
|
133
|
-
/**
|
|
134
|
-
* How long a runtime fallback signal should hold gate failure status.
|
|
135
|
-
*
|
|
136
|
-
* @default 300000
|
|
137
|
-
*/
|
|
138
|
-
failureHoldMs?: number;
|
|
139
|
-
/**
|
|
140
|
-
* Maximum accepted request body size in bytes.
|
|
141
|
-
*
|
|
142
|
-
* @default 16384
|
|
143
|
-
*/
|
|
144
|
-
maxBodyBytes?: number;
|
|
145
|
-
/**
|
|
146
|
-
* Optional runtime trust policy for fallback signal ingestion.
|
|
147
|
-
* Use this to restrict who can mutate canary contract gates.
|
|
148
|
-
*/
|
|
149
|
-
trustPolicy?: ServerTelemetryCanaryRuntimeFallbackSignalTrustPolicyUserConfig;
|
|
150
|
-
/**
|
|
151
|
-
* Optional request authentication for runtime fallback signal endpoint.
|
|
152
|
-
*/
|
|
153
|
-
auth?: ServerTelemetryCanaryRuntimeFallbackSignalAuthUserConfig;
|
|
154
|
-
/**
|
|
155
|
-
* Optional worker-lane pilot for runtime fallback snapshot persistence.
|
|
156
|
-
* Disabled by default to keep baseline behavior deterministic.
|
|
157
|
-
*/
|
|
158
|
-
workerLane?: ServerTelemetryCanaryRuntimeFallbackSignalWorkerLaneUserConfig;
|
|
159
|
-
}
|
|
160
|
-
export interface ServerTelemetryCanaryRuntimeFallbackSignalWorkerLaneUserConfig {
|
|
161
|
-
/**
|
|
162
|
-
* Enable off-main-thread persistence for runtime fallback gate snapshots.
|
|
163
|
-
*
|
|
164
|
-
* @default false
|
|
165
|
-
*/
|
|
166
|
-
enabled?: boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Maximum time to wait for worker-lane completion before falling back to
|
|
169
|
-
* main-thread persistence.
|
|
170
|
-
*
|
|
171
|
-
* @default 250
|
|
172
|
-
*/
|
|
173
|
-
timeoutMs?: number;
|
|
174
|
-
}
|
|
175
|
-
export interface ServerTelemetryCanaryRuntimeFallbackSignalAuthUserConfig {
|
|
176
|
-
/**
|
|
177
|
-
* Enable auth guard for runtime fallback signal endpoint.
|
|
178
|
-
*
|
|
179
|
-
* @default false
|
|
180
|
-
*/
|
|
181
|
-
enabled?: boolean;
|
|
182
|
-
/**
|
|
183
|
-
* Header name carrying runtime fallback auth token.
|
|
184
|
-
*
|
|
185
|
-
* @default "x-modernjs-runtime-signal-token"
|
|
186
|
-
*/
|
|
187
|
-
headerName?: string;
|
|
188
|
-
/**
|
|
189
|
-
* Expected token value. Prefer using expectedValueEnv in production.
|
|
190
|
-
*/
|
|
191
|
-
expectedValue?: string;
|
|
192
|
-
/**
|
|
193
|
-
* Name of environment variable that stores expected token value.
|
|
194
|
-
*/
|
|
195
|
-
expectedValueEnv?: string;
|
|
196
|
-
}
|
|
197
|
-
export interface ServerTelemetryCanaryRuntimeFallbackSignalTrustPolicyUserConfig {
|
|
198
|
-
/**
|
|
199
|
-
* Allowlist of app names accepted by runtime fallback signal endpoint.
|
|
200
|
-
* Empty means no app-name allowlist check.
|
|
201
|
-
*/
|
|
202
|
-
allowedApps?: string[];
|
|
203
|
-
/**
|
|
204
|
-
* Allowlist of entry origins accepted by runtime fallback signal endpoint.
|
|
205
|
-
* Values should be URL origins (for example https://erp.example.com).
|
|
206
|
-
* Empty means no entry-origin allowlist check.
|
|
207
|
-
*/
|
|
208
|
-
allowedEntryOrigins?: string[];
|
|
209
|
-
/**
|
|
210
|
-
* Expected runtime digest per appName.
|
|
211
|
-
*/
|
|
212
|
-
expectedRuntimeDigests?: Record<string, string>;
|
|
213
|
-
/**
|
|
214
|
-
* Require runtimeDigest to be present in signal payload metadata.
|
|
215
|
-
*
|
|
216
|
-
* @default false
|
|
217
|
-
*/
|
|
218
|
-
enforceRuntimeDigest?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Maximum accepted signals per app+origin window.
|
|
221
|
-
*
|
|
222
|
-
* @default 30
|
|
223
|
-
*/
|
|
224
|
-
maxSignalsPerWindow?: number;
|
|
225
|
-
/**
|
|
226
|
-
* Sliding window size in milliseconds for maxSignalsPerWindow.
|
|
227
|
-
*
|
|
228
|
-
* @default 60000
|
|
229
|
-
*/
|
|
230
|
-
windowMs?: number;
|
|
231
|
-
/**
|
|
232
|
-
* Drop duplicate fallback events with the same fingerprint during this window.
|
|
233
|
-
*
|
|
234
|
-
* @default 10000
|
|
235
|
-
*/
|
|
236
|
-
dedupeWindowMs?: number;
|
|
237
|
-
}
|
|
238
|
-
export interface ServerTelemetryCanaryUserConfig {
|
|
239
|
-
/**
|
|
240
|
-
* Enable canary rollout/rollback orchestration.
|
|
241
|
-
*
|
|
242
|
-
* @default false
|
|
243
|
-
*/
|
|
244
|
-
enabled?: boolean;
|
|
245
|
-
/**
|
|
246
|
-
* Periodic canary evaluation interval in milliseconds.
|
|
247
|
-
*
|
|
248
|
-
* @default 15000
|
|
249
|
-
*/
|
|
250
|
-
evaluationIntervalMs?: number;
|
|
251
|
-
/**
|
|
252
|
-
* Required consecutive healthy evaluations before promotion.
|
|
253
|
-
*
|
|
254
|
-
* @default 3
|
|
255
|
-
*/
|
|
256
|
-
minConsecutiveHealthyEvaluations?: number;
|
|
257
|
-
/**
|
|
258
|
-
* Consecutive failing evaluations before automated rollback.
|
|
259
|
-
*
|
|
260
|
-
* @default 2
|
|
261
|
-
*/
|
|
262
|
-
rollbackConsecutiveFailures?: number;
|
|
263
|
-
/**
|
|
264
|
-
* Maximum queue utilization ratio allowed during canary.
|
|
265
|
-
*
|
|
266
|
-
* @default 0.8
|
|
267
|
-
*/
|
|
268
|
-
maxQueueUtilization?: number;
|
|
269
|
-
/**
|
|
270
|
-
* Maximum allowed total dropped envelopes during canary.
|
|
271
|
-
*
|
|
272
|
-
* @default 0
|
|
273
|
-
*/
|
|
274
|
-
maxTotalDropped?: number;
|
|
275
|
-
/**
|
|
276
|
-
* Maximum allowed unhealthy exporters during canary.
|
|
277
|
-
*
|
|
278
|
-
* @default 0
|
|
279
|
-
*/
|
|
280
|
-
maxUnhealthyExporters?: number;
|
|
281
|
-
/**
|
|
282
|
-
* Contract gate map used in rollout decisions.
|
|
283
|
-
* `true` means passing, `false` means failing.
|
|
284
|
-
*/
|
|
285
|
-
contractGates?: Record<string, boolean | ServerTelemetryCanaryContractGateUserConfig>;
|
|
286
|
-
/**
|
|
287
|
-
* Contract-gate autopilot settings.
|
|
288
|
-
*/
|
|
289
|
-
autopilot?: ServerTelemetryCanaryAutopilotUserConfig;
|
|
290
|
-
}
|
|
291
|
-
export interface ServerTelemetryUserConfig {
|
|
292
|
-
/**
|
|
293
|
-
* Enable framework telemetry envelope emission.
|
|
294
|
-
* @default false
|
|
295
|
-
*/
|
|
296
|
-
enabled?: boolean;
|
|
297
|
-
/**
|
|
298
|
-
* Logical service name attached to every telemetry envelope.
|
|
299
|
-
* @default server.metaName
|
|
300
|
-
*/
|
|
301
|
-
service?: string;
|
|
302
|
-
/**
|
|
303
|
-
* Logical module name attached to every telemetry envelope.
|
|
304
|
-
* @default "server"
|
|
305
|
-
*/
|
|
306
|
-
module?: string;
|
|
307
|
-
/**
|
|
308
|
-
* Environment attached to every telemetry envelope.
|
|
309
|
-
* @default process.env.NODE_ENV || "development"
|
|
310
|
-
*/
|
|
311
|
-
environment?: string;
|
|
312
|
-
/**
|
|
313
|
-
* Sampling rate for monitor events.
|
|
314
|
-
* @default 1
|
|
315
|
-
*/
|
|
316
|
-
samplingRate?: number;
|
|
317
|
-
/**
|
|
318
|
-
* Flush window in milliseconds for exporter batches.
|
|
319
|
-
* @default 1000
|
|
320
|
-
*/
|
|
321
|
-
flushIntervalMs?: number;
|
|
322
|
-
/**
|
|
323
|
-
* Maximum envelopes in one emitted batch.
|
|
324
|
-
* @default 50
|
|
325
|
-
*/
|
|
326
|
-
maxBatchSize?: number;
|
|
327
|
-
/**
|
|
328
|
-
* Maximum envelopes buffered before backpressure drops oldest.
|
|
329
|
-
* @default 1000
|
|
330
|
-
*/
|
|
331
|
-
maxQueueSize?: number;
|
|
332
|
-
/**
|
|
333
|
-
* Envelope attribute keys that should be redacted.
|
|
334
|
-
*/
|
|
335
|
-
redactionKeys?: string[];
|
|
336
|
-
/**
|
|
337
|
-
* Control startup exporter health probe behavior.
|
|
338
|
-
* When enabled (default), server initialization emits a startup probe and
|
|
339
|
-
* marks exporters healthy/unhealthy before serving traffic.
|
|
340
|
-
* When fail-loud mode is enabled (default), initialization throws if at
|
|
341
|
-
* least one configured exporter is unhealthy.
|
|
342
|
-
*
|
|
343
|
-
* @default true
|
|
344
|
-
*/
|
|
345
|
-
failLoudStartup?: boolean;
|
|
346
|
-
/**
|
|
347
|
-
* Queue backpressure/degradation SLO alert thresholds.
|
|
348
|
-
*/
|
|
349
|
-
slo?: ServerTelemetrySloUserConfig;
|
|
350
|
-
/**
|
|
351
|
-
* Canary rollout and automated rollback orchestration policy.
|
|
352
|
-
*/
|
|
353
|
-
canary?: ServerTelemetryCanaryUserConfig;
|
|
354
|
-
exporters?: {
|
|
355
|
-
/**
|
|
356
|
-
* OpenTelemetry HTTP exporter.
|
|
357
|
-
*/
|
|
358
|
-
otlp?: ServerTelemetryExporterOptions;
|
|
359
|
-
/**
|
|
360
|
-
* VictoriaMetrics Prometheus import exporter.
|
|
361
|
-
*/
|
|
362
|
-
victoriaMetrics?: ServerTelemetryVictoriaMetricsOptions;
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
32
|
export interface ServerUserConfig {
|
|
366
33
|
publicDir?: string | string[];
|
|
367
34
|
routes?: Routes;
|
|
@@ -399,4 +66,3 @@ export interface ServerUserConfig {
|
|
|
399
66
|
tsconfigPath?: string;
|
|
400
67
|
}
|
|
401
68
|
export type ServerNormalizedConfig = ServerUserConfig;
|
|
402
|
-
export {};
|