@bleedingdev/modern-js-server-runtime-extensions 3.5.0-ultramodern.35 → 3.5.0-ultramodern.37
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/contract-gate-snapshot-normalization.js +122 -0
- package/dist/cjs/contract-gate-snapshot-store/file-store.js +13 -13
- package/dist/cjs/contract-gate-snapshot-store/http-store.js +2 -11
- package/dist/cjs/contract-gate-snapshot-store/resolve.js +8 -6
- package/dist/cjs/contractGateAutopilot.js +8 -77
- package/dist/cjs/index.js +6 -25
- package/dist/cjs/module-federation-css/manifest.js +3 -18
- package/dist/cjs/runtime-fallback-signal/index.js +21 -27
- package/dist/cjs/runtime-fallback-signal/model.js +157 -0
- package/dist/cjs/runtime-fallback-signal/resolver.js +163 -0
- package/dist/cjs/runtime-fallback-signal/{contract-gate.js → store.js} +19 -0
- package/dist/cjs/telemetry/envelope.js +74 -0
- package/dist/cjs/telemetry/registry.js +20 -72
- package/dist/esm/contract-gate-snapshot-normalization.mjs +81 -0
- package/dist/esm/contract-gate-snapshot-store/file-store.mjs +7 -7
- package/dist/esm/contract-gate-snapshot-store/http-store.mjs +1 -1
- package/dist/esm/contract-gate-snapshot-store/resolve.mjs +7 -5
- package/dist/esm/contractGateAutopilot.mjs +7 -76
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/module-federation-css/manifest.mjs +3 -3
- package/dist/esm/runtime-fallback-signal/index.mjs +3 -9
- package/dist/esm/runtime-fallback-signal/model.mjs +73 -0
- package/dist/esm/runtime-fallback-signal/resolver.mjs +107 -0
- package/dist/esm/runtime-fallback-signal/{contract-gate.mjs → store.mjs} +14 -1
- package/dist/esm/telemetry/envelope.mjs +63 -1
- package/dist/esm/telemetry/registry.mjs +21 -73
- package/dist/esm-node/contract-gate-snapshot-normalization.mjs +82 -0
- package/dist/esm-node/contract-gate-snapshot-store/file-store.mjs +7 -7
- package/dist/esm-node/contract-gate-snapshot-store/http-store.mjs +1 -1
- package/dist/esm-node/contract-gate-snapshot-store/resolve.mjs +8 -7
- package/dist/esm-node/contractGateAutopilot.mjs +7 -76
- package/dist/esm-node/index.mjs +0 -1
- package/dist/esm-node/module-federation-css/manifest.mjs +3 -3
- package/dist/esm-node/runtime-fallback-signal/index.mjs +3 -9
- package/dist/esm-node/runtime-fallback-signal/model.mjs +74 -0
- package/dist/esm-node/runtime-fallback-signal/resolver.mjs +108 -0
- package/dist/esm-node/runtime-fallback-signal/{contract-gate.mjs → store.mjs} +14 -1
- package/dist/esm-node/telemetry/envelope.mjs +63 -1
- package/dist/esm-node/telemetry/registry.mjs +21 -73
- package/dist/types/contract-gate-snapshot-normalization.d.ts +15 -0
- package/dist/types/contract-gate-snapshot-store/http-store.d.ts +0 -6
- package/dist/types/contractGateAutopilot.d.ts +1 -6
- package/dist/types/index.d.ts +0 -1
- package/dist/types/module-federation-css/manifest.d.ts +0 -5
- package/dist/types/runtime-fallback-signal/index.d.ts +4 -10
- package/dist/types/runtime-fallback-signal/model.d.ts +70 -0
- package/dist/types/runtime-fallback-signal/resolver.d.ts +29 -0
- package/dist/types/runtime-fallback-signal/store.d.ts +4 -0
- package/dist/types/telemetry/canaryEvaluation.d.ts +3 -2
- package/dist/types/telemetry/envelope.d.ts +10 -0
- package/dist/types/telemetry/registry.d.ts +1 -4
- package/package.json +9 -9
- package/src/contract-gate-snapshot-normalization.ts +155 -0
- package/src/contract-gate-snapshot-store/file-store.ts +2 -4
- package/src/contract-gate-snapshot-store/http-store.ts +3 -3
- package/src/contract-gate-snapshot-store/resolve.ts +8 -4
- package/src/contractGateAutopilot.ts +13 -141
- package/src/index.ts +0 -16
- package/src/module-federation-css/manifest.ts +6 -9
- package/src/runtime-fallback-signal/index.ts +23 -25
- package/src/runtime-fallback-signal/model.ts +230 -0
- package/src/runtime-fallback-signal/resolver.ts +304 -0
- package/src/runtime-fallback-signal/{contract-gate.ts → store.ts} +38 -3
- package/src/telemetry/canaryEvaluation.ts +2 -2
- package/src/telemetry/envelope.ts +84 -0
- package/src/telemetry/registry.ts +31 -74
- package/tests/telemetryAutopilot.test.ts +141 -0
- package/tests/telemetryRegistryQueueMatrix.test.ts +227 -0
- package/dist/cjs/runtime-fallback-signal/auth.js +0 -87
- package/dist/cjs/runtime-fallback-signal/constants.js +0 -72
- package/dist/cjs/runtime-fallback-signal/endpoint.js +0 -50
- package/dist/cjs/runtime-fallback-signal/errors.js +0 -44
- package/dist/cjs/runtime-fallback-signal/payload.js +0 -72
- package/dist/cjs/runtime-fallback-signal/source.js +0 -66
- package/dist/cjs/runtime-fallback-signal/state.js +0 -57
- package/dist/cjs/runtime-fallback-signal/status.js +0 -47
- package/dist/cjs/runtime-fallback-signal/trust-policy.js +0 -108
- package/dist/cjs/runtime-fallback-signal/types.js +0 -18
- package/dist/esm/runtime-fallback-signal/auth.mjs +0 -40
- package/dist/esm/runtime-fallback-signal/constants.mjs +0 -10
- package/dist/esm/runtime-fallback-signal/endpoint.mjs +0 -12
- package/dist/esm/runtime-fallback-signal/errors.mjs +0 -6
- package/dist/esm/runtime-fallback-signal/payload.mjs +0 -31
- package/dist/esm/runtime-fallback-signal/source.mjs +0 -22
- package/dist/esm/runtime-fallback-signal/state.mjs +0 -16
- package/dist/esm/runtime-fallback-signal/status.mjs +0 -9
- package/dist/esm/runtime-fallback-signal/trust-policy.mjs +0 -67
- package/dist/esm/runtime-fallback-signal/types.mjs +0 -0
- package/dist/esm-node/runtime-fallback-signal/auth.mjs +0 -41
- package/dist/esm-node/runtime-fallback-signal/constants.mjs +0 -11
- package/dist/esm-node/runtime-fallback-signal/endpoint.mjs +0 -13
- package/dist/esm-node/runtime-fallback-signal/errors.mjs +0 -7
- package/dist/esm-node/runtime-fallback-signal/payload.mjs +0 -32
- package/dist/esm-node/runtime-fallback-signal/source.mjs +0 -23
- package/dist/esm-node/runtime-fallback-signal/state.mjs +0 -17
- package/dist/esm-node/runtime-fallback-signal/status.mjs +0 -10
- package/dist/esm-node/runtime-fallback-signal/trust-policy.mjs +0 -68
- package/dist/esm-node/runtime-fallback-signal/types.mjs +0 -1
- package/dist/types/runtime-fallback-signal/auth.d.ts +0 -18
- package/dist/types/runtime-fallback-signal/constants.d.ts +0 -9
- package/dist/types/runtime-fallback-signal/contract-gate.d.ts +0 -2
- package/dist/types/runtime-fallback-signal/endpoint.d.ts +0 -1
- package/dist/types/runtime-fallback-signal/errors.d.ts +0 -2
- package/dist/types/runtime-fallback-signal/payload.d.ts +0 -6
- package/dist/types/runtime-fallback-signal/source.d.ts +0 -3
- package/dist/types/runtime-fallback-signal/state.d.ts +0 -3
- package/dist/types/runtime-fallback-signal/status.d.ts +0 -2
- package/dist/types/runtime-fallback-signal/trust-policy.d.ts +0 -13
- package/dist/types/runtime-fallback-signal/types.d.ts +0 -50
- package/src/runtime-fallback-signal/auth.ts +0 -117
- package/src/runtime-fallback-signal/constants.ts +0 -19
- package/src/runtime-fallback-signal/endpoint.ts +0 -22
- package/src/runtime-fallback-signal/errors.ts +0 -10
- package/src/runtime-fallback-signal/payload.ts +0 -79
- package/src/runtime-fallback-signal/source.ts +0 -49
- package/src/runtime-fallback-signal/state.ts +0 -34
- package/src/runtime-fallback-signal/status.ts +0 -22
- package/src/runtime-fallback-signal/trust-policy.ts +0 -179
- package/src/runtime-fallback-signal/types.ts +0 -66
|
@@ -1,72 +0,0 @@
|
|
|
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 DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = '/_modern/contract-gates/runtime-fallback';
|
|
31
|
-
const DEFAULT_RUNTIME_STATUS_ENDPOINT = '/_modern/runtime/status';
|
|
32
|
-
const DEFAULT_RUNTIME_FALLBACK_GATE_NAME = 'runtime-mf-fallback-health';
|
|
33
|
-
const DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS = 300000;
|
|
34
|
-
const DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES = 16384;
|
|
35
|
-
const DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER = 'x-modernjs-runtime-signal-token';
|
|
36
|
-
const DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW = 30;
|
|
37
|
-
const DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS = 60000;
|
|
38
|
-
const DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS = 10000;
|
|
39
|
-
__webpack_require__.d(__webpack_exports__, {}, {
|
|
40
|
-
DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER: DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER,
|
|
41
|
-
DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS: DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS,
|
|
42
|
-
DEFAULT_RUNTIME_FALLBACK_GATE_NAME: DEFAULT_RUNTIME_FALLBACK_GATE_NAME,
|
|
43
|
-
DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES: DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES,
|
|
44
|
-
DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT: DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT,
|
|
45
|
-
DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS: DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS,
|
|
46
|
-
DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW: DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW,
|
|
47
|
-
DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS: DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS,
|
|
48
|
-
DEFAULT_RUNTIME_STATUS_ENDPOINT: DEFAULT_RUNTIME_STATUS_ENDPOINT
|
|
49
|
-
});
|
|
50
|
-
exports.DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER;
|
|
51
|
-
exports.DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS;
|
|
52
|
-
exports.DEFAULT_RUNTIME_FALLBACK_GATE_NAME = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_GATE_NAME;
|
|
53
|
-
exports.DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES;
|
|
54
|
-
exports.DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT;
|
|
55
|
-
exports.DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS;
|
|
56
|
-
exports.DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW;
|
|
57
|
-
exports.DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS = __webpack_exports__.DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS;
|
|
58
|
-
exports.DEFAULT_RUNTIME_STATUS_ENDPOINT = __webpack_exports__.DEFAULT_RUNTIME_STATUS_ENDPOINT;
|
|
59
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
60
|
-
"DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER",
|
|
61
|
-
"DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS",
|
|
62
|
-
"DEFAULT_RUNTIME_FALLBACK_GATE_NAME",
|
|
63
|
-
"DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES",
|
|
64
|
-
"DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT",
|
|
65
|
-
"DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS",
|
|
66
|
-
"DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW",
|
|
67
|
-
"DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS",
|
|
68
|
-
"DEFAULT_RUNTIME_STATUS_ENDPOINT"
|
|
69
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
70
|
-
Object.defineProperty(exports, '__esModule', {
|
|
71
|
-
value: true
|
|
72
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
resolveRuntimeFallbackSignalEndpoint: ()=>resolveRuntimeFallbackSignalEndpoint
|
|
32
|
-
});
|
|
33
|
-
const external_constants_js_namespaceObject = require("./constants.js");
|
|
34
|
-
function resolveRuntimeFallbackSignalEndpoint(configuredEndpoint) {
|
|
35
|
-
const rawEndpoint = configuredEndpoint?.trim();
|
|
36
|
-
if (!rawEndpoint) return external_constants_js_namespaceObject.DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT;
|
|
37
|
-
if (rawEndpoint.startsWith('/')) return rawEndpoint;
|
|
38
|
-
try {
|
|
39
|
-
return new URL(rawEndpoint).pathname || external_constants_js_namespaceObject.DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT;
|
|
40
|
-
} catch (_error) {
|
|
41
|
-
return `/${rawEndpoint.replace(/^\/+/, '')}`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.resolveRuntimeFallbackSignalEndpoint = __webpack_exports__.resolveRuntimeFallbackSignalEndpoint;
|
|
45
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
46
|
-
"resolveRuntimeFallbackSignalEndpoint"
|
|
47
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
48
|
-
Object.defineProperty(exports, '__esModule', {
|
|
49
|
-
value: true
|
|
50
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
function createRuntimeSignalError(message, code) {
|
|
31
|
-
const error = new Error(message);
|
|
32
|
-
error.code = code;
|
|
33
|
-
return error;
|
|
34
|
-
}
|
|
35
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
createRuntimeSignalError: ()=>createRuntimeSignalError
|
|
37
|
-
});
|
|
38
|
-
exports.createRuntimeSignalError = __webpack_exports__.createRuntimeSignalError;
|
|
39
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
|
-
"createRuntimeSignalError"
|
|
41
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
|
-
Object.defineProperty(exports, '__esModule', {
|
|
43
|
-
value: true
|
|
44
|
-
});
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
parseRuntimeFallbackSignalPayload: ()=>parseRuntimeFallbackSignalPayload,
|
|
32
|
-
parseRuntimeFallbackSignalPayloadFromRawBody: ()=>parseRuntimeFallbackSignalPayloadFromRawBody
|
|
33
|
-
});
|
|
34
|
-
const external_errors_js_namespaceObject = require("./errors.js");
|
|
35
|
-
function getUtf8ByteLength(input) {
|
|
36
|
-
if ("u" > typeof Buffer) return Buffer.byteLength(input);
|
|
37
|
-
return new TextEncoder().encode(input).length;
|
|
38
|
-
}
|
|
39
|
-
async function parseRuntimeFallbackSignalPayload(c, maxBodyBytes) {
|
|
40
|
-
const contentLengthHeader = c.req.header('content-length');
|
|
41
|
-
if (contentLengthHeader) {
|
|
42
|
-
const contentLength = Number.parseInt(contentLengthHeader, 10);
|
|
43
|
-
if (Number.isFinite(contentLength) && contentLength > maxBodyBytes) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)('runtime fallback signal payload too large', 'PAYLOAD_TOO_LARGE');
|
|
44
|
-
}
|
|
45
|
-
const rawBody = await c.req.raw.text();
|
|
46
|
-
const payload = parseRuntimeFallbackSignalPayloadFromRawBody(rawBody, maxBodyBytes);
|
|
47
|
-
return {
|
|
48
|
-
rawBody,
|
|
49
|
-
payload
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function parseRuntimeFallbackSignalPayloadFromRawBody(rawBody, maxBodyBytes) {
|
|
53
|
-
if (!rawBody || 0 === rawBody.trim().length) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)('runtime fallback signal body is empty', 'INVALID_PAYLOAD');
|
|
54
|
-
if (getUtf8ByteLength(rawBody) > maxBodyBytes) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)('runtime fallback signal payload too large', 'PAYLOAD_TOO_LARGE');
|
|
55
|
-
let payload;
|
|
56
|
-
try {
|
|
57
|
-
payload = JSON.parse(rawBody);
|
|
58
|
-
} catch (_error) {
|
|
59
|
-
throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)('runtime fallback signal body must be valid JSON', 'INVALID_PAYLOAD');
|
|
60
|
-
}
|
|
61
|
-
if (!payload || 'object' != typeof payload || Array.isArray(payload)) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)('runtime fallback signal body must be a JSON object', 'INVALID_PAYLOAD');
|
|
62
|
-
return payload;
|
|
63
|
-
}
|
|
64
|
-
exports.parseRuntimeFallbackSignalPayload = __webpack_exports__.parseRuntimeFallbackSignalPayload;
|
|
65
|
-
exports.parseRuntimeFallbackSignalPayloadFromRawBody = __webpack_exports__.parseRuntimeFallbackSignalPayloadFromRawBody;
|
|
66
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
67
|
-
"parseRuntimeFallbackSignalPayload",
|
|
68
|
-
"parseRuntimeFallbackSignalPayloadFromRawBody"
|
|
69
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
70
|
-
Object.defineProperty(exports, '__esModule', {
|
|
71
|
-
value: true
|
|
72
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
function normalizeRuntimeSignalOrigin(value) {
|
|
31
|
-
if ('string' != typeof value || 0 === value.trim().length) return;
|
|
32
|
-
try {
|
|
33
|
-
return new URL(value).origin;
|
|
34
|
-
} catch (_error) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function normalizeRuntimeSignalAppName(payload) {
|
|
39
|
-
if ('string' != typeof payload.appName) return 'unknown';
|
|
40
|
-
const normalized = payload.appName.trim();
|
|
41
|
-
return normalized.length > 0 ? normalized : 'unknown';
|
|
42
|
-
}
|
|
43
|
-
function normalizeRuntimeSignalRuntimeDigest(payload) {
|
|
44
|
-
if ('string' == typeof payload.runtimeDigest && payload.runtimeDigest.trim()) return payload.runtimeDigest.trim();
|
|
45
|
-
const metadata = payload.metadata;
|
|
46
|
-
if (metadata && 'object' == typeof metadata && !Array.isArray(metadata) && 'string' == typeof metadata.runtimeDigest) {
|
|
47
|
-
const digest = String(metadata.runtimeDigest).trim();
|
|
48
|
-
if (digest) return digest;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
52
|
-
normalizeRuntimeSignalAppName: ()=>normalizeRuntimeSignalAppName,
|
|
53
|
-
normalizeRuntimeSignalOrigin: ()=>normalizeRuntimeSignalOrigin,
|
|
54
|
-
normalizeRuntimeSignalRuntimeDigest: ()=>normalizeRuntimeSignalRuntimeDigest
|
|
55
|
-
});
|
|
56
|
-
exports.normalizeRuntimeSignalAppName = __webpack_exports__.normalizeRuntimeSignalAppName;
|
|
57
|
-
exports.normalizeRuntimeSignalOrigin = __webpack_exports__.normalizeRuntimeSignalOrigin;
|
|
58
|
-
exports.normalizeRuntimeSignalRuntimeDigest = __webpack_exports__.normalizeRuntimeSignalRuntimeDigest;
|
|
59
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
60
|
-
"normalizeRuntimeSignalAppName",
|
|
61
|
-
"normalizeRuntimeSignalOrigin",
|
|
62
|
-
"normalizeRuntimeSignalRuntimeDigest"
|
|
63
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
64
|
-
Object.defineProperty(exports, '__esModule', {
|
|
65
|
-
value: true
|
|
66
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
function createRuntimeFallbackSignalRuntimeState() {
|
|
31
|
-
return {
|
|
32
|
-
rateLimitBySource: new Map(),
|
|
33
|
-
dedupeByFingerprint: new Map()
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function cleanupRuntimeFallbackSignalRuntimeState(now, runtimeState, trustPolicy) {
|
|
37
|
-
const dedupeExpiryMs = Math.max(trustPolicy.dedupeWindowMs, trustPolicy.windowMs, 1000);
|
|
38
|
-
runtimeState.dedupeByFingerprint.forEach((lastSeenAt, fingerprint)=>{
|
|
39
|
-
if (now - lastSeenAt > dedupeExpiryMs) runtimeState.dedupeByFingerprint.delete(fingerprint);
|
|
40
|
-
});
|
|
41
|
-
runtimeState.rateLimitBySource.forEach((state, source)=>{
|
|
42
|
-
if (now - state.windowStartedAt > 2 * trustPolicy.windowMs) runtimeState.rateLimitBySource.delete(source);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
46
|
-
cleanupRuntimeFallbackSignalRuntimeState: ()=>cleanupRuntimeFallbackSignalRuntimeState,
|
|
47
|
-
createRuntimeFallbackSignalRuntimeState: ()=>createRuntimeFallbackSignalRuntimeState
|
|
48
|
-
});
|
|
49
|
-
exports.cleanupRuntimeFallbackSignalRuntimeState = __webpack_exports__.cleanupRuntimeFallbackSignalRuntimeState;
|
|
50
|
-
exports.createRuntimeFallbackSignalRuntimeState = __webpack_exports__.createRuntimeFallbackSignalRuntimeState;
|
|
51
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
52
|
-
"cleanupRuntimeFallbackSignalRuntimeState",
|
|
53
|
-
"createRuntimeFallbackSignalRuntimeState"
|
|
54
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
55
|
-
Object.defineProperty(exports, '__esModule', {
|
|
56
|
-
value: true
|
|
57
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
function getRuntimeSignalErrorStatusCode(signalError) {
|
|
31
|
-
if ('PAYLOAD_TOO_LARGE' === signalError.code) return 413;
|
|
32
|
-
if ('INVALID_PAYLOAD' === signalError.code) return 400;
|
|
33
|
-
if ('UNAUTHORIZED' === signalError.code) return 401;
|
|
34
|
-
if ('RATE_LIMITED' === signalError.code) return 429;
|
|
35
|
-
if ('UNTRUSTED_SOURCE' === signalError.code) return 403;
|
|
36
|
-
return 500;
|
|
37
|
-
}
|
|
38
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
-
getRuntimeSignalErrorStatusCode: ()=>getRuntimeSignalErrorStatusCode
|
|
40
|
-
});
|
|
41
|
-
exports.getRuntimeSignalErrorStatusCode = __webpack_exports__.getRuntimeSignalErrorStatusCode;
|
|
42
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
43
|
-
"getRuntimeSignalErrorStatusCode"
|
|
44
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
45
|
-
Object.defineProperty(exports, '__esModule', {
|
|
46
|
-
value: true
|
|
47
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
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
|
-
enforceRuntimeFallbackSignalTrustPolicy: ()=>enforceRuntimeFallbackSignalTrustPolicy,
|
|
32
|
-
normalizeRuntimeFallbackTrustPolicy: ()=>normalizeRuntimeFallbackTrustPolicy
|
|
33
|
-
});
|
|
34
|
-
const external_constants_js_namespaceObject = require("./constants.js");
|
|
35
|
-
const external_errors_js_namespaceObject = require("./errors.js");
|
|
36
|
-
const external_source_js_namespaceObject = require("./source.js");
|
|
37
|
-
const external_state_js_namespaceObject = require("./state.js");
|
|
38
|
-
function normalizeRuntimeFallbackTrustPolicy(configured) {
|
|
39
|
-
const allowedApps = Array.isArray(configured?.allowedApps) ? configured.allowedApps.map((item)=>'string' == typeof item ? item.trim() : '').filter(Boolean) : [];
|
|
40
|
-
const allowedEntryOrigins = Array.isArray(configured?.allowedEntryOrigins) ? configured.allowedEntryOrigins.map((item)=>(0, external_source_js_namespaceObject.normalizeRuntimeSignalOrigin)(item)).filter((item)=>Boolean(item)) : [];
|
|
41
|
-
const expectedRuntimeDigestsRaw = configured?.expectedRuntimeDigests || {};
|
|
42
|
-
const expectedRuntimeDigests = {};
|
|
43
|
-
Object.entries(expectedRuntimeDigestsRaw).forEach(([appName, digest])=>{
|
|
44
|
-
if ('string' == typeof appName && appName.trim().length > 0 && 'string' == typeof digest && digest.trim().length > 0) expectedRuntimeDigests[appName.trim()] = digest.trim();
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
allowedApps,
|
|
48
|
-
allowedEntryOrigins,
|
|
49
|
-
expectedRuntimeDigests,
|
|
50
|
-
enforceRuntimeDigest: configured?.enforceRuntimeDigest === true,
|
|
51
|
-
maxSignalsPerWindow: Math.max(1, Math.floor(configured?.maxSignalsPerWindow ?? external_constants_js_namespaceObject.DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW)),
|
|
52
|
-
windowMs: Math.max(1000, Math.floor(configured?.windowMs ?? external_constants_js_namespaceObject.DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS)),
|
|
53
|
-
dedupeWindowMs: Math.max(0, Math.floor(configured?.dedupeWindowMs ?? external_constants_js_namespaceObject.DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS))
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function enforceRuntimeFallbackSignalTrustPolicy(payload, runtimeSignalContext, source = {}) {
|
|
57
|
-
const { trustPolicy, runtimeState } = runtimeSignalContext;
|
|
58
|
-
const now = Date.now();
|
|
59
|
-
(0, external_state_js_namespaceObject.cleanupRuntimeFallbackSignalRuntimeState)(now, runtimeState, trustPolicy);
|
|
60
|
-
const appName = (0, external_source_js_namespaceObject.normalizeRuntimeSignalAppName)(payload);
|
|
61
|
-
const entryOrigin = (0, external_source_js_namespaceObject.normalizeRuntimeSignalOrigin)(payload.entry);
|
|
62
|
-
const runtimeDigest = (0, external_source_js_namespaceObject.normalizeRuntimeSignalRuntimeDigest)(payload);
|
|
63
|
-
if (trustPolicy.allowedApps.length > 0 && !trustPolicy.allowedApps.includes(appName)) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)(`runtime fallback signal app "${appName}" is not trusted`, 'UNTRUSTED_SOURCE');
|
|
64
|
-
if (trustPolicy.allowedEntryOrigins.length > 0) {
|
|
65
|
-
if (!entryOrigin || !trustPolicy.allowedEntryOrigins.includes(entryOrigin)) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)(`runtime fallback signal entry origin "${entryOrigin || 'unknown'}" is not trusted`, 'UNTRUSTED_SOURCE');
|
|
66
|
-
}
|
|
67
|
-
const expectedDigest = trustPolicy.expectedRuntimeDigests[appName];
|
|
68
|
-
if (expectedDigest && runtimeDigest !== expectedDigest) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)(`runtime fallback runtimeDigest mismatch for app "${appName}"`, 'UNTRUSTED_SOURCE');
|
|
69
|
-
if (trustPolicy.enforceRuntimeDigest && !runtimeDigest) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)(`runtime fallback signal for app "${appName}" is missing runtimeDigest`, 'UNTRUSTED_SOURCE');
|
|
70
|
-
const dedupeFingerprint = JSON.stringify({
|
|
71
|
-
appName,
|
|
72
|
-
entryOrigin: entryOrigin || 'unknown',
|
|
73
|
-
reason: payload.reason || 'runtime_fallback',
|
|
74
|
-
phase: payload.phase || 'unknown',
|
|
75
|
-
runtimeDigest: runtimeDigest || 'unknown'
|
|
76
|
-
});
|
|
77
|
-
const dedupeWindowMs = trustPolicy.dedupeWindowMs;
|
|
78
|
-
if (dedupeWindowMs > 0) {
|
|
79
|
-
const lastSeenAt = runtimeState.dedupeByFingerprint.get(dedupeFingerprint);
|
|
80
|
-
runtimeState.dedupeByFingerprint.set(dedupeFingerprint, now);
|
|
81
|
-
if ('number' == typeof lastSeenAt && now - lastSeenAt <= dedupeWindowMs) return {
|
|
82
|
-
deduped: true
|
|
83
|
-
};
|
|
84
|
-
} else runtimeState.dedupeByFingerprint.set(dedupeFingerprint, now);
|
|
85
|
-
const remoteAddress = source.remoteAddress?.trim();
|
|
86
|
-
const sourceKey = remoteAddress || 'unknown-remote';
|
|
87
|
-
const rateState = runtimeState.rateLimitBySource.get(sourceKey);
|
|
88
|
-
if (!rateState || now - rateState.windowStartedAt > trustPolicy.windowMs) runtimeState.rateLimitBySource.set(sourceKey, {
|
|
89
|
-
count: 1,
|
|
90
|
-
windowStartedAt: now
|
|
91
|
-
});
|
|
92
|
-
else {
|
|
93
|
-
if (rateState.count >= trustPolicy.maxSignalsPerWindow) throw (0, external_errors_js_namespaceObject.createRuntimeSignalError)(`runtime fallback signal rate-limited for source "${sourceKey}"`, 'RATE_LIMITED');
|
|
94
|
-
rateState.count += 1;
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
deduped: false
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
exports.enforceRuntimeFallbackSignalTrustPolicy = __webpack_exports__.enforceRuntimeFallbackSignalTrustPolicy;
|
|
101
|
-
exports.normalizeRuntimeFallbackTrustPolicy = __webpack_exports__.normalizeRuntimeFallbackTrustPolicy;
|
|
102
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
103
|
-
"enforceRuntimeFallbackSignalTrustPolicy",
|
|
104
|
-
"normalizeRuntimeFallbackTrustPolicy"
|
|
105
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
106
|
-
Object.defineProperty(exports, '__esModule', {
|
|
107
|
-
value: true
|
|
108
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.r = (exports1)=>{
|
|
5
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
-
value: 'Module'
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
})();
|
|
13
|
-
var __webpack_exports__ = {};
|
|
14
|
-
__webpack_require__.r(__webpack_exports__);
|
|
15
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
-
Object.defineProperty(exports, '__esModule', {
|
|
17
|
-
value: true
|
|
18
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { createHash, timingSafeEqual } from "node:crypto";
|
|
2
|
-
import { DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER } from "./constants.mjs";
|
|
3
|
-
import { createRuntimeSignalError } from "./errors.mjs";
|
|
4
|
-
function normalizeRuntimeFallbackSignalAuthConfig(configured) {
|
|
5
|
-
const headerName = 'string' == typeof configured?.headerName && configured.headerName.trim() ? configured.headerName.trim().toLowerCase() : DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER;
|
|
6
|
-
const expectedFromEnv = 'string' == typeof configured?.expectedValueEnv && configured.expectedValueEnv.trim().length > 0 ? process.env[configured.expectedValueEnv.trim()] : void 0;
|
|
7
|
-
const expectedFromConfig = 'string' == typeof configured?.expectedValue && configured.expectedValue.trim().length > 0 ? configured.expectedValue.trim() : void 0;
|
|
8
|
-
const expectedValue = expectedFromConfig || expectedFromEnv;
|
|
9
|
-
const enabled = configured?.enabled === true;
|
|
10
|
-
if (enabled && !expectedValue) throw new Error('[telemetry.canary.autopilot.runtimeFallbackSignal] auth.enabled is true but no expected token is configured');
|
|
11
|
-
return {
|
|
12
|
-
enabled,
|
|
13
|
-
headerName,
|
|
14
|
-
expectedValue
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function normalizeRequiredRuntimeFallbackSignalAuthConfig(configured) {
|
|
18
|
-
if (configured?.enabled === false) throw new Error('[telemetry.canary.autopilot.runtimeFallbackSignal] the endpoint cannot be enabled with auth disabled; configure auth.expectedValue or auth.expectedValueEnv');
|
|
19
|
-
try {
|
|
20
|
-
return normalizeRuntimeFallbackSignalAuthConfig({
|
|
21
|
-
...configured,
|
|
22
|
-
enabled: true
|
|
23
|
-
});
|
|
24
|
-
} catch (_error) {
|
|
25
|
-
throw new Error('[telemetry.canary.autopilot.runtimeFallbackSignal] enabling the endpoint requires an auth token; configure auth.expectedValue or auth.expectedValueEnv');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function safeTokenEquals(candidate, expected) {
|
|
29
|
-
const candidateDigest = createHash('sha256').update(candidate).digest();
|
|
30
|
-
const expectedDigest = createHash('sha256').update(expected).digest();
|
|
31
|
-
return timingSafeEqual(candidateDigest, expectedDigest);
|
|
32
|
-
}
|
|
33
|
-
function enforceRuntimeFallbackSignalAuthToken(token, authConfig) {
|
|
34
|
-
if (!authConfig.enabled) return;
|
|
35
|
-
if (!token || !authConfig.expectedValue || !safeTokenEquals(token, authConfig.expectedValue)) throw createRuntimeSignalError('runtime fallback signal auth failed', 'UNAUTHORIZED');
|
|
36
|
-
}
|
|
37
|
-
function enforceRuntimeFallbackSignalAuth(c, runtimeSignalConfig) {
|
|
38
|
-
enforceRuntimeFallbackSignalAuthToken(c.req.header(runtimeSignalConfig.auth.headerName), runtimeSignalConfig.auth);
|
|
39
|
-
}
|
|
40
|
-
export { enforceRuntimeFallbackSignalAuth, enforceRuntimeFallbackSignalAuthToken, normalizeRequiredRuntimeFallbackSignalAuthConfig, normalizeRuntimeFallbackSignalAuthConfig };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT = '/_modern/contract-gates/runtime-fallback';
|
|
2
|
-
const DEFAULT_RUNTIME_STATUS_ENDPOINT = '/_modern/runtime/status';
|
|
3
|
-
const DEFAULT_RUNTIME_FALLBACK_GATE_NAME = 'runtime-mf-fallback-health';
|
|
4
|
-
const DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS = 300000;
|
|
5
|
-
const DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES = 16384;
|
|
6
|
-
const DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER = 'x-modernjs-runtime-signal-token';
|
|
7
|
-
const DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW = 30;
|
|
8
|
-
const DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS = 60000;
|
|
9
|
-
const DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS = 10000;
|
|
10
|
-
export { DEFAULT_RUNTIME_FALLBACK_AUTH_HEADER, DEFAULT_RUNTIME_FALLBACK_FAILURE_HOLD_MS, DEFAULT_RUNTIME_FALLBACK_GATE_NAME, DEFAULT_RUNTIME_FALLBACK_MAX_BODY_BYTES, DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT, DEFAULT_RUNTIME_FALLBACK_TRUST_DEDUPE_WINDOW_MS, DEFAULT_RUNTIME_FALLBACK_TRUST_MAX_SIGNALS_PER_WINDOW, DEFAULT_RUNTIME_FALLBACK_TRUST_WINDOW_MS, DEFAULT_RUNTIME_STATUS_ENDPOINT };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT } from "./constants.mjs";
|
|
2
|
-
function resolveRuntimeFallbackSignalEndpoint(configuredEndpoint) {
|
|
3
|
-
const rawEndpoint = configuredEndpoint?.trim();
|
|
4
|
-
if (!rawEndpoint) return DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT;
|
|
5
|
-
if (rawEndpoint.startsWith('/')) return rawEndpoint;
|
|
6
|
-
try {
|
|
7
|
-
return new URL(rawEndpoint).pathname || DEFAULT_RUNTIME_FALLBACK_SIGNAL_ENDPOINT;
|
|
8
|
-
} catch (_error) {
|
|
9
|
-
return `/${rawEndpoint.replace(/^\/+/, '')}`;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export { resolveRuntimeFallbackSignalEndpoint };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createRuntimeSignalError } from "./errors.mjs";
|
|
2
|
-
function getUtf8ByteLength(input) {
|
|
3
|
-
if ("u" > typeof Buffer) return Buffer.byteLength(input);
|
|
4
|
-
return new TextEncoder().encode(input).length;
|
|
5
|
-
}
|
|
6
|
-
async function parseRuntimeFallbackSignalPayload(c, maxBodyBytes) {
|
|
7
|
-
const contentLengthHeader = c.req.header('content-length');
|
|
8
|
-
if (contentLengthHeader) {
|
|
9
|
-
const contentLength = Number.parseInt(contentLengthHeader, 10);
|
|
10
|
-
if (Number.isFinite(contentLength) && contentLength > maxBodyBytes) throw createRuntimeSignalError('runtime fallback signal payload too large', 'PAYLOAD_TOO_LARGE');
|
|
11
|
-
}
|
|
12
|
-
const rawBody = await c.req.raw.text();
|
|
13
|
-
const payload = parseRuntimeFallbackSignalPayloadFromRawBody(rawBody, maxBodyBytes);
|
|
14
|
-
return {
|
|
15
|
-
rawBody,
|
|
16
|
-
payload
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function parseRuntimeFallbackSignalPayloadFromRawBody(rawBody, maxBodyBytes) {
|
|
20
|
-
if (!rawBody || 0 === rawBody.trim().length) throw createRuntimeSignalError('runtime fallback signal body is empty', 'INVALID_PAYLOAD');
|
|
21
|
-
if (getUtf8ByteLength(rawBody) > maxBodyBytes) throw createRuntimeSignalError('runtime fallback signal payload too large', 'PAYLOAD_TOO_LARGE');
|
|
22
|
-
let payload;
|
|
23
|
-
try {
|
|
24
|
-
payload = JSON.parse(rawBody);
|
|
25
|
-
} catch (_error) {
|
|
26
|
-
throw createRuntimeSignalError('runtime fallback signal body must be valid JSON', 'INVALID_PAYLOAD');
|
|
27
|
-
}
|
|
28
|
-
if (!payload || 'object' != typeof payload || Array.isArray(payload)) throw createRuntimeSignalError('runtime fallback signal body must be a JSON object', 'INVALID_PAYLOAD');
|
|
29
|
-
return payload;
|
|
30
|
-
}
|
|
31
|
-
export { parseRuntimeFallbackSignalPayload, parseRuntimeFallbackSignalPayloadFromRawBody };
|