@bleedingdev/modern-js-server-runtime-extensions 3.8.3-ultramodern.6 → 3.9.0-ultramodern.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/cjs/bff-policy/crossProjectPolicy.js +299 -0
- package/dist/cjs/bff-policy/index.js +62 -0
- package/dist/cjs/bff-policy/node.js +69 -0
- package/dist/cjs/bff-policy/operationContracts.js +182 -0
- package/dist/cjs/bff-policy/resolveCrossProjectPolicy.js +65 -0
- package/dist/cjs/contract-gate-snapshot-store/http-store.js +1 -8
- package/dist/cjs/errorResponsePlugin.js +57 -0
- package/dist/cjs/localisedLoaderPlugin.js +62 -0
- package/dist/cjs/mfCache.js +6 -0
- package/dist/cjs/module-federation-css/plugin.js +6 -0
- package/dist/cjs/serverConfig.js +18 -0
- package/dist/cjs/serverPlugin.js +74 -0
- package/dist/cjs/static-serving/plugin.js +57 -0
- package/dist/cjs/static-serving/responders.js +158 -0
- package/dist/cjs/static-serving/staticModuleFederation.js +173 -0
- package/dist/cjs/static-serving/staticPrecompressed.js +152 -0
- package/dist/cjs/telemetry/exporters.js +4 -4
- package/dist/cjs/telemetry/healthSetup.js +14 -14
- package/dist/cjs/telemetry/lifecycle.js +20 -21
- package/dist/cjs/telemetry/plugin.js +10 -4
- package/dist/cjs/telemetry/runtimeEndpoints.js +3 -2
- package/dist/cjs/telemetryCore.js +5 -5
- package/dist/esm/bff-policy/crossProjectPolicy.mjs +249 -0
- package/dist/esm/bff-policy/index.mjs +1 -0
- package/dist/esm/contract-gate-snapshot-store/http-store.mjs +1 -8
- package/dist/esm/errorResponsePlugin.mjs +19 -0
- package/dist/esm/localisedLoaderPlugin.mjs +24 -0
- package/dist/esm/mfCache.mjs +6 -0
- package/dist/esm/module-federation-css/plugin.mjs +6 -0
- package/dist/esm/serverConfig.mjs +0 -0
- package/dist/esm/serverPlugin.mjs +34 -0
- package/dist/esm/telemetry/exporters.mjs +2 -2
- package/dist/esm/telemetry/healthSetup.mjs +14 -14
- package/dist/esm/telemetry/lifecycle.mjs +21 -22
- package/dist/esm/telemetry/plugin.mjs +9 -3
- package/dist/esm/telemetry/runtimeEndpoints.mjs +3 -2
- package/dist/esm/telemetryCore.mjs +1 -1
- package/dist/esm-node/bff-policy/crossProjectPolicy.mjs +250 -0
- package/dist/esm-node/bff-policy/index.mjs +2 -0
- package/dist/esm-node/bff-policy/node.mjs +3 -0
- package/dist/esm-node/bff-policy/operationContracts.mjs +129 -0
- package/dist/esm-node/bff-policy/resolveCrossProjectPolicy.mjs +28 -0
- package/dist/esm-node/contract-gate-snapshot-store/http-store.mjs +1 -8
- package/dist/esm-node/errorResponsePlugin.mjs +20 -0
- package/dist/esm-node/localisedLoaderPlugin.mjs +25 -0
- package/dist/esm-node/mfCache.mjs +6 -0
- package/dist/esm-node/module-federation-css/plugin.mjs +6 -0
- package/dist/esm-node/serverConfig.mjs +1 -0
- package/dist/esm-node/serverPlugin.mjs +35 -0
- package/dist/esm-node/static-serving/plugin.mjs +18 -0
- package/dist/esm-node/static-serving/responders.mjs +111 -0
- package/dist/esm-node/static-serving/staticModuleFederation.mjs +105 -0
- package/dist/esm-node/static-serving/staticPrecompressed.mjs +112 -0
- package/dist/esm-node/telemetry/exporters.mjs +2 -2
- package/dist/esm-node/telemetry/healthSetup.mjs +14 -14
- package/dist/esm-node/telemetry/lifecycle.mjs +21 -22
- package/dist/esm-node/telemetry/plugin.mjs +9 -3
- package/dist/esm-node/telemetry/runtimeEndpoints.mjs +3 -2
- package/dist/esm-node/telemetryCore.mjs +1 -1
- package/dist/types/backend-federation-security/node.d.ts +1 -1
- package/dist/types/bff-policy/crossProjectPolicy.d.ts +101 -0
- package/dist/types/bff-policy/index.d.ts +1 -0
- package/dist/types/bff-policy/node.d.ts +2 -0
- package/dist/types/bff-policy/operationContracts.d.ts +85 -0
- package/dist/types/bff-policy/resolveCrossProjectPolicy.d.ts +39 -0
- package/dist/types/contract-gate-snapshot-normalization.d.ts +1 -1
- package/dist/types/contract-gate-snapshot-store/file-store.d.ts +1 -1
- package/dist/types/contract-gate-snapshot-store/http-store.d.ts +1 -1
- package/dist/types/contract-gate-snapshot-store/index.d.ts +5 -5
- package/dist/types/contract-gate-snapshot-store/resolve.d.ts +1 -1
- package/dist/types/contractGateSnapshotObserver.d.ts +2 -2
- package/dist/types/errorResponsePlugin.d.ts +3 -0
- package/dist/types/index.d.ts +8 -7
- package/dist/types/localisedLoaderPlugin.d.ts +2 -0
- package/dist/types/mfCache.d.ts +2 -3
- package/dist/types/module-federation-css/collector.d.ts +1 -1
- package/dist/types/module-federation-css/index.d.ts +8 -8
- package/dist/types/module-federation-css/plugin.d.ts +2 -3
- package/dist/types/runtime-fallback-signal/index.d.ts +4 -4
- package/dist/types/runtime-fallback-signal/model.d.ts +1 -1
- package/dist/types/runtime-fallback-signal/resolver.d.ts +1 -1
- package/dist/types/runtime-fallback-signal/store.d.ts +1 -1
- package/dist/types/runtimeFallbackSignal.d.ts +1 -1
- package/dist/types/serverConfig.d.ts +17 -0
- package/dist/types/serverPlugin.d.ts +5 -0
- package/dist/types/static-serving/plugin.d.ts +3 -0
- package/dist/types/static-serving/responders.d.ts +2 -0
- package/dist/types/static-serving/staticModuleFederation.d.ts +13 -0
- package/dist/types/static-serving/staticPrecompressed.d.ts +13 -0
- package/dist/types/telemetry/exporters.d.ts +2 -2
- package/dist/types/telemetry/healthEvaluation.d.ts +2 -2
- package/dist/types/telemetry/healthMonitor.d.ts +2 -2
- package/dist/types/telemetry/healthSetup.d.ts +6 -6
- package/dist/types/telemetry/lifecycle.d.ts +6 -6
- package/dist/types/telemetry/metrics.d.ts +1 -1
- package/dist/types/telemetry/plugin.d.ts +5 -4
- package/dist/types/telemetry/registry.d.ts +2 -2
- package/dist/types/telemetry/runtimeEndpoints.d.ts +2 -2
- package/dist/types/telemetry.d.ts +1 -1
- package/dist/types/telemetryCore.d.ts +6 -6
- package/dist/types-esm/backend-federation-security/index.d.mts +68 -0
- package/dist/types-esm/backend-federation-security/node.d.mts +3 -0
- package/dist/types-esm/bff-policy/crossProjectPolicy.d.mts +101 -0
- package/dist/types-esm/bff-policy/index.d.mts +1 -0
- package/dist/types-esm/bff-policy/node.d.mts +2 -0
- package/dist/types-esm/bff-policy/operationContracts.d.mts +85 -0
- package/dist/types-esm/bff-policy/resolveCrossProjectPolicy.d.mts +39 -0
- package/dist/types-esm/contract-gate-snapshot-normalization.d.mts +15 -0
- package/dist/types-esm/contract-gate-snapshot-store/file-store.d.mts +3 -0
- package/dist/types-esm/contract-gate-snapshot-store/http-store.d.mts +5 -0
- package/dist/types-esm/contract-gate-snapshot-store/index.d.mts +5 -0
- package/dist/types-esm/contract-gate-snapshot-store/resolve.d.mts +9 -0
- package/dist/types-esm/contract-gate-snapshot-store/types.d.mts +47 -0
- package/dist/types-esm/contractGateSnapshotObserver.d.mts +33 -0
- package/dist/types-esm/env.d.mts +40 -0
- package/dist/types-esm/errorResponsePlugin.d.mts +3 -0
- package/dist/types-esm/index.d.mts +8 -0
- package/dist/types-esm/localisedLoaderPlugin.d.mts +2 -0
- package/dist/types-esm/mfCache.d.mts +26 -0
- package/dist/types-esm/module-federation-css/collector.d.mts +25 -0
- package/dist/types-esm/module-federation-css/index.d.mts +8 -0
- package/dist/types-esm/module-federation-css/manifest.d.mts +28 -0
- package/dist/types-esm/module-federation-css/plugin.d.mts +22 -0
- package/dist/types-esm/module-federation-css/remote.d.mts +20 -0
- package/dist/types-esm/runtime-fallback-signal/index.d.mts +4 -0
- package/dist/types-esm/runtime-fallback-signal/model.d.mts +70 -0
- package/dist/types-esm/runtime-fallback-signal/resolver.d.mts +29 -0
- package/dist/types-esm/runtime-fallback-signal/store.d.mts +4 -0
- package/dist/types-esm/runtimeFallbackSignal.d.mts +1 -0
- package/dist/types-esm/runtimeLifecycle.d.mts +10 -0
- package/dist/types-esm/serverConfig.d.mts +17 -0
- package/dist/types-esm/serverPlugin.d.mts +5 -0
- package/dist/types-esm/static-serving/plugin.d.mts +3 -0
- package/dist/types-esm/static-serving/responders.d.mts +2 -0
- package/dist/types-esm/static-serving/staticModuleFederation.d.mts +13 -0
- package/dist/types-esm/static-serving/staticPrecompressed.d.mts +13 -0
- package/dist/types-esm/telemetry/envelope.d.mts +55 -0
- package/dist/types-esm/telemetry/exporters.d.mts +12 -0
- package/dist/types-esm/telemetry/healthEvaluation.d.mts +20 -0
- package/dist/types-esm/telemetry/healthMonitor.d.mts +88 -0
- package/dist/types-esm/telemetry/healthSetup.d.mts +17 -0
- package/dist/types-esm/telemetry/lifecycle.d.mts +18 -0
- package/dist/types-esm/telemetry/metrics.d.mts +3 -0
- package/dist/types-esm/telemetry/plugin.d.mts +13 -0
- package/dist/types-esm/telemetry/registry.d.mts +69 -0
- package/dist/types-esm/telemetry/registryTypes.d.mts +50 -0
- package/dist/types-esm/telemetry/runtimeEndpoints.d.mts +35 -0
- package/dist/types-esm/telemetry.d.mts +1 -0
- package/dist/types-esm/telemetryCore.d.mts +6 -0
- package/package.json +160 -28
- package/rslib.config.mts +36 -2
- package/rstest.config.mts +11 -0
- package/src/bff-policy/crossProjectPolicy.ts +754 -0
- package/src/bff-policy/index.ts +1 -0
- package/src/bff-policy/node.ts +2 -0
- package/src/bff-policy/operationContracts.ts +298 -0
- package/src/bff-policy/resolveCrossProjectPolicy.ts +88 -0
- package/src/contract-gate-snapshot-store/http-store.ts +1 -11
- package/src/errorResponsePlugin.ts +21 -0
- package/src/index.ts +4 -0
- package/src/localisedLoaderPlugin.ts +34 -0
- package/src/mfCache.ts +4 -3
- package/src/module-federation-css/plugin.ts +4 -3
- package/src/serverConfig.ts +32 -0
- package/src/serverPlugin.ts +38 -0
- package/src/static-serving/plugin.ts +16 -0
- package/src/static-serving/responders.ts +208 -0
- package/src/static-serving/staticModuleFederation.ts +255 -0
- package/src/static-serving/staticPrecompressed.ts +193 -0
- package/src/telemetry/exporters.ts +1 -1
- package/src/telemetry/healthSetup.ts +17 -20
- package/src/telemetry/lifecycle.ts +27 -39
- package/src/telemetry/plugin.ts +6 -4
- package/src/telemetry/runtimeEndpoints.ts +3 -2
- package/src/telemetryCore.ts +1 -1
- package/tests/bff-policy/crossProjectPolicy.matrix.test.ts +450 -0
- package/tests/bff-policy/crossProjectPolicy.test.ts +197 -0
- package/tests/bff-policy/operationContracts.test.ts +221 -0
- package/tests/bff-policy/optionalZodPeer.test.ts +30 -0
- package/tests/bff-policy/resolveCrossProjectPolicy.test.ts +76 -0
- package/tests/contractGateSnapshotObserver.test.ts +0 -58
- package/tests/contractGateSnapshotStore.test.ts +0 -51
- package/tests/env.test.ts +45 -64
- package/tests/localisedLoader.test.ts +120 -0
- package/tests/mfCache.test.ts +1 -88
- package/tests/moduleFederationCss.test.ts +4 -48
- package/tests/nativeErrorResponse.test.ts +118 -0
- package/tests/nativeServerAssembly.test.ts +385 -0
- package/tests/runtimeLifecycle.test.ts +69 -17
- package/tests/static-serving/ordering.test.ts +214 -0
- package/tests/static-serving/static.test.ts +411 -0
- package/tests/telemetry.test.ts +35 -198
- package/tests/telemetryHealthMonitor.test.ts +0 -4
- package/tests/telemetryHealthObservation.test.ts +302 -0
- package/tests/telemetryLifecycle.test.ts +7 -303
- package/tests/telemetryRegistryQueueMatrix.test.ts +14 -111
- package/tests/registration.test.ts +0 -112
- package/tests/telemetryAutopilot.test.ts +0 -1134
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
type ApiHandler = (...args: any) => any | Promise<any>;
|
|
3
|
+
export type OperationContractEntry = {
|
|
4
|
+
name: string;
|
|
5
|
+
httpMethod: string;
|
|
6
|
+
routePath: string;
|
|
7
|
+
};
|
|
8
|
+
export type OperationContractDefinition = {
|
|
9
|
+
requestId: string;
|
|
10
|
+
operationVersion: number;
|
|
11
|
+
schemaHash: string;
|
|
12
|
+
method: string;
|
|
13
|
+
routePath: string;
|
|
14
|
+
operationId: string;
|
|
15
|
+
handlerName: string;
|
|
16
|
+
filename?: string;
|
|
17
|
+
};
|
|
18
|
+
export type OperationContractMap = Record<string, OperationContractDefinition>;
|
|
19
|
+
export declare const DEFAULT_OPERATION_VERSION = 1;
|
|
20
|
+
/**
|
|
21
|
+
* Derives the operation version from a producer package version: the semver
|
|
22
|
+
* major is the contract version, so consumers regenerated against an older
|
|
23
|
+
* producer major fail the `operation_version_mismatch` gate instead of
|
|
24
|
+
* silently calling an incompatible API.
|
|
25
|
+
*
|
|
26
|
+
* Falls back to {@link DEFAULT_OPERATION_VERSION} when no parseable version
|
|
27
|
+
* is available.
|
|
28
|
+
*/
|
|
29
|
+
export declare const deriveOperationVersion: (packageVersion?: unknown) => number;
|
|
30
|
+
/**
|
|
31
|
+
* Serializes the zod input schemas attached to an operator-decorated handler
|
|
32
|
+
* (`Data`/`Query`/`Params`/`Headers`/`Upload` metadata) into JSON-schema
|
|
33
|
+
* documents. Returns `undefined` for handlers without schema metadata
|
|
34
|
+
* (plain handlers, farrow schema-mode handlers).
|
|
35
|
+
*/
|
|
36
|
+
export declare const serializeOperationSchemas: (handler: ApiHandler | undefined) => Record<string, unknown> | undefined;
|
|
37
|
+
export type OperationContractHashInput = OperationContractEntry & {
|
|
38
|
+
/** Serialized schema documents; omit for schema-less operations. */
|
|
39
|
+
schemas?: Record<string, unknown> | undefined;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Per-operation contract hash. The hash covers the operation identity
|
|
43
|
+
* (name, method, route, producer requestId) plus the serialized input
|
|
44
|
+
* schemas, so:
|
|
45
|
+
*
|
|
46
|
+
* - changing an input schema changes the hash of exactly that operation;
|
|
47
|
+
* - reordering routes or adding unrelated operations never rotates the hash
|
|
48
|
+
* of other operations (each operation is hashed independently).
|
|
49
|
+
*/
|
|
50
|
+
export declare const createOperationContractHash: (operation: OperationContractHashInput, requestId: string) => string;
|
|
51
|
+
export declare const createOperationEntries: (handlers: Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
httpMethod: string;
|
|
54
|
+
routePath: string;
|
|
55
|
+
}>) => OperationContractEntry[];
|
|
56
|
+
/**
|
|
57
|
+
* Aggregate hash over a set of per-operation contract hashes. Used for the
|
|
58
|
+
* module-level `operationSchemaHash` manifest export; stable across route
|
|
59
|
+
* reordering because the per-operation hashes are sorted before hashing.
|
|
60
|
+
*/
|
|
61
|
+
export declare const createOperationSchemaHash: (operationEntries: Array<OperationContractEntry & {
|
|
62
|
+
schemaHash?: string;
|
|
63
|
+
}>, requestId: string) => string;
|
|
64
|
+
export type OperationContractSource = {
|
|
65
|
+
name: string;
|
|
66
|
+
httpMethod: string;
|
|
67
|
+
routePath: string;
|
|
68
|
+
filename?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Optional handler function used to serialize schema metadata. Sources
|
|
71
|
+
* without a handler (e.g. reflected Effect HttpApi endpoints) hash the
|
|
72
|
+
* route identity only.
|
|
73
|
+
*/
|
|
74
|
+
handler?: ApiHandler;
|
|
75
|
+
};
|
|
76
|
+
export declare const buildOperationContractMap: ({ handlers, requestId, operationVersion, }: {
|
|
77
|
+
handlers: OperationContractSource[];
|
|
78
|
+
requestId?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Producer contract version, usually `deriveOperationVersion(pkg.version)`.
|
|
81
|
+
* Defaults to {@link DEFAULT_OPERATION_VERSION}.
|
|
82
|
+
*/
|
|
83
|
+
operationVersion?: number;
|
|
84
|
+
}) => OperationContractMap;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CrossProjectPolicyConfig, NormalizedCrossProjectPolicy } from './crossProjectPolicy.js';
|
|
2
|
+
import { type OperationContractSource } from './operationContracts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Runtime input collected by BFF server adapters (hono/effect/...) before
|
|
5
|
+
* the cross-project policy can be enforced.
|
|
6
|
+
*
|
|
7
|
+
* `crossProjectPolicy` accepts the raw `bff.crossProjectPolicy` user config —
|
|
8
|
+
* `BffCrossProjectPolicyUserConfig` is a structural subset of
|
|
9
|
+
* `CrossProjectPolicyConfig`, so no casts are required at the call site.
|
|
10
|
+
*/
|
|
11
|
+
export interface ResolveCrossProjectPolicyInput {
|
|
12
|
+
crossProjectPolicy?: CrossProjectPolicyConfig;
|
|
13
|
+
/** Registered API handlers used to derive the operation-contract map. */
|
|
14
|
+
handlers: OperationContractSource[];
|
|
15
|
+
/** Logical producer ID (`bff.requestId`). */
|
|
16
|
+
requestId?: string;
|
|
17
|
+
/** Marker injected by generated cross-project SDK plugins. */
|
|
18
|
+
isCrossProjectServer?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Producer contract version (usually derived from the producer
|
|
21
|
+
* package.json major via `deriveOperationVersion`).
|
|
22
|
+
*/
|
|
23
|
+
operationVersion?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fully-defaulted policy returned by {@link resolveCrossProjectPolicy}.
|
|
27
|
+
*/
|
|
28
|
+
export type ResolvedCrossProjectPolicy = NormalizedCrossProjectPolicy;
|
|
29
|
+
/**
|
|
30
|
+
* Normalizes the user-facing cross-project policy config into the evaluator
|
|
31
|
+
* input shared by every BFF server adapter:
|
|
32
|
+
*
|
|
33
|
+
* - returns `undefined` when neither a policy nor the cross-project server
|
|
34
|
+
* marker is present (policy middleware must not be installed);
|
|
35
|
+
* - applies the documented defaults for all `require*` switches;
|
|
36
|
+
* - merges generated operation contracts (derived from the registered
|
|
37
|
+
* handlers) over any user-provided `expectedOperationContracts`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const resolveCrossProjectPolicy: (input: ResolveCrossProjectPolicyInput) => ResolvedCrossProjectPolicy | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ContractGateSnapshotStore } from './types';
|
|
1
|
+
import type { ContractGateSnapshotStore } from './types.js';
|
|
2
2
|
export declare const resolveContractGateSnapshotPath: (appDirectory: string, configuredPath: string | undefined) => string;
|
|
3
3
|
export declare const createFileContractGateSnapshotStore: (gateSnapshotPath: string) => ContractGateSnapshotStore;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContractGateSnapshotHttpStoreOptions, ContractGateSnapshotStore, ContractGateSnapshotStoreUserConfig } from './types';
|
|
1
|
+
import type { ContractGateSnapshotHttpStoreOptions, ContractGateSnapshotStore, ContractGateSnapshotStoreUserConfig } from './types.js';
|
|
2
2
|
export declare const createHttpContractGateSnapshotStore: (options: ContractGateSnapshotHttpStoreOptions) => ContractGateSnapshotStore;
|
|
3
3
|
export declare const tryResolveBuiltinSnapshotStore: (input: {
|
|
4
4
|
stateStore: ContractGateSnapshotStoreUserConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { createFileContractGateSnapshotStore, resolveContractGateSnapshotPath, } from './file-store';
|
|
2
|
-
export { createHttpContractGateSnapshotStore } from './http-store';
|
|
3
|
-
export { resolveContractGateSnapshotStore } from './resolve';
|
|
4
|
-
export type { ContractGateSnapshotHttpStoreOptions, ContractGateSnapshotStore, ContractGateSnapshotStoreFactory, ContractGateSnapshotStoreFactoryContext, ContractGateSnapshotStoreModule, ContractGateSnapshotStoreUserConfig, GateSnapshot, GateSnapshotGateValue, } from './types';
|
|
5
|
-
export { CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION, DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH, } from './types';
|
|
1
|
+
export { createFileContractGateSnapshotStore, resolveContractGateSnapshotPath, } from './file-store.js';
|
|
2
|
+
export { createHttpContractGateSnapshotStore } from './http-store.js';
|
|
3
|
+
export { resolveContractGateSnapshotStore } from './resolve.js';
|
|
4
|
+
export type { ContractGateSnapshotHttpStoreOptions, ContractGateSnapshotStore, ContractGateSnapshotStoreFactory, ContractGateSnapshotStoreFactoryContext, ContractGateSnapshotStoreModule, ContractGateSnapshotStoreUserConfig, GateSnapshot, GateSnapshotGateValue, } from './types.js';
|
|
5
|
+
export { CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION, DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH, } from './types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContractGateSnapshotStore, ContractGateSnapshotStoreUserConfig, GateSnapshot, LoggerLike } from './types';
|
|
1
|
+
import type { ContractGateSnapshotStore, ContractGateSnapshotStoreUserConfig, GateSnapshot, LoggerLike } from './types.js';
|
|
2
2
|
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
3
3
|
export declare const normalizeSnapshot: (snapshot: unknown) => GateSnapshot | undefined;
|
|
4
4
|
export declare const resolveContractGateSnapshotStore: (input: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ContractGateSnapshotStore } from './contract-gate-snapshot-store/types';
|
|
2
|
-
import type { TelemetryHealthMonitor } from './telemetry/healthMonitor';
|
|
1
|
+
import type { ContractGateSnapshotStore } from './contract-gate-snapshot-store/types.js';
|
|
2
|
+
import type { TelemetryHealthMonitor } from './telemetry/healthMonitor.js';
|
|
3
3
|
type LoggerLike = {
|
|
4
4
|
info?: (message: string) => void;
|
|
5
5
|
warn?: (message: string) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +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';
|
|
2
|
-
export { ContractGateSnapshotObserver, type ContractGateSnapshotObserverOptions, } from './contractGateSnapshotObserver';
|
|
3
|
-
export { DEFAULT_ENVIRONMENT_NAME, parseServerRuntimeExtensionsEnv, type ServerRuntimeExtensionsEnv, } from './env';
|
|
4
|
-
export { getRequestPathname, injectMfAssetCacheHeadersPlugin, isMfManifestAsset, isMfRemoteEntryAsset, resolveMfAssetCacheHeaders, } from './mfCache';
|
|
5
|
-
export { type CollectDirectRemoteModuleFederationCssOptions, collectDirectRemoteModuleFederationCss, collectDirectRemoteModuleFederationCssWithMeta, collectModuleFederationManifestCss, createModuleFederationCssCollector, injectModuleFederationCssPlugin, type ModuleFederationCssCollectorOptions, type ModuleFederationCssPluginOptions, type ModuleFederationManifest, type RemoteModuleFederationCssCollection, } from './module-federation-css';
|
|
6
|
-
export { createDisposableServerRuntimeHandle, type DisposableServerRuntimeHandle, disposeServerRuntime, initializeDisposableServerRuntime, registerServerRuntimeDisposer, type ServerRuntimeHandle, } from './runtimeLifecycle';
|
|
7
|
-
export
|
|
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.js';
|
|
2
|
+
export { ContractGateSnapshotObserver, type ContractGateSnapshotObserverOptions, } from './contractGateSnapshotObserver.js';
|
|
3
|
+
export { DEFAULT_ENVIRONMENT_NAME, parseServerRuntimeExtensionsEnv, type ServerRuntimeExtensionsEnv, } from './env.js';
|
|
4
|
+
export { getRequestPathname, injectMfAssetCacheHeadersPlugin, isMfManifestAsset, isMfRemoteEntryAsset, resolveMfAssetCacheHeaders, } from './mfCache.js';
|
|
5
|
+
export { type CollectDirectRemoteModuleFederationCssOptions, collectDirectRemoteModuleFederationCss, collectDirectRemoteModuleFederationCssWithMeta, collectModuleFederationManifestCss, createModuleFederationCssCollector, injectModuleFederationCssPlugin, type ModuleFederationCssCollectorOptions, type ModuleFederationCssPluginOptions, type ModuleFederationManifest, type RemoteModuleFederationCssCollection, } from './module-federation-css/index.js';
|
|
6
|
+
export { createDisposableServerRuntimeHandle, type DisposableServerRuntimeHandle, disposeServerRuntime, initializeDisposableServerRuntime, registerServerRuntimeDisposer, type ServerRuntimeHandle, } from './runtimeLifecycle.js';
|
|
7
|
+
export type { UltramodernBffUserConfig, UltramodernServerUserConfig, } from './serverConfig.js';
|
|
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.js';
|
package/dist/types/mfCache.d.ts
CHANGED
|
@@ -20,8 +20,7 @@ export declare function resolveMfAssetCacheHeaders(url: string, query?: Record<s
|
|
|
20
20
|
* - `remoteEntry*.js` revalidates unless explicitly version-pinned via a
|
|
21
21
|
* `mfv`/`v`/`version` query parameter, in which case it is immutable.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* that actually serves these assets.
|
|
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.
|
|
26
25
|
*/
|
|
27
26
|
export declare const injectMfAssetCacheHeadersPlugin: () => ServerPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Monitors } from '@modern-js/types';
|
|
2
|
-
import type { CollectDirectRemoteModuleFederationCssOptions } from './remote';
|
|
2
|
+
import type { CollectDirectRemoteModuleFederationCssOptions } from './remote.js';
|
|
3
3
|
export type ModuleFederationCssCollectorOptions = CollectDirectRemoteModuleFederationCssOptions & {
|
|
4
4
|
/**
|
|
5
5
|
* How long a successful remote CSS collection may be served from cache.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { ModuleFederationCssCollectorOptions } from './collector';
|
|
2
|
-
export { createModuleFederationCssCollector } from './collector';
|
|
3
|
-
export type { ModuleFederationManifest } from './manifest';
|
|
4
|
-
export { collectModuleFederationManifestCss } from './manifest';
|
|
5
|
-
export type { ModuleFederationCssPluginOptions } from './plugin';
|
|
6
|
-
export { injectModuleFederationCssPlugin } from './plugin';
|
|
7
|
-
export type { CollectDirectRemoteModuleFederationCssOptions, RemoteModuleFederationCssCollection, } from './remote';
|
|
8
|
-
export { collectDirectRemoteModuleFederationCss, collectDirectRemoteModuleFederationCssWithMeta, } from './remote';
|
|
1
|
+
export type { ModuleFederationCssCollectorOptions } from './collector.js';
|
|
2
|
+
export { createModuleFederationCssCollector } from './collector.js';
|
|
3
|
+
export type { ModuleFederationManifest } from './manifest.js';
|
|
4
|
+
export { collectModuleFederationManifestCss } from './manifest.js';
|
|
5
|
+
export type { ModuleFederationCssPluginOptions } from './plugin.js';
|
|
6
|
+
export { injectModuleFederationCssPlugin } from './plugin.js';
|
|
7
|
+
export type { CollectDirectRemoteModuleFederationCssOptions, RemoteModuleFederationCssCollection, } from './remote.js';
|
|
8
|
+
export { collectDirectRemoteModuleFederationCss, collectDirectRemoteModuleFederationCssWithMeta, } from './remote.js';
|
|
@@ -16,8 +16,7 @@ export type ModuleFederationCssPluginOptions = {
|
|
|
16
16
|
* being pinned at boot: remote manifests change on every remote redeploy, and
|
|
17
17
|
* fetch failures must not pin an empty/partial list for the process lifetime.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
* `serverManifest`
|
|
21
|
-
* into its plugin assembly for both production and dev servers.
|
|
19
|
+
* Existing plugin ordering places this after the native resource plugin
|
|
20
|
+
* (which sets `serverManifest`) and before the native RSC manifest plugin.
|
|
22
21
|
*/
|
|
23
22
|
export declare const injectModuleFederationCssPlugin: (options?: ModuleFederationCssPluginOptions) => ServerPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { RuntimeFallbackSignalAuthConfig, RuntimeFallbackSignalConfig, RuntimeFallbackSignalRuntimeState, RuntimeFallbackSignalSource, RuntimeFallbackSignalTrustContext, RuntimeFallbackSignalTrustPolicy, RuntimeSignalError, RuntimeSignalErrorCode, } from './model';
|
|
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';
|
|
3
|
-
export { enforceRuntimeFallbackSignalAuth, enforceRuntimeFallbackSignalAuthToken, enforceRuntimeFallbackSignalTrustPolicy, normalizeRequiredRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackTrustPolicy, resolveRuntimeFallbackSignalEndpoint, } from './resolver';
|
|
4
|
-
export { createRuntimeFallbackSignalRuntimeState, persistRuntimeFallbackContractGate, } from './store';
|
|
1
|
+
export type { RuntimeFallbackSignalAuthConfig, RuntimeFallbackSignalConfig, RuntimeFallbackSignalRuntimeState, RuntimeFallbackSignalSource, RuntimeFallbackSignalTrustContext, RuntimeFallbackSignalTrustPolicy, RuntimeSignalError, RuntimeSignalErrorCode, } from './model.js';
|
|
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.js';
|
|
3
|
+
export { enforceRuntimeFallbackSignalAuth, enforceRuntimeFallbackSignalAuthToken, enforceRuntimeFallbackSignalTrustPolicy, normalizeRequiredRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackTrustPolicy, resolveRuntimeFallbackSignalEndpoint, } from './resolver.js';
|
|
4
|
+
export { createRuntimeFallbackSignalRuntimeState, persistRuntimeFallbackContractGate, } from './store.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context, ServerEnv } from '@modern-js/server-core';
|
|
2
|
-
import type { ContractGateSnapshotStore } from '../contract-gate-snapshot-store';
|
|
2
|
+
import type { ContractGateSnapshotStore } from '../contract-gate-snapshot-store/index.js';
|
|
3
3
|
export declare const DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = "/_modern/contract-gates/runtime-fallback";
|
|
4
4
|
export declare const DEFAULT_RUNTIME_STATUS_ENDPOINT = "/_modern/runtime/status";
|
|
5
5
|
export declare const DEFAULT_RUNTIME_FALLBACK_GATE_NAME = "runtime-mf-fallback-health";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context, ServerEnv } from '@modern-js/server-core';
|
|
2
|
-
import type { RuntimeFallbackSignalAuthConfig, RuntimeFallbackSignalConfig, RuntimeFallbackSignalSource, RuntimeFallbackSignalTrustContext, RuntimeFallbackSignalTrustPolicy } from './model';
|
|
2
|
+
import type { RuntimeFallbackSignalAuthConfig, RuntimeFallbackSignalConfig, RuntimeFallbackSignalSource, RuntimeFallbackSignalTrustContext, RuntimeFallbackSignalTrustPolicy } from './model.js';
|
|
3
3
|
export declare function resolveRuntimeFallbackSignalEndpoint(configuredEndpoint?: string): string;
|
|
4
4
|
export declare function normalizeRuntimeFallbackSignalAuthConfig(configured: {
|
|
5
5
|
enabled?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimeFallbackSignalConfig, RuntimeFallbackSignalRuntimeState, RuntimeFallbackSignalTrustPolicy } from './model';
|
|
1
|
+
import type { RuntimeFallbackSignalConfig, RuntimeFallbackSignalRuntimeState, RuntimeFallbackSignalTrustPolicy } from './model.js';
|
|
2
2
|
export declare function createRuntimeFallbackSignalRuntimeState(): RuntimeFallbackSignalRuntimeState;
|
|
3
3
|
export declare function cleanupRuntimeFallbackSignalRuntimeState(now: number, runtimeState: RuntimeFallbackSignalRuntimeState, trustPolicy: RuntimeFallbackSignalTrustPolicy): void;
|
|
4
4
|
export declare function persistRuntimeFallbackContractGate(payload: Record<string, unknown>, runtimeSignalConfig: RuntimeFallbackSignalConfig): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './runtime-fallback-signal';
|
|
1
|
+
export * from './runtime-fallback-signal/index.js';
|
|
@@ -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.js';
|
|
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,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 {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TelemetryExporter } from './envelope';
|
|
1
|
+
import type { TelemetryExporter } from './envelope.js';
|
|
2
2
|
export interface OtlpExporterOptions {
|
|
3
3
|
endpoint?: string;
|
|
4
4
|
headers?: Record<string, string>;
|
|
@@ -9,4 +9,4 @@ export interface VictoriaMetricsExporterOptions extends OtlpExporterOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function createOtlpTelemetryExporter(options?: OtlpExporterOptions): TelemetryExporter;
|
|
11
11
|
export declare function createVictoriaMetricsTelemetryExporter(options?: VictoriaMetricsExporterOptions): TelemetryExporter;
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function warnOnMetricsOtlpEndpoint(endpoint: string | undefined): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TelemetryContractGateStatus, TelemetryHealthFailure } from './healthMonitor';
|
|
2
|
-
import type { TelemetryQueueStats } from './registryTypes';
|
|
1
|
+
import type { TelemetryContractGateStatus, TelemetryHealthFailure } from './healthMonitor.js';
|
|
2
|
+
import type { TelemetryQueueStats } from './registryTypes.js';
|
|
3
3
|
interface TelemetryHealthMetrics {
|
|
4
4
|
queueStats: TelemetryQueueStats;
|
|
5
5
|
unhealthyExporterCount: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TelemetryRegistry } from './registry';
|
|
2
|
-
import type { TelemetryQueueStats } from './registryTypes';
|
|
1
|
+
import type { TelemetryRegistry } from './registry.js';
|
|
2
|
+
import type { TelemetryQueueStats } from './registryTypes.js';
|
|
3
3
|
export type TelemetryHealthState = 'pending' | 'healthy' | 'unhealthy';
|
|
4
4
|
export type TelemetryHealthTransition = 'none' | 'became_healthy' | 'became_unhealthy';
|
|
5
5
|
export type TelemetryHealthFailureReason = 'queue_utilization' | 'queue_dropped' | 'unhealthy_exporter' | 'contract_gate_missing' | 'contract_gate_failed';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ServerTelemetryUserConfig } from '@modern-js/server-
|
|
2
|
-
import { type ContractGateSnapshotStore } from '../contract-gate-snapshot-store';
|
|
3
|
-
import { type RuntimeFallbackSignalAuthConfig, type RuntimeFallbackSignalConfig } from '../runtimeFallbackSignal';
|
|
4
|
-
import { TelemetryHealthMonitor, TelemetryRegistry } from '../telemetryCore';
|
|
1
|
+
import type { ServerTelemetryUserConfig } from '@modern-js/runtime-extensions/server-config';
|
|
2
|
+
import { type ContractGateSnapshotStore } from '../contract-gate-snapshot-store/index.js';
|
|
3
|
+
import { type RuntimeFallbackSignalAuthConfig, type RuntimeFallbackSignalConfig } from '../runtimeFallbackSignal.js';
|
|
4
|
+
import { TelemetryHealthMonitor, TelemetryRegistry } from '../telemetryCore.js';
|
|
5
5
|
type SetupTelemetryHealthMonitoringOptions = {
|
|
6
6
|
registry: TelemetryRegistry;
|
|
7
7
|
appDirectory: string;
|
|
8
|
-
|
|
8
|
+
healthConfig: ServerTelemetryUserConfig['health'] | undefined;
|
|
9
9
|
};
|
|
10
10
|
type SetupTelemetryHealthMonitoringResult = {
|
|
11
11
|
healthMonitor?: TelemetryHealthMonitor;
|
|
@@ -13,5 +13,5 @@ type SetupTelemetryHealthMonitoringResult = {
|
|
|
13
13
|
runtimeFallbackSignalConfig?: RuntimeFallbackSignalConfig;
|
|
14
14
|
runtimeStatusAuthConfig?: RuntimeFallbackSignalAuthConfig;
|
|
15
15
|
};
|
|
16
|
-
export declare const setupTelemetryHealthMonitoring: ({ registry, appDirectory,
|
|
16
|
+
export declare const setupTelemetryHealthMonitoring: ({ registry, appDirectory, healthConfig, }: SetupTelemetryHealthMonitoringOptions) => SetupTelemetryHealthMonitoringResult;
|
|
17
17
|
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { ServerTelemetryUserConfig } from '@modern-js/server-
|
|
2
|
-
import { type ContractGateSnapshotStore } from '../contract-gate-snapshot-store';
|
|
3
|
-
import { TelemetryHealthMonitor, TelemetryRegistry } from '../telemetryCore';
|
|
1
|
+
import type { ServerTelemetryUserConfig } from '@modern-js/runtime-extensions/server-config';
|
|
2
|
+
import { type ContractGateSnapshotStore } from '../contract-gate-snapshot-store/index.js';
|
|
3
|
+
import { TelemetryHealthMonitor, TelemetryRegistry } from '../telemetryCore.js';
|
|
4
4
|
type TelemetryLifecycleApi = {
|
|
5
|
-
|
|
5
|
+
onDispose: (disposer: () => Promise<void>) => () => void;
|
|
6
6
|
onPrepare: (prepare: () => Promise<void>) => void;
|
|
7
7
|
};
|
|
8
8
|
type RegisterTelemetryLifecycleOptions = {
|
|
9
9
|
api: TelemetryLifecycleApi;
|
|
10
10
|
registry: TelemetryRegistry;
|
|
11
11
|
telemetryConfig: ServerTelemetryUserConfig;
|
|
12
|
-
|
|
12
|
+
healthConfig: ServerTelemetryUserConfig['health'] | undefined;
|
|
13
13
|
healthMonitor?: TelemetryHealthMonitor;
|
|
14
14
|
gateSnapshotStorePromise?: Promise<ContractGateSnapshotStore>;
|
|
15
15
|
appDirectory: string;
|
|
16
16
|
};
|
|
17
|
-
export declare const registerTelemetryLifecycle: ({ api, registry, telemetryConfig,
|
|
17
|
+
export declare const registerTelemetryLifecycle: ({ api, registry, telemetryConfig, healthConfig, healthMonitor, gateSnapshotStorePromise, appDirectory, }: RegisterTelemetryLifecycleOptions) => void;
|
|
18
18
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Metrics } from '@modern-js/types';
|
|
2
|
-
import type { TelemetryRegistry } from './registry';
|
|
2
|
+
import type { TelemetryRegistry } from './registry.js';
|
|
3
3
|
export declare const createTelemetryAwareMetrics: <T extends Metrics>(baseMetrics: T, registry: TelemetryRegistry) => T;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
import type { ServerTelemetryUserConfig } from '@modern-js/runtime-extensions/server-config';
|
|
2
|
+
import type { ServerPlugin } from '@modern-js/server-core';
|
|
3
|
+
import { type TelemetryRegistryOptions } from '../telemetryCore.js';
|
|
4
|
+
export { createRuntimeFallbackSignalRuntimeState, createRuntimeSignalError, DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT, DEFAULT_RUNTIME_STATUS_ENDPOINT, enforceRuntimeFallbackSignalAuthToken, enforceRuntimeFallbackSignalTrustPolicy, getRuntimeSignalErrorStatusCode, normalizeRequiredRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackTrustPolicy, parseRuntimeFallbackSignalPayloadFromRawBody, type RuntimeFallbackSignalAuthConfig, type RuntimeFallbackSignalRuntimeState, type RuntimeFallbackSignalSource, type RuntimeFallbackSignalTrustContext, type RuntimeFallbackSignalTrustPolicy, type RuntimeSignalError, type RuntimeSignalErrorCode, resolveRuntimeFallbackSignalEndpoint, } from '../runtimeFallbackSignal.js';
|
|
5
|
+
export { createOtlpTelemetryExporter, createTelemetryAwareMetrics, createVictoriaMetricsTelemetryExporter, type OtlpExporterOptions, type TelemetryContractGateStatus, type TelemetryEnvelope, type TelemetryExporter, type TelemetryExporterHealthStatus, type TelemetryHealthEvaluation, type TelemetryHealthFailure, type TelemetryHealthFailureReason, TelemetryHealthMonitor, type TelemetryHealthMonitorOptions, type TelemetryHealthState, type TelemetryHealthStatusSnapshot, type TelemetryHealthTransition, type TelemetryQueueStats, TelemetryRegistry, type TelemetryRegistryOptions, type TelemetrySignalType, type TelemetrySloAlert, type TelemetrySloAlertType, TelemetryStartupHealthError, type VictoriaMetricsExporterOptions, } from '../telemetryCore.js';
|
|
5
6
|
export declare const hasEnabledTelemetryExporters: (config: ServerTelemetryUserConfig | undefined) => boolean;
|
|
6
7
|
/**
|
|
7
8
|
* Builds the registry SLO options from `server.telemetry.slo`, attaching a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type TelemetryEnvelope, type TelemetryExporter } from './envelope';
|
|
2
|
-
import { type TelemetryExporterHealthStatus, type TelemetryQueueStats, type TelemetryRegistryOptions } from './registryTypes';
|
|
1
|
+
import { type TelemetryEnvelope, type TelemetryExporter } from './envelope.js';
|
|
2
|
+
import { type TelemetryExporterHealthStatus, type TelemetryQueueStats, type TelemetryRegistryOptions } from './registryTypes.js';
|
|
3
3
|
export declare class TelemetryRegistry {
|
|
4
4
|
private readonly exporters;
|
|
5
5
|
private readonly queue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context, ServerEnv } from '@modern-js/server-core';
|
|
2
|
-
import { type RuntimeFallbackSignalAuthConfig, type RuntimeFallbackSignalConfig } from '../runtimeFallbackSignal';
|
|
3
|
-
import type { TelemetryHealthMonitor, TelemetryRegistry } from '../telemetryCore';
|
|
2
|
+
import { type RuntimeFallbackSignalAuthConfig, type RuntimeFallbackSignalConfig } from '../runtimeFallbackSignal.js';
|
|
3
|
+
import type { TelemetryHealthMonitor, TelemetryRegistry } from '../telemetryCore.js';
|
|
4
4
|
type RuntimeStatusMiddlewareOptions = {
|
|
5
5
|
registry: TelemetryRegistry;
|
|
6
6
|
healthMonitor?: TelemetryHealthMonitor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './telemetry/plugin';
|
|
1
|
+
export * from './telemetry/plugin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { type TelemetryEnvelope, type TelemetryExporter, type TelemetrySignalType, toTelemetryEnvelope, } from './telemetry/envelope';
|
|
2
|
-
export { createOtlpTelemetryExporter, createVictoriaMetricsTelemetryExporter,
|
|
3
|
-
export { type TelemetryContractGateStatus, type TelemetryHealthEvaluation, type TelemetryHealthFailure, type TelemetryHealthFailureReason, TelemetryHealthMonitor, type TelemetryHealthMonitorOptions, type TelemetryHealthState, type TelemetryHealthStatusSnapshot, type TelemetryHealthTransition, } from './telemetry/healthMonitor';
|
|
4
|
-
export { createTelemetryAwareMetrics } from './telemetry/metrics';
|
|
5
|
-
export { TelemetryRegistry } from './telemetry/registry';
|
|
6
|
-
export { type TelemetryExporterHealthStatus, type TelemetryQueueStats, type TelemetryRegistryOptions, type TelemetrySloAlert, type TelemetrySloAlertType, TelemetryStartupHealthError, } from './telemetry/registryTypes';
|
|
1
|
+
export { type TelemetryEnvelope, type TelemetryExporter, type TelemetrySignalType, toTelemetryEnvelope, } from './telemetry/envelope.js';
|
|
2
|
+
export { createOtlpTelemetryExporter, createVictoriaMetricsTelemetryExporter, type OtlpExporterOptions, type VictoriaMetricsExporterOptions, warnOnMetricsOtlpEndpoint, } from './telemetry/exporters.js';
|
|
3
|
+
export { type TelemetryContractGateStatus, type TelemetryHealthEvaluation, type TelemetryHealthFailure, type TelemetryHealthFailureReason, TelemetryHealthMonitor, type TelemetryHealthMonitorOptions, type TelemetryHealthState, type TelemetryHealthStatusSnapshot, type TelemetryHealthTransition, } from './telemetry/healthMonitor.js';
|
|
4
|
+
export { createTelemetryAwareMetrics } from './telemetry/metrics.js';
|
|
5
|
+
export { TelemetryRegistry } from './telemetry/registry.js';
|
|
6
|
+
export { type TelemetryExporterHealthStatus, type TelemetryQueueStats, type TelemetryRegistryOptions, type TelemetrySloAlert, type TelemetrySloAlertType, TelemetryStartupHealthError, } from './telemetry/registryTypes.js';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export type BackendFederationRemoteEntryErrorCode = 'aborted' | 'byte_length_mismatch' | 'entry_too_large' | 'fetch_failed' | 'identity_mismatch' | 'integrity_mismatch' | 'invalid_verification' | 'redirect_mismatch' | 'timeout' | 'unsupported_entry';
|
|
2
|
+
export declare class BackendFederationRemoteEntryError extends Error {
|
|
3
|
+
readonly code: BackendFederationRemoteEntryErrorCode;
|
|
4
|
+
readonly details?: Record<string, unknown>;
|
|
5
|
+
constructor(code: BackendFederationRemoteEntryErrorCode, message: string, options?: {
|
|
6
|
+
cause?: unknown;
|
|
7
|
+
details?: Record<string, unknown>;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export type BackendFederationEntryIntegrity = {
|
|
11
|
+
byteLength: number;
|
|
12
|
+
sha256: string;
|
|
13
|
+
};
|
|
14
|
+
export type BackendFederationRemoteEntryVerification = BackendFederationEntryIntegrity & {
|
|
15
|
+
buildMarker?: string;
|
|
16
|
+
entryUrl: string;
|
|
17
|
+
remoteName: string;
|
|
18
|
+
unitId?: string;
|
|
19
|
+
};
|
|
20
|
+
export type BackendFederationRemoteEntryExpectation = Partial<BackendFederationRemoteEntryVerification>;
|
|
21
|
+
export type BackendFederationRemoteEntry = {
|
|
22
|
+
entry: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
};
|
|
26
|
+
export type BackendFederationEntryExports = {
|
|
27
|
+
get: (id: string) => (() => Promise<unknown> | unknown) | Promise<() => Promise<unknown> | unknown>;
|
|
28
|
+
init?: (...args: unknown[]) => void | Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
export type BackendFederationResourceResponse = {
|
|
31
|
+
body?: ReadableStream<Uint8Array> | null;
|
|
32
|
+
headers?: {
|
|
33
|
+
get(name: string): string | null;
|
|
34
|
+
};
|
|
35
|
+
ok: boolean;
|
|
36
|
+
status: number;
|
|
37
|
+
statusText?: string;
|
|
38
|
+
text?: () => Promise<string>;
|
|
39
|
+
url?: string;
|
|
40
|
+
};
|
|
41
|
+
export type BackendFederationResourceFetch = (url: string, init?: RequestInit) => Promise<BackendFederationResourceResponse>;
|
|
42
|
+
export type BackendFederationRemoteEntryFetch = BackendFederationResourceFetch;
|
|
43
|
+
export type BackendFederationResourcePolicy = {
|
|
44
|
+
allowInsecureHttp?: boolean;
|
|
45
|
+
fetch?: BackendFederationResourceFetch;
|
|
46
|
+
maxBytes?: number;
|
|
47
|
+
signal?: AbortSignal;
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
};
|
|
50
|
+
export type BackendFederationCommonJsEvaluator = (source: string, context: {
|
|
51
|
+
remote: BackendFederationRemoteEntry;
|
|
52
|
+
}) => unknown;
|
|
53
|
+
export type BackendFederationRemoteEntryPolicy = BackendFederationResourcePolicy & {
|
|
54
|
+
evaluateCommonJs?: BackendFederationCommonJsEvaluator;
|
|
55
|
+
expected?: BackendFederationRemoteEntryExpectation;
|
|
56
|
+
};
|
|
57
|
+
export type LoadVerifiedBackendFederationEntryOptions = BackendFederationRemoteEntryPolicy & {
|
|
58
|
+
remote: BackendFederationRemoteEntry;
|
|
59
|
+
verification?: BackendFederationRemoteEntryVerification;
|
|
60
|
+
};
|
|
61
|
+
export type LoadBoundedBackendFederationResourceOptions = BackendFederationResourcePolicy & {
|
|
62
|
+
kind?: 'entry' | 'manifest';
|
|
63
|
+
};
|
|
64
|
+
export declare function resolveBackendFederationRemoteEntryVerification(manifest: unknown): BackendFederationRemoteEntryVerification | undefined;
|
|
65
|
+
export declare function redactBackendFederationUrl(value: string): string;
|
|
66
|
+
export declare function loadBoundedBackendFederationResource(resourceUrl: string, options?: LoadBoundedBackendFederationResourceOptions): Promise<Uint8Array<ArrayBuffer>>;
|
|
67
|
+
export declare const evaluateBackendFederationCommonJsEntry: (remote: BackendFederationRemoteEntry, bytes: Uint8Array, evaluator?: BackendFederationCommonJsEvaluator) => BackendFederationEntryExports;
|
|
68
|
+
export declare function loadVerifiedBackendFederationEntry(options: LoadVerifiedBackendFederationEntryOptions): Promise<BackendFederationEntryExports>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type BackendFederationCommonJsEvaluator, type BackendFederationEntryIntegrity } from './index.mjs';
|
|
2
|
+
export declare function createBackendFederationEntryIntegrity(value: string | Uint8Array): BackendFederationEntryIntegrity;
|
|
3
|
+
export declare const evaluateNodeBackendFederationCommonJs: BackendFederationCommonJsEvaluator;
|