navi-hey 1.11.1 → 1.12.1
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/lib/common/utils/env_resolver/EnvStringResolver.js +1 -1
- package/lib/common/utils/logging/buffer/BufferedLogger.js +1 -1
- package/lib/models/configs/MenuConfig.js +1 -1
- package/lib/models/request/resource_request/ResourceRequest.js +4 -3
- package/lib/models/request/resource_request/ResourceRequestEmit.js +17 -1
- package/lib/parsers/css_selector_parser/FilterMatcher.js +1 -1
- package/lib/registry/instances/LogRegistryInstance.js +1 -2
- package/lib/server/RouteRegister.js +1 -1
- package/lib/server/SecuredRequestHandler.js +1 -1
- package/lib/server/WebServer.js +1 -1
- package/lib/server/extensions/ExtensionRoutesLoader.js +1 -1
- package/lib/services/config/ConfigIncluder.js +1 -1
- package/lib/utils/memory/CgroupV1MemoryLimitReader.js +10 -0
- package/package.json +3 -2
- package/static/assets/react-vendor.js +8 -8
- package/lib/common/utils/logging/BaseLogger.js +0 -98
- package/lib/common/utils/logging/ConsoleLogger.js +0 -20
- package/lib/common/utils/logging/Logger.js +0 -138
- package/lib/common/utils/logging/LoggerGroup.js +0 -104
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { Logger } from 'deku-sprout';
|
|
2
3
|
import YAML from 'yaml';
|
|
3
4
|
import { MenuEntry } from './MenuEntry.js';
|
|
4
5
|
import { EnvStringResolver } from '../../common/utils/env_resolver/EnvStringResolver.js';
|
|
5
|
-
import { Logger } from '../../common/utils/logging/Logger.js';
|
|
6
6
|
import { MenuConfigurationInvalid } from '../../exceptions/config/MenuConfigurationInvalid.js';
|
|
7
7
|
|
|
8
8
|
const DEFAULT_LABELS = {
|
|
@@ -198,11 +198,12 @@ class ResourceRequest {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
|
-
* Returns true when the resource request declares a follow-up emit configuration
|
|
202
|
-
*
|
|
201
|
+
* Returns true when the resource request declares a follow-up emit configuration
|
|
202
|
+
* that is not itself disabled (via the emit's own `enabled`/`disabled` flags).
|
|
203
|
+
* @returns {boolean} True if emit is configured and enabled.
|
|
203
204
|
*/
|
|
204
205
|
hasEmit() {
|
|
205
|
-
return !!this.emit;
|
|
206
|
+
return !!this.emit && !this.emit.disabled;
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
/**
|
|
@@ -33,6 +33,7 @@ class ResourceRequestEmit {
|
|
|
33
33
|
#cooldown;
|
|
34
34
|
#headers;
|
|
35
35
|
#bodyTemplate;
|
|
36
|
+
#disabled;
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* @param {object} attributes ResourceRequestEmit attributes.
|
|
@@ -55,8 +56,12 @@ class ResourceRequestEmit {
|
|
|
55
56
|
* to wrap/re-shape the extracted item before it is sent as the emit request body. `{:key}`
|
|
56
57
|
* / `{:nested.path}` tokens are resolved against the item; `{:.}` refers to the whole item.
|
|
57
58
|
* When omitted, the bare item is sent as the body (current behavior).
|
|
59
|
+
* @param {boolean} [attributes.enabled] Whether this emit is enabled. Defaults to enabled
|
|
60
|
+
* when omitted. Ignored when `disabled` is `true`.
|
|
61
|
+
* @param {boolean} [attributes.disabled] Whether this emit is disabled. Takes precedence
|
|
62
|
+
* over `enabled` when `true`.
|
|
58
63
|
*/
|
|
59
|
-
constructor({ client, method, url, status, retries, cooldown, headers, body_template: bodyTemplate }) {
|
|
64
|
+
constructor({ client, method, url, status, retries, cooldown, headers, body_template: bodyTemplate, enabled, disabled }) {
|
|
60
65
|
if (!EMIT_METHODS.includes(method)) throw new InvalidEmitMethod(method);
|
|
61
66
|
if (!url) throw new MissingEmitUrl();
|
|
62
67
|
if (retries !== undefined && (typeof retries !== 'number' || retries < 0)) throw new InvalidEmitRetries(retries);
|
|
@@ -69,6 +74,7 @@ class ResourceRequestEmit {
|
|
|
69
74
|
this.#cooldown = cooldown;
|
|
70
75
|
this.#headers = this.#parseHeaders(headers);
|
|
71
76
|
this.#bodyTemplate = this.#parseBodyTemplate(bodyTemplate);
|
|
77
|
+
this.#disabled = disabled === true || enabled === false;
|
|
72
78
|
|
|
73
79
|
this.method = method;
|
|
74
80
|
this.url = url;
|
|
@@ -127,6 +133,16 @@ class ResourceRequestEmit {
|
|
|
127
133
|
return this.#bodyTemplate;
|
|
128
134
|
}
|
|
129
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Returns whether this emit is disabled, i.e. it must not be enqueued. This emit is
|
|
138
|
+
* disabled when `disabled: true` was given (regardless of `enabled`), or when
|
|
139
|
+
* `enabled: false` was given. Otherwise it is enabled (the default).
|
|
140
|
+
* @returns {boolean} True if this emit is disabled.
|
|
141
|
+
*/
|
|
142
|
+
get disabled() {
|
|
143
|
+
return this.#disabled;
|
|
144
|
+
}
|
|
145
|
+
|
|
130
146
|
/**
|
|
131
147
|
* Returns the URL with every {:placeholder} token replaced by the
|
|
132
148
|
* corresponding value from the parameters object.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { Logger, LoggerGroup } from 'deku-sprout';
|
|
1
2
|
import { BufferedLogger } from '../../common/utils/logging/buffer/BufferedLogger.js';
|
|
2
3
|
import { LogBufferCollection } from '../../common/utils/logging/buffer/LogBufferCollection.js';
|
|
3
4
|
import { LogFilter } from '../../common/utils/logging/LogFilter.js';
|
|
4
|
-
import { Logger } from '../../common/utils/logging/Logger.js';
|
|
5
|
-
import { LoggerGroup } from '../../common/utils/logging/LoggerGroup.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Holds a LoggerGroup (Logger + BufferedLogger) for the LogRegistry singleton.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from '
|
|
1
|
+
import { Logger } from 'deku-sprout';
|
|
2
2
|
import { ConflictError } from '../exceptions/http/ConflictError.js';
|
|
3
3
|
import { ForbiddenError } from '../exceptions/http/ForbiddenError.js';
|
|
4
4
|
import { NotFoundError } from '../exceptions/http/NotFoundError.js';
|
package/lib/server/WebServer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import { Logger } from '
|
|
4
|
+
import { Logger } from 'deku-sprout';
|
|
5
5
|
import { ExtensionsDirectoryMissing } from '../../exceptions/config/ExtensionsDirectoryMissing.js';
|
|
6
6
|
import { ForbiddenError } from '../../exceptions/http/ForbiddenError.js';
|
|
7
7
|
import { PathValidator } from '../PathValidator.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { Logger } from 'deku-sprout';
|
|
3
4
|
import YAML from 'yaml';
|
|
4
5
|
import { EnvStringResolver } from '../../common/utils/env_resolver/EnvStringResolver.js';
|
|
5
|
-
import { Logger } from '../../common/utils/logging/Logger.js';
|
|
6
6
|
import { ConfigurationFileNotFound } from '../../exceptions/config/file/ConfigurationFileNotFound.js';
|
|
7
7
|
import { ConfigurationIncludeNotFound } from '../../exceptions/config/file/ConfigurationIncludeNotFound.js';
|
|
8
8
|
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
|
|
3
3
|
const CGROUP_V1_MEMORY_LIMIT_PATH = '/sys/fs/cgroup/memory/memory.limit_in_bytes';
|
|
4
|
+
// 9223372036854771712 (0x7FFFFFFFFFFFF000, i.e. 2^63 - 2^12) is the real Linux
|
|
5
|
+
// cgroup v1 kernel "unbounded" sentinel for `memory.limit_in_bytes`, page-aligned
|
|
6
|
+
// (4096-byte multiple) by the kernel — it is NOT an approximation of int64 max
|
|
7
|
+
// (9223372036854775807). Because it's a multiple of 4096, it is exactly
|
|
8
|
+
// representable as a JS double despite exceeding Number.MAX_SAFE_INTEGER, so
|
|
9
|
+
// `Number(content) === UNBOUNDED` reproducibly matches (verified via
|
|
10
|
+
// `BigInt(UNBOUNDED)` round-tripping to this exact literal). Do NOT change this
|
|
11
|
+
// to `Number.MAX_SAFE_INTEGER` (a different value, which would break real
|
|
12
|
+
// unbounded detection) or to a `BigInt` (unnecessary, since the existing
|
|
13
|
+
// comparison already round-trips exactly).
|
|
4
14
|
const UNBOUNDED = 9223372036854771712;
|
|
5
15
|
|
|
6
16
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "navi-hey",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.1",
|
|
5
5
|
"description": "Navi cache warmer CLI",
|
|
6
6
|
"readme": "README.md",
|
|
7
7
|
"main": "index.js",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"axios": "^1.13.0",
|
|
37
|
-
"deku-
|
|
37
|
+
"deku-sprout": "0.1.0",
|
|
38
|
+
"deku-swarm": "1.10.1",
|
|
38
39
|
"express": "5.2.1",
|
|
39
40
|
"node-html-parser": "7.1.0",
|
|
40
41
|
"yaml": "^2.8.2"
|