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.
@@ -1,5 +1,5 @@
1
1
  import { createHash } from 'node:crypto';
2
- import { Logger } from '../logging/Logger.js';
2
+ import { Logger } from 'deku-sprout';
3
3
 
4
4
  /**
5
5
  * Pattern matching environment variable references in strings.
@@ -1,4 +1,4 @@
1
- import { BaseLogger } from '../BaseLogger.js';
1
+ import { BaseLogger } from 'deku-sprout';
2
2
  import { LogBuffer } from './LogBuffer.js';
3
3
 
4
4
  /**
@@ -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
- * @returns {boolean} True if emit is configured.
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,5 +1,5 @@
1
+ import { Logger } from 'deku-sprout';
1
2
  import { ConditionMatcher } from './ConditionMatcher.js';
2
- import { Logger } from '../../common/utils/logging/Logger.js';
3
3
 
4
4
  /**
5
5
  * FilterMatcher evaluates a list of AND'ed CSS parser conditions against a DOM
@@ -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 '../common/utils/logging/Logger.js';
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';
@@ -1,5 +1,5 @@
1
+ import { Logger } from 'deku-sprout';
1
2
  import { RequestHandler } from '../common/server/RequestHandler.js';
2
- import { Logger } from '../common/utils/logging/Logger.js';
3
3
  import { ForbiddenError } from '../exceptions/http/ForbiddenError.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
+ import { Logger } from 'deku-sprout';
1
2
  import express from 'express';
2
3
  import { Router } from './Router.js';
3
- import { Logger } from '../common/utils/logging/Logger.js';
4
4
 
5
5
  /**
6
6
  * Express web server for the Navi monitoring interface.
@@ -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 '../../common/utils/logging/Logger.js';
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.11.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-swarm": "1.9.0",
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"