@bleedingdev/modern-js-server-runtime-extensions 3.9.0-ultramodern.4 → 3.9.0-ultramodern.5
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/bff-policy/crossProjectPolicy.js +309 -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/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/canaryCompatibility.js +73 -0
- package/dist/cjs/telemetry/healthSetup.js +4 -0
- package/dist/cjs/telemetry/lifecycle.js +15 -16
- package/dist/cjs/telemetry/plugin.js +10 -3
- package/dist/cjs/telemetry/runtimeEndpoints.js +10 -3
- package/dist/esm/bff-policy/crossProjectPolicy.mjs +259 -0
- package/dist/esm/bff-policy/index.mjs +1 -0
- 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/canaryCompatibility.mjs +35 -0
- package/dist/esm/telemetry/healthSetup.mjs +4 -0
- package/dist/esm/telemetry/lifecycle.mjs +15 -16
- package/dist/esm/telemetry/plugin.mjs +9 -2
- package/dist/esm/telemetry/runtimeEndpoints.mjs +10 -3
- package/dist/esm-node/bff-policy/crossProjectPolicy.mjs +260 -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/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/canaryCompatibility.mjs +36 -0
- package/dist/esm-node/telemetry/healthSetup.mjs +4 -0
- package/dist/esm-node/telemetry/lifecycle.mjs +15 -16
- package/dist/esm-node/telemetry/plugin.mjs +9 -2
- package/dist/esm-node/telemetry/runtimeEndpoints.mjs +10 -3
- package/dist/types/bff-policy/crossProjectPolicy.d.ts +110 -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/errorResponsePlugin.d.ts +3 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/localisedLoaderPlugin.d.ts +2 -0
- package/dist/types/mfCache.d.ts +2 -3
- package/dist/types/module-federation-css/plugin.d.ts +2 -3
- 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/canaryCompatibility.d.ts +19 -0
- package/dist/types/telemetry/healthSetup.d.ts +3 -1
- package/dist/types/telemetry/lifecycle.d.ts +2 -2
- package/dist/types/telemetry/plugin.d.ts +2 -1
- package/dist/types/telemetry/runtimeEndpoints.d.ts +3 -1
- 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 +110 -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/canaryCompatibility.d.mts +19 -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 +19 -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 +37 -0
- package/dist/types-esm/telemetry.d.mts +1 -0
- package/dist/types-esm/telemetryCore.d.mts +6 -0
- package/package.json +158 -26
- package/rslib.config.mts +36 -2
- package/rstest.config.mts +11 -0
- package/src/bff-policy/crossProjectPolicy.ts +781 -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/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/canaryCompatibility.ts +55 -0
- package/src/telemetry/healthSetup.ts +9 -1
- package/src/telemetry/lifecycle.ts +20 -32
- package/src/telemetry/plugin.ts +6 -2
- package/src/telemetry/runtimeEndpoints.ts +13 -2
- package/tests/bff-policy/crossProjectPolicy.matrix.test.ts +487 -0
- package/tests/bff-policy/crossProjectPolicy.test.ts +1004 -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 +134 -0
- package/tests/contractGateSnapshotObserver.test.ts +0 -58
- 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 +199 -0
- package/tests/nativeServerAssembly.test.ts +402 -0
- package/tests/registration.test.ts +1 -86
- package/tests/runtimeLifecycle.test.ts +69 -17
- package/tests/static-serving/ordering.test.ts +214 -0
- package/tests/static-serving/provider.test.ts +83 -0
- package/tests/static-serving/static.test.ts +400 -0
- package/tests/telemetry.test.ts +35 -101
- package/tests/telemetryAutopilot.test.ts +5 -146
- package/tests/telemetryCanaryCompatibility.test.ts +152 -0
- package/tests/telemetryHealthMonitor.test.ts +0 -2
- package/tests/telemetryLifecycle.test.ts +11 -253
- package/tests/telemetryRegistryQueueMatrix.test.ts +0 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.r = (exports1)=>{
|
|
29
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
+
value: 'Module'
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
+
value: true
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
var __webpack_exports__ = {};
|
|
38
|
+
__webpack_require__.r(__webpack_exports__);
|
|
39
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
MODULE_FEDERATION_MANIFEST_FILE: ()=>MODULE_FEDERATION_MANIFEST_FILE,
|
|
41
|
+
applyModuleFederationAssetHeaders: ()=>applyModuleFederationAssetHeaders,
|
|
42
|
+
getModuleFederationAssetList: ()=>getModuleFederationAssetList,
|
|
43
|
+
getModuleFederationRequestPath: ()=>getModuleFederationRequestPath,
|
|
44
|
+
isBackendModuleFederationManifestRequest: ()=>isBackendModuleFederationManifestRequest,
|
|
45
|
+
isModuleFederationManifestRequest: ()=>isModuleFederationManifestRequest,
|
|
46
|
+
patchModuleFederationManifestPublicPath: ()=>patchModuleFederationManifestPublicPath,
|
|
47
|
+
patchModuleFederationRemoteEntryPublicPath: ()=>patchModuleFederationRemoteEntryPublicPath
|
|
48
|
+
});
|
|
49
|
+
const fileReader_namespaceObject = require("@modern-js/runtime-utils/fileReader");
|
|
50
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
51
|
+
const external_path_namespaceObject = require("path");
|
|
52
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
53
|
+
const MODULE_FEDERATION_MANIFEST_FILE = 'mf-manifest.json';
|
|
54
|
+
const BACKEND_MODULE_FEDERATION_MANIFEST_FILE = 'backend-mf-manifest.json';
|
|
55
|
+
const MODULE_FEDERATION_MANIFEST_FILES = [
|
|
56
|
+
MODULE_FEDERATION_MANIFEST_FILE,
|
|
57
|
+
BACKEND_MODULE_FEDERATION_MANIFEST_FILE
|
|
58
|
+
];
|
|
59
|
+
const MODULE_FEDERATION_OPTIONAL_FILES = [
|
|
60
|
+
'mf-stats.json'
|
|
61
|
+
];
|
|
62
|
+
const trimLeadingSlash = (value)=>value.replace(/^\/+/, '');
|
|
63
|
+
const getModuleFederationRequestPath = (pathname, pathPrefix)=>{
|
|
64
|
+
const normalizedPrefix = `/${trimLeadingSlash(pathPrefix)}`.replace(/\/+$/u, '');
|
|
65
|
+
const requestPath = normalizedPrefix && (pathname === normalizedPrefix || pathname.startsWith(`${normalizedPrefix}/`)) ? pathname.slice(normalizedPrefix.length) : pathname;
|
|
66
|
+
return trimLeadingSlash(requestPath);
|
|
67
|
+
};
|
|
68
|
+
const isModuleFederationManifestRequest = (requestPath)=>MODULE_FEDERATION_MANIFEST_FILES.includes(requestPath);
|
|
69
|
+
const isBackendModuleFederationManifestRequest = (requestPath)=>requestPath === BACKEND_MODULE_FEDERATION_MANIFEST_FILE;
|
|
70
|
+
const applyModuleFederationAssetHeaders = (c)=>{
|
|
71
|
+
c.header('Access-Control-Allow-Origin', '*');
|
|
72
|
+
c.header('Access-Control-Allow-Headers', '*');
|
|
73
|
+
c.header('Access-Control-Allow-Methods', 'GET,HEAD,OPTIONS');
|
|
74
|
+
};
|
|
75
|
+
const joinModuleFederationAssetPath = (assetPath, assetName)=>{
|
|
76
|
+
if (!assetName) return '';
|
|
77
|
+
return trimLeadingSlash(external_path_default().posix.join(assetPath || '', assetName));
|
|
78
|
+
};
|
|
79
|
+
const appendModuleFederationAsset = (set, assetPath)=>{
|
|
80
|
+
if (assetPath) set.add(trimLeadingSlash(assetPath));
|
|
81
|
+
};
|
|
82
|
+
const appendModuleFederationAssets = (set, assets)=>{
|
|
83
|
+
assets?.js?.sync?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
84
|
+
assets?.js?.async?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
85
|
+
assets?.css?.sync?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
86
|
+
assets?.css?.async?.forEach((asset)=>appendModuleFederationAsset(set, asset));
|
|
87
|
+
};
|
|
88
|
+
const hasAbsoluteProtocol = (value)=>/^https?:\/\//i.test(value) || value.startsWith('//');
|
|
89
|
+
const ensureLeadingSlash = (value)=>{
|
|
90
|
+
if ('' === value) return '/';
|
|
91
|
+
return value.startsWith('/') ? value : `/${value}`;
|
|
92
|
+
};
|
|
93
|
+
const ensureTrailingSlash = (value)=>value.endsWith('/') ? value : `${value}/`;
|
|
94
|
+
const patchModuleFederationManifestPublicPath = (c, manifestBuffer, pathPrefix)=>{
|
|
95
|
+
try {
|
|
96
|
+
const manifest = JSON.parse(manifestBuffer.toString('utf-8'));
|
|
97
|
+
const publicPath = manifest.metaData?.publicPath;
|
|
98
|
+
if (!publicPath || hasAbsoluteProtocol(publicPath)) return manifestBuffer;
|
|
99
|
+
const requestURL = new URL(c.req.url);
|
|
100
|
+
const prefixPath = ensureTrailingSlash(ensureLeadingSlash(pathPrefix || '/'));
|
|
101
|
+
manifest.metaData = {
|
|
102
|
+
...manifest.metaData,
|
|
103
|
+
publicPath: `${requestURL.origin}${prefixPath}`
|
|
104
|
+
};
|
|
105
|
+
return Buffer.from(JSON.stringify(manifest), 'utf-8');
|
|
106
|
+
} catch {
|
|
107
|
+
return manifestBuffer;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const patchModuleFederationRemoteEntryPublicPath = (c, remoteEntryBuffer, pathPrefix)=>{
|
|
111
|
+
const requestURL = new URL(c.req.url);
|
|
112
|
+
const prefixPath = ensureTrailingSlash(ensureLeadingSlash(pathPrefix || '/'));
|
|
113
|
+
const publicPath = `${requestURL.origin}${prefixPath}`;
|
|
114
|
+
const source = remoteEntryBuffer.toString('utf-8');
|
|
115
|
+
const patched = source.replace(/__webpack_require__\.p\s*=\s*(['"`])[^'"`]*\1;/, `__webpack_require__.p = ${JSON.stringify(publicPath)};`).replace(/__rspack_require__\.p\s*=\s*(['"`])[^'"`]*\1;/, `__rspack_require__.p = ${JSON.stringify(publicPath)};`);
|
|
116
|
+
if (patched === source) return remoteEntryBuffer;
|
|
117
|
+
return Buffer.from(patched, 'utf-8');
|
|
118
|
+
};
|
|
119
|
+
const getModuleFederationAssetList = async (pwd)=>{
|
|
120
|
+
const assets = new Set();
|
|
121
|
+
const remoteEntries = new Set();
|
|
122
|
+
let manifestFound = false;
|
|
123
|
+
for (const manifestFile of MODULE_FEDERATION_MANIFEST_FILES){
|
|
124
|
+
const manifestPath = external_path_default().join(pwd, manifestFile);
|
|
125
|
+
if (!await utils_namespaceObject.fs.pathExists(manifestPath)) continue;
|
|
126
|
+
manifestFound = true;
|
|
127
|
+
assets.add(manifestFile);
|
|
128
|
+
const manifestBuffer = await fileReader_namespaceObject.fileReader.readFileFromSystem(manifestPath, 'buffer');
|
|
129
|
+
if (null !== manifestBuffer) try {
|
|
130
|
+
const manifest = JSON.parse(manifestBuffer.toString('utf-8'));
|
|
131
|
+
const remoteEntry = joinModuleFederationAssetPath(manifest.metaData?.remoteEntry?.path, manifest.metaData?.remoteEntry?.name);
|
|
132
|
+
const dtsZip = joinModuleFederationAssetPath(manifest.metaData?.types?.path, manifest.metaData?.types?.zip);
|
|
133
|
+
const dtsApi = joinModuleFederationAssetPath(manifest.metaData?.types?.path, manifest.metaData?.types?.api);
|
|
134
|
+
if (remoteEntry) {
|
|
135
|
+
assets.add(remoteEntry);
|
|
136
|
+
remoteEntries.add(remoteEntry);
|
|
137
|
+
}
|
|
138
|
+
appendModuleFederationAsset(assets, dtsZip);
|
|
139
|
+
appendModuleFederationAsset(assets, dtsApi);
|
|
140
|
+
manifest.shared?.forEach((item)=>appendModuleFederationAssets(assets, item.assets));
|
|
141
|
+
manifest.remotes?.forEach((item)=>appendModuleFederationAssets(assets, item.assets));
|
|
142
|
+
manifest.exposes?.forEach((item)=>appendModuleFederationAssets(assets, item.assets));
|
|
143
|
+
} catch {}
|
|
144
|
+
}
|
|
145
|
+
if (manifestFound) {
|
|
146
|
+
for (const filename of MODULE_FEDERATION_OPTIONAL_FILES)if (await utils_namespaceObject.fs.pathExists(external_path_default().join(pwd, filename))) assets.add(filename);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
assets,
|
|
150
|
+
remoteEntries
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
exports.MODULE_FEDERATION_MANIFEST_FILE = __webpack_exports__.MODULE_FEDERATION_MANIFEST_FILE;
|
|
154
|
+
exports.applyModuleFederationAssetHeaders = __webpack_exports__.applyModuleFederationAssetHeaders;
|
|
155
|
+
exports.getModuleFederationAssetList = __webpack_exports__.getModuleFederationAssetList;
|
|
156
|
+
exports.getModuleFederationRequestPath = __webpack_exports__.getModuleFederationRequestPath;
|
|
157
|
+
exports.isBackendModuleFederationManifestRequest = __webpack_exports__.isBackendModuleFederationManifestRequest;
|
|
158
|
+
exports.isModuleFederationManifestRequest = __webpack_exports__.isModuleFederationManifestRequest;
|
|
159
|
+
exports.patchModuleFederationManifestPublicPath = __webpack_exports__.patchModuleFederationManifestPublicPath;
|
|
160
|
+
exports.patchModuleFederationRemoteEntryPublicPath = __webpack_exports__.patchModuleFederationRemoteEntryPublicPath;
|
|
161
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
162
|
+
"MODULE_FEDERATION_MANIFEST_FILE",
|
|
163
|
+
"applyModuleFederationAssetHeaders",
|
|
164
|
+
"getModuleFederationAssetList",
|
|
165
|
+
"getModuleFederationRequestPath",
|
|
166
|
+
"isBackendModuleFederationManifestRequest",
|
|
167
|
+
"isModuleFederationManifestRequest",
|
|
168
|
+
"patchModuleFederationManifestPublicPath",
|
|
169
|
+
"patchModuleFederationRemoteEntryPublicPath"
|
|
170
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
171
|
+
Object.defineProperty(exports, '__esModule', {
|
|
172
|
+
value: true
|
|
173
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
applyPreCompressedAssetHeaders: ()=>applyPreCompressedAssetHeaders,
|
|
32
|
+
resolvePreCompressedAsset: ()=>resolvePreCompressedAsset
|
|
33
|
+
});
|
|
34
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
35
|
+
const PRE_COMPRESSED_ASSET_EXTENSIONS = {
|
|
36
|
+
br: '.br',
|
|
37
|
+
gzip: '.gz'
|
|
38
|
+
};
|
|
39
|
+
const PRE_COMPRESSED_SUPPORTED_ENCODINGS = [
|
|
40
|
+
'br',
|
|
41
|
+
'gzip'
|
|
42
|
+
];
|
|
43
|
+
const QUALITY_VALUE_PATTERN = /^(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/u;
|
|
44
|
+
const parseAcceptEncoding = (value)=>value.split(',').map((item)=>item.trim()).filter(Boolean).map((item)=>{
|
|
45
|
+
const [rawName, ...params] = item.split(';');
|
|
46
|
+
const name = rawName.trim().toLowerCase();
|
|
47
|
+
let q = 1;
|
|
48
|
+
let qualitySeen = false;
|
|
49
|
+
for (const param of params){
|
|
50
|
+
const [key, rawValue] = param.split('=').map((v)=>v.trim());
|
|
51
|
+
if ('q' === key.toLowerCase()) {
|
|
52
|
+
if (qualitySeen || null == rawValue || !QUALITY_VALUE_PATTERN.test(rawValue)) {
|
|
53
|
+
q = 0;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
qualitySeen = true;
|
|
57
|
+
q = Number(rawValue);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
name,
|
|
62
|
+
q
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
const getAcceptedRepresentations = (value)=>{
|
|
66
|
+
if (!value) return [
|
|
67
|
+
'identity'
|
|
68
|
+
];
|
|
69
|
+
const parsed = parseAcceptEncoding(value);
|
|
70
|
+
const qualityByEncoding = new Map();
|
|
71
|
+
let wildcardQuality;
|
|
72
|
+
for (const { name, q } of parsed){
|
|
73
|
+
if ('*' === name) {
|
|
74
|
+
wildcardQuality = q;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
qualityByEncoding.set(name, q);
|
|
78
|
+
}
|
|
79
|
+
const getQuality = (encoding)=>{
|
|
80
|
+
const explicit = qualityByEncoding.get(encoding);
|
|
81
|
+
if (void 0 !== explicit) return explicit;
|
|
82
|
+
return wildcardQuality ?? 0;
|
|
83
|
+
};
|
|
84
|
+
const identityQuality = qualityByEncoding.get('identity') ?? wildcardQuality ?? 1;
|
|
85
|
+
return [
|
|
86
|
+
...PRE_COMPRESSED_SUPPORTED_ENCODINGS.map((encoding)=>({
|
|
87
|
+
encoding,
|
|
88
|
+
quality: getQuality(encoding)
|
|
89
|
+
})),
|
|
90
|
+
{
|
|
91
|
+
encoding: 'identity',
|
|
92
|
+
quality: identityQuality
|
|
93
|
+
}
|
|
94
|
+
].filter((item)=>item.quality > 0).sort((a, b)=>b.quality - a.quality).map((item)=>item.encoding);
|
|
95
|
+
};
|
|
96
|
+
const appendVaryHeader = (c, value)=>{
|
|
97
|
+
const current = c.res.headers.get('Vary');
|
|
98
|
+
if (!current) return void c.header('Vary', value);
|
|
99
|
+
const values = current.split(',').map((item)=>item.trim().toLowerCase()).filter(Boolean);
|
|
100
|
+
if (!values.includes(value.toLowerCase())) c.header('Vary', `${current}, ${value}`);
|
|
101
|
+
};
|
|
102
|
+
const resolvePreCompressedAsset = async (c, filepath)=>{
|
|
103
|
+
const brPath = `${filepath}${PRE_COMPRESSED_ASSET_EXTENSIONS.br}`;
|
|
104
|
+
const gzipPath = `${filepath}${PRE_COMPRESSED_ASSET_EXTENSIONS.gzip}`;
|
|
105
|
+
const [hasBr, hasGzip] = await Promise.all([
|
|
106
|
+
utils_namespaceObject.fs.pathExists(brPath),
|
|
107
|
+
utils_namespaceObject.fs.pathExists(gzipPath)
|
|
108
|
+
]);
|
|
109
|
+
const hasVariant = hasBr || hasGzip;
|
|
110
|
+
const acceptedRepresentations = getAcceptedRepresentations(c.req.header('accept-encoding'));
|
|
111
|
+
for (const encoding of acceptedRepresentations){
|
|
112
|
+
if ('identity' === encoding) return {
|
|
113
|
+
selected: null,
|
|
114
|
+
hasVariant,
|
|
115
|
+
acceptable: true
|
|
116
|
+
};
|
|
117
|
+
if ('br' === encoding && hasBr) return {
|
|
118
|
+
selected: {
|
|
119
|
+
filepath: brPath,
|
|
120
|
+
encoding
|
|
121
|
+
},
|
|
122
|
+
hasVariant: true,
|
|
123
|
+
acceptable: true
|
|
124
|
+
};
|
|
125
|
+
if ('gzip' === encoding && hasGzip) return {
|
|
126
|
+
selected: {
|
|
127
|
+
filepath: gzipPath,
|
|
128
|
+
encoding
|
|
129
|
+
},
|
|
130
|
+
hasVariant: true,
|
|
131
|
+
acceptable: true
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
selected: null,
|
|
136
|
+
hasVariant,
|
|
137
|
+
acceptable: false
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
const applyPreCompressedAssetHeaders = (c, preCompressedAsset)=>{
|
|
141
|
+
if (preCompressedAsset.hasVariant || !preCompressedAsset.acceptable) appendVaryHeader(c, 'Accept-Encoding');
|
|
142
|
+
if (preCompressedAsset.selected) c.header('Content-Encoding', preCompressedAsset.selected.encoding);
|
|
143
|
+
};
|
|
144
|
+
exports.applyPreCompressedAssetHeaders = __webpack_exports__.applyPreCompressedAssetHeaders;
|
|
145
|
+
exports.resolvePreCompressedAsset = __webpack_exports__.resolvePreCompressedAsset;
|
|
146
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
147
|
+
"applyPreCompressedAssetHeaders",
|
|
148
|
+
"resolvePreCompressedAsset"
|
|
149
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
150
|
+
Object.defineProperty(exports, '__esModule', {
|
|
151
|
+
value: true
|
|
152
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const createTelemetryCanaryCompatibility = (registry)=>{
|
|
31
|
+
let state = 'canary';
|
|
32
|
+
return {
|
|
33
|
+
observe (evaluation) {
|
|
34
|
+
let action;
|
|
35
|
+
if ('became_healthy' === evaluation.transition && 'canary' === state) {
|
|
36
|
+
state = 'promoted';
|
|
37
|
+
action = 'promote';
|
|
38
|
+
} else {
|
|
39
|
+
if ('became_unhealthy' !== evaluation.transition || 'rolled_back' === state) return;
|
|
40
|
+
state = 'rolled_back';
|
|
41
|
+
action = 'rollback';
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
registry.enqueueMetric({
|
|
45
|
+
name: `telemetry.canary.${action}`,
|
|
46
|
+
value: 1,
|
|
47
|
+
unit: 'count',
|
|
48
|
+
tags: {
|
|
49
|
+
action,
|
|
50
|
+
state,
|
|
51
|
+
failures: String(evaluation.failures.length)
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
} catch (_error) {}
|
|
55
|
+
},
|
|
56
|
+
getStatusSnapshot (snapshot) {
|
|
57
|
+
return {
|
|
58
|
+
...snapshot,
|
|
59
|
+
state
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
65
|
+
createTelemetryCanaryCompatibility: createTelemetryCanaryCompatibility
|
|
66
|
+
});
|
|
67
|
+
exports.createTelemetryCanaryCompatibility = __webpack_exports__.createTelemetryCanaryCompatibility;
|
|
68
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
69
|
+
"createTelemetryCanaryCompatibility"
|
|
70
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
71
|
+
Object.defineProperty(exports, '__esModule', {
|
|
72
|
+
value: true
|
|
73
|
+
});
|
|
@@ -33,6 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
const index_js_namespaceObject = require("../contract-gate-snapshot-store/index.js");
|
|
34
34
|
const external_runtimeFallbackSignal_js_namespaceObject = require("../runtimeFallbackSignal.js");
|
|
35
35
|
const external_telemetryCore_js_namespaceObject = require("../telemetryCore.js");
|
|
36
|
+
const external_canaryCompatibility_js_namespaceObject = require("./canaryCompatibility.js");
|
|
36
37
|
function emitHealthTransitionMetric(registry, evaluation) {
|
|
37
38
|
try {
|
|
38
39
|
registry.enqueueMetric({
|
|
@@ -50,6 +51,7 @@ function emitHealthTransitionMetric(registry, evaluation) {
|
|
|
50
51
|
const setupTelemetryHealthMonitoring = ({ registry, appDirectory, legacyHealthConfig })=>{
|
|
51
52
|
if (!legacyHealthConfig?.enabled) return {};
|
|
52
53
|
const contractGates = legacyHealthConfig.contractGates;
|
|
54
|
+
const canaryCompatibility = (0, external_canaryCompatibility_js_namespaceObject.createTelemetryCanaryCompatibility)(registry);
|
|
53
55
|
const healthMonitor = new external_telemetryCore_js_namespaceObject.TelemetryHealthMonitor({
|
|
54
56
|
registry,
|
|
55
57
|
evaluationIntervalMs: legacyHealthConfig.evaluationIntervalMs,
|
|
@@ -61,6 +63,7 @@ const setupTelemetryHealthMonitoring = ({ registry, appDirectory, legacyHealthCo
|
|
|
61
63
|
requiredContractGates: Object.keys(contractGates || {}),
|
|
62
64
|
onTransition: (evaluation)=>{
|
|
63
65
|
emitHealthTransitionMetric(registry, evaluation);
|
|
66
|
+
canaryCompatibility.observe(evaluation);
|
|
64
67
|
}
|
|
65
68
|
});
|
|
66
69
|
if (contractGates) healthMonitor.setContractGates(contractGates);
|
|
@@ -89,6 +92,7 @@ const setupTelemetryHealthMonitoring = ({ registry, appDirectory, legacyHealthCo
|
|
|
89
92
|
const runtimeStatusAuthConfig = runtimeFallbackSignalConfig?.auth ?? (0, external_runtimeFallbackSignal_js_namespaceObject.normalizeRuntimeFallbackSignalAuthConfig)(legacyHealthConfig.autopilot?.runtimeFallbackSignal?.auth);
|
|
90
93
|
return {
|
|
91
94
|
healthMonitor,
|
|
95
|
+
canaryCompatibility,
|
|
92
96
|
gateSnapshotStorePromise,
|
|
93
97
|
runtimeFallbackSignalConfig,
|
|
94
98
|
runtimeStatusAuthConfig
|
|
@@ -30,6 +30,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
registerTelemetryLifecycle: ()=>registerTelemetryLifecycle
|
|
32
32
|
});
|
|
33
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
33
34
|
const index_js_namespaceObject = require("../contract-gate-snapshot-store/index.js");
|
|
34
35
|
const external_contractGateSnapshotObserver_js_namespaceObject = require("../contractGateSnapshotObserver.js");
|
|
35
36
|
const external_telemetryCore_js_namespaceObject = require("../telemetryCore.js");
|
|
@@ -41,30 +42,28 @@ const ensureTelemetryBeforeExitHook = ()=>{
|
|
|
41
42
|
process.on('beforeExit', ()=>{
|
|
42
43
|
for (const close of [
|
|
43
44
|
...activeTelemetryLaneClosers
|
|
44
|
-
])close();
|
|
45
|
+
])close().catch((error)=>utils_namespaceObject.logger.error(error));
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
48
|
const registerTelemetryLifecycle = ({ api, registry, telemetryConfig, legacyHealthConfig, healthMonitor, gateSnapshotStorePromise, appDirectory })=>{
|
|
48
49
|
let contractGateSnapshotObserver;
|
|
49
|
-
let
|
|
50
|
-
const closeTelemetryLane =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
let closePromise;
|
|
51
|
+
const closeTelemetryLane = ()=>{
|
|
52
|
+
closePromise ??= Promise.resolve().then(async ()=>{
|
|
53
|
+
activeTelemetryLaneClosers.delete(closeTelemetryLane);
|
|
54
|
+
contractGateSnapshotObserver?.stop();
|
|
55
|
+
healthMonitor?.stop();
|
|
56
|
+
await registry.shutdown();
|
|
57
|
+
});
|
|
58
|
+
return closePromise;
|
|
57
59
|
};
|
|
60
|
+
api.onDispose(closeTelemetryLane);
|
|
61
|
+
activeTelemetryLaneClosers.add(closeTelemetryLane);
|
|
62
|
+
ensureTelemetryBeforeExitHook();
|
|
58
63
|
let prepared = false;
|
|
59
64
|
api.onPrepare(async ()=>{
|
|
60
|
-
if (prepared) return;
|
|
65
|
+
if (prepared || closePromise) return;
|
|
61
66
|
prepared = true;
|
|
62
|
-
const { nodeServer } = api.getServerContext();
|
|
63
|
-
if (nodeServer && 'function' == typeof nodeServer.once) nodeServer.once('close', ()=>{
|
|
64
|
-
closeTelemetryLane();
|
|
65
|
-
});
|
|
66
|
-
activeTelemetryLaneClosers.add(closeTelemetryLane);
|
|
67
|
-
ensureTelemetryBeforeExitHook();
|
|
68
67
|
if (telemetryConfig.exporters?.otlp?.enabled) {
|
|
69
68
|
(0, external_telemetryCore_js_namespaceObject.maybeWarnLegacyOtlpEndpoint)(telemetryConfig.exporters.otlp.endpoint);
|
|
70
69
|
await registry.register((0, external_telemetryCore_js_namespaceObject.createOtlpTelemetryExporter)(telemetryConfig.exporters.otlp));
|
|
@@ -50,7 +50,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
50
50
|
resolveRuntimeFallbackSignalEndpoint: ()=>external_runtimeFallbackSignal_js_namespaceObject.resolveRuntimeFallbackSignalEndpoint,
|
|
51
51
|
resolveTelemetrySloOptions: ()=>resolveTelemetrySloOptions
|
|
52
52
|
});
|
|
53
|
-
const
|
|
53
|
+
const request_context_namespaceObject = require("@modern-js/runtime-extensions/request-context");
|
|
54
54
|
const utils_namespaceObject = require("@modern-js/utils");
|
|
55
55
|
const external_env_js_namespaceObject = require("../env.js");
|
|
56
56
|
const external_telemetryCore_js_namespaceObject = require("../telemetryCore.js");
|
|
@@ -69,6 +69,12 @@ const resolveTelemetrySloOptions = (sloConfig, warnSink = (message)=>utils_names
|
|
|
69
69
|
});
|
|
70
70
|
const injectTelemetryPlugin = ()=>({
|
|
71
71
|
name: '@modern-js/inject-telemetry',
|
|
72
|
+
pre: [
|
|
73
|
+
'@modern-js/plugin-inject-route'
|
|
74
|
+
],
|
|
75
|
+
post: [
|
|
76
|
+
'@modern-js/plugin-inject-config-middleware'
|
|
77
|
+
],
|
|
72
78
|
setup (api) {
|
|
73
79
|
const serverConfig = api.getServerConfig();
|
|
74
80
|
const telemetryConfig = serverConfig?.server?.telemetry;
|
|
@@ -89,7 +95,7 @@ const injectTelemetryPlugin = ()=>({
|
|
|
89
95
|
redactionKeys: telemetryConfig.redactionKeys,
|
|
90
96
|
slo: resolveTelemetrySloOptions(telemetryConfig.slo)
|
|
91
97
|
});
|
|
92
|
-
const { healthMonitor, gateSnapshotStorePromise, runtimeFallbackSignalConfig, runtimeStatusAuthConfig } = (0, external_healthSetup_js_namespaceObject.setupTelemetryHealthMonitoring)({
|
|
98
|
+
const { healthMonitor, canaryCompatibility, gateSnapshotStorePromise, runtimeFallbackSignalConfig, runtimeStatusAuthConfig } = (0, external_healthSetup_js_namespaceObject.setupTelemetryHealthMonitoring)({
|
|
93
99
|
registry,
|
|
94
100
|
appDirectory,
|
|
95
101
|
legacyHealthConfig: telemetryConfig.canary
|
|
@@ -98,6 +104,7 @@ const injectTelemetryPlugin = ()=>({
|
|
|
98
104
|
middlewares.push((0, external_runtimeEndpoints_js_namespaceObject.createRuntimeStatusMiddleware)({
|
|
99
105
|
registry,
|
|
100
106
|
healthMonitor,
|
|
107
|
+
canaryCompatibility,
|
|
101
108
|
runtimeFallbackSignalConfig,
|
|
102
109
|
runtimeStatusAuthConfig
|
|
103
110
|
}));
|
|
@@ -106,7 +113,7 @@ const injectTelemetryPlugin = ()=>({
|
|
|
106
113
|
handler: async (c, next)=>{
|
|
107
114
|
const monitors = c.get('monitors');
|
|
108
115
|
if (monitors) {
|
|
109
|
-
const traceContext = (0,
|
|
116
|
+
const traceContext = (0, request_context_namespaceObject.parseTraceparent)(c.req.header('traceparent'));
|
|
110
117
|
const monitor = (event)=>{
|
|
111
118
|
registry.enqueue((0, external_telemetryCore_js_namespaceObject.toTelemetryEnvelope)(event, {
|
|
112
119
|
service: serviceName,
|
|
@@ -67,7 +67,7 @@ const createRuntimeFallbackSignalMiddleware = (signalConfig)=>({
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
const createRuntimeStatusMiddleware = ({ registry, healthMonitor, runtimeFallbackSignalConfig, runtimeStatusAuthConfig })=>({
|
|
70
|
+
const createRuntimeStatusMiddleware = ({ registry, healthMonitor, canaryCompatibility, runtimeFallbackSignalConfig, runtimeStatusAuthConfig })=>({
|
|
71
71
|
name: 'telemetry-runtime-status',
|
|
72
72
|
path: external_runtimeFallbackSignal_js_namespaceObject.DEFAULT_RUNTIME_STATUS_ENDPOINT,
|
|
73
73
|
method: 'get',
|
|
@@ -79,6 +79,7 @@ const createRuntimeStatusMiddleware = ({ registry, healthMonitor, runtimeFallbac
|
|
|
79
79
|
timestamp: Date.now()
|
|
80
80
|
});
|
|
81
81
|
(0, external_runtimeFallbackSignal_js_namespaceObject.enforceRuntimeFallbackSignalAuthToken)(c.req.header(runtimeStatusAuthConfig.headerName), runtimeStatusAuthConfig);
|
|
82
|
+
const healthSnapshot = healthMonitor?.getStatusSnapshot();
|
|
82
83
|
return c.json({
|
|
83
84
|
ok: true,
|
|
84
85
|
timestamp: Date.now(),
|
|
@@ -86,9 +87,15 @@ const createRuntimeStatusMiddleware = ({ registry, healthMonitor, runtimeFallbac
|
|
|
86
87
|
queueStats: registry.getQueueStats(),
|
|
87
88
|
exporterHealth: registry.getExporterHealth()
|
|
88
89
|
},
|
|
89
|
-
health:
|
|
90
|
+
health: healthSnapshot ? {
|
|
90
91
|
enabled: true,
|
|
91
|
-
...
|
|
92
|
+
...healthSnapshot
|
|
93
|
+
} : {
|
|
94
|
+
enabled: false
|
|
95
|
+
},
|
|
96
|
+
canary: healthSnapshot && canaryCompatibility ? {
|
|
97
|
+
enabled: true,
|
|
98
|
+
...canaryCompatibility.getStatusSnapshot(healthSnapshot)
|
|
92
99
|
} : {
|
|
93
100
|
enabled: false
|
|
94
101
|
},
|