iobroker.sonoff 4.0.0 → 4.2.0

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/build/main.js CHANGED
@@ -15,10 +15,12 @@ const adapter_core_1 = require("@iobroker/adapter-core"); // Get common this uti
15
15
  const server_1 = __importDefault(require("./lib/server"));
16
16
  const bridge_1 = __importDefault(require("./lib/bridge"));
17
17
  const checkStates_1 = require("./lib/checkStates");
18
+ const deviceManager_1 = __importDefault(require("./lib/deviceManager"));
18
19
  /** How many shortened states are written into the log */
19
20
  const MAX_REPORTED_STATES = 20;
20
21
  class SonoffAdapter extends adapter_core_1.Adapter {
21
22
  server = null;
23
+ deviceManagement = null;
22
24
  constructor(options = {}) {
23
25
  super({
24
26
  ...options,
@@ -33,8 +35,12 @@ class SonoffAdapter extends adapter_core_1.Adapter {
33
35
  cb();
34
36
  }
35
37
  },
38
+ objectChange: (id, obj) => {
39
+ this.deviceManagement?.onObjectChange(id, obj);
40
+ },
36
41
  stateChange: (id, state) => {
37
42
  this.log.debug(`stateChange ${id}: ${JSON.stringify(state)}`);
43
+ this.deviceManagement?.onStateChange(id, state ?? null);
38
44
  // you can use the ack flag to detect if state is desired or acknowledged
39
45
  if (state && !state.ack) {
40
46
  this.server
@@ -45,6 +51,7 @@ class SonoffAdapter extends adapter_core_1.Adapter {
45
51
  });
46
52
  }
47
53
  async main() {
54
+ this.deviceManagement = new deviceManager_1.default(this);
48
55
  // subscribe for all own variables
49
56
  this.subscribeStates('*');
50
57
  // read all states and set alive to false
package/build/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,yDAAsE,CAAC,wBAAwB;AAC/F,0DAAsC;AACtC,0DAAsC;AAEtC,mDAAwD;AAGxD,yDAAyD;AACzD,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,MAAa,aAAc,SAAQ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AG,mBAAmB,EAAE,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,MAAM,CAAC,MAAM,GAAG,mBAAmB,OAAO,CAAC,CAAC;YAC3E,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yCAA0C,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;CACJ;AAjFD,sCAiFC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAA4C,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;AAClG,CAAC;KAAM,CAAC;IACJ,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC,EAAE,CAAC;AAClC,CAAC","sourcesContent":["/**\n * ioBroker sonoff Adapter\n *\n * (c) 2017-2026 bluefox\n *\n * MIT License\n */\nimport { Adapter, type AdapterOptions } from '@iobroker/adapter-core'; // Get common this utils\nimport MQTTServer from './lib/server';\nimport MQTTBridge from './lib/bridge';\nimport type MQTTBase from './lib/mqttBase';\nimport { findShortenedStates } from './lib/checkStates';\nimport type { SonoffAdapterConfig } from './types';\n\n/** How many shortened states are written into the log */\nconst MAX_REPORTED_STATES = 20;\n\nexport class SonoffAdapter extends Adapter {\n declare config: SonoffAdapterConfig;\n server: MQTTBase | null = null;\n\n public constructor(options: Partial<AdapterOptions> = {}) {\n super({\n ...options,\n name: 'sonoff',\n ready: () => this.main(),\n unload: async (cb?: () => void): Promise<void> => {\n if (this.server) {\n await this.server.destroy();\n this.server = null;\n }\n if (typeof cb === 'function') {\n cb();\n }\n },\n stateChange: (id: string, state: ioBroker.State | null | undefined): void => {\n this.log.debug(`stateChange ${id}: ${JSON.stringify(state)}`);\n // you can use the ack flag to detect if state is desired or acknowledged\n if (state && !state.ack) {\n this.server\n ?.onStateChange(id, state)\n .catch(err => this.log.error(`Cannot process state change: ${err.message}`));\n }\n },\n });\n }\n\n private async main(): Promise<void> {\n // subscribe for all own variables\n this.subscribeStates('*');\n\n // read all states and set alive to false\n const states = await this.getStatesOfAsync('', '');\n if (states?.length) {\n for (const state of states) {\n if (state._id.match(/\\.alive$/)) {\n await this.setForeignStateAsync(state._id, false, true);\n }\n }\n }\n\n await this.reportShortenedStates();\n\n if (this.config.useExternalBroker && this.config.externalBrokerUrl) {\n this.server = new MQTTBridge(this);\n } else {\n if (this.config.useExternalBroker) {\n this.log.warn('No external broker URL configured. Starting the built-in MQTT server');\n }\n this.server = new MQTTServer(this);\n }\n }\n\n /**\n * The versions 3.3.x created states inside a group with a shortened name (issue #489),\n * e.g. \"SML_in\" instead of \"SML_Total_in\". They are not updated anymore, so the user is\n * informed about them. They are not deleted, because they can contain the history.\n */\n private async reportShortenedStates(): Promise<void> {\n try {\n const states = await findShortenedStates(this);\n if (!states.length) {\n return;\n }\n\n this.log.warn(\n `${states.length} state(s) were created with a shortened name by the versions 3.3.x and are not updated anymore. Check them and delete them if they are not required:`,\n );\n for (const state of states.slice(0, MAX_REPORTED_STATES)) {\n this.log.warn(` ${state.id} => is now ${state.expected}`);\n }\n if (states.length > MAX_REPORTED_STATES) {\n this.log.warn(` ... and ${states.length - MAX_REPORTED_STATES} more`);\n }\n } catch (err: unknown) {\n this.log.debug(`Cannot check the names of the states: ${(err as Error).message}`);\n }\n }\n}\n\nif (require.main !== module) {\n // Export the constructor in compact mode\n module.exports = (options: Partial<AdapterOptions> | undefined) => new SonoffAdapter(options);\n} else {\n // otherwise start the instance directly\n (() => new SonoffAdapter())();\n}\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,yDAAsE,CAAC,wBAAwB;AAC/F,0DAAsC;AACtC,0DAAsC;AAEtC,mDAAwD;AACxD,wE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,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACjB,OAAO;YACX,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,IAAI,CACT,GAAG,MAAM,CAAC,MAAM,sJAAsJ,CACzK,CAAC;YACF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAAE,CAAC;gBACvD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE,cAAc,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,MAAM,CAAC,MAAM,GAAG,mBAAmB,OAAO,CAAC,CAAC;YAC3E,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,yCAA0C,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;CACJ;AAxFD,sCAwFC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAA4C,EAAE,EAAE,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;AAClG,CAAC;KAAM,CAAC;IACJ,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC,EAAE,CAAC;AAClC,CAAC","sourcesContent":["/**\n * ioBroker sonoff Adapter\n *\n * (c) 2017-2026 bluefox\n *\n * MIT License\n */\nimport { Adapter, type AdapterOptions } from '@iobroker/adapter-core'; // Get common this utils\nimport MQTTServer from './lib/server';\nimport MQTTBridge from './lib/bridge';\nimport type MQTTBase from './lib/mqttBase';\nimport { findShortenedStates } from './lib/checkStates';\nimport SonoffDeviceManagement from './lib/deviceManager';\nimport type { SonoffAdapterConfig } from './types';\n\n/** How many shortened states are written into the log */\nconst MAX_REPORTED_STATES = 20;\n\nexport class SonoffAdapter extends Adapter {\n declare config: SonoffAdapterConfig;\n server: MQTTBase | null = null;\n deviceManagement: SonoffDeviceManagement | null = null;\n\n public constructor(options: Partial<AdapterOptions> = {}) {\n super({\n ...options,\n name: 'sonoff',\n ready: () => this.main(),\n unload: async (cb?: () => void): Promise<void> => {\n if (this.server) {\n await this.server.destroy();\n this.server = null;\n }\n if (typeof cb === 'function') {\n cb();\n }\n },\n objectChange: (id: string, obj: ioBroker.Object | null | undefined): void => {\n this.deviceManagement?.onObjectChange(id, obj as ioBroker.ChannelObject | ioBroker.StateObject | null);\n },\n stateChange: (id: string, state: ioBroker.State | null | undefined): void => {\n this.log.debug(`stateChange ${id}: ${JSON.stringify(state)}`);\n this.deviceManagement?.onStateChange(id, state ?? null);\n // you can use the ack flag to detect if state is desired or acknowledged\n if (state && !state.ack) {\n this.server\n ?.onStateChange(id, state)\n .catch(err => this.log.error(`Cannot process state change: ${err.message}`));\n }\n },\n });\n }\n\n private async main(): Promise<void> {\n this.deviceManagement = new SonoffDeviceManagement(this);\n\n // subscribe for all own variables\n this.subscribeStates('*');\n\n // read all states and set alive to false\n const states = await this.getStatesOfAsync('', '');\n if (states?.length) {\n for (const state of states) {\n if (state._id.match(/\\.alive$/)) {\n await this.setForeignStateAsync(state._id, false, true);\n }\n }\n }\n\n await this.reportShortenedStates();\n\n if (this.config.useExternalBroker && this.config.externalBrokerUrl) {\n this.server = new MQTTBridge(this);\n } else {\n if (this.config.useExternalBroker) {\n this.log.warn('No external broker URL configured. Starting the built-in MQTT server');\n }\n this.server = new MQTTServer(this);\n }\n }\n\n /**\n * The versions 3.3.x created states inside a group with a shortened name (issue #489),\n * e.g. \"SML_in\" instead of \"SML_Total_in\". They are not updated anymore, so the user is\n * informed about them. They are not deleted, because they can contain the history.\n */\n private async reportShortenedStates(): Promise<void> {\n try {\n const states = await findShortenedStates(this);\n if (!states.length) {\n return;\n }\n\n this.log.warn(\n `${states.length} state(s) were created with a shortened name by the versions 3.3.x and are not updated anymore. Check them and delete them if they are not required:`,\n );\n for (const state of states.slice(0, MAX_REPORTED_STATES)) {\n this.log.warn(` ${state.id} => is now ${state.expected}`);\n }\n if (states.length > MAX_REPORTED_STATES) {\n this.log.warn(` ... and ${states.length - MAX_REPORTED_STATES} more`);\n }\n } catch (err: unknown) {\n this.log.debug(`Cannot check the names of the states: ${(err as Error).message}`);\n }\n }\n}\n\nif (require.main !== module) {\n // Export the constructor in compact mode\n module.exports = (options: Partial<AdapterOptions> | undefined) => new SonoffAdapter(options);\n} else {\n // otherwise start the instance directly\n (() => new SonoffAdapter())();\n}\n"]}
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "sonoff",
4
- "version": "4.0.0",
4
+ "version": "4.2.0",
5
5
  "news": {
6
+ "4.2.0": {
7
+ "en": "Added Device Manager for existing devices",
8
+ "de": "Gerätemanager für alte Geräte hinzugefügt",
9
+ "ru": "Добавлен диспетчер устройств для существующих устройств",
10
+ "pt": "Adição do Device Manager para dispositivos atuais",
11
+ "nl": "Apparaatbeheer toegevoegd voor bestaande apparaten",
12
+ "fr": "Device Manager ajouté aux appareils existants",
13
+ "it": "Aggiunto Device Manager per i device esistenti",
14
+ "es": "Se ha añadido Device Manager para los ya existentes",
15
+ "pl": "Dodano Menedżera urządzeń dla istniejących urządzeń",
16
+ "uk": "Додано диспетчер пристроїв для існуючих пристроїв",
17
+ "zh-cn": "为现有设备添加了设备管理器"
18
+ },
6
19
  "4.0.0": {
7
20
  "en": "Adapter requires js-controller >= 6.0.11 now.\nAdd bridge mode to connect to an external MQTT broker instead of running a built-in broker\nFix alive state object not being created (warning \"has no existing object\")\nFixed the names of data points inside a group: since 3.3.0 e.g. `SML_Total_in` was created as `SML_in` (#489)\nThe MAC address and the other network and firmware information of a device are stored as data points (`INFO.Mac`, `INFO.Gateway`, `INFO.Hardware`, ...) (#513)\nServer mode: the adapter requests `Status 5` and `Status 2` from a device with its first message, so the INFO states are filled even if the device did not reboot\nThe states which were created with a shortened name by 3.3.x are listed in the log on start, so they can be deleted (#489)\nBridge mode: the topics to subscribe are configurable now and nested full topics as well as OpenBeken topics are supported\nBridge mode: devices are named after their MQTT client ID like with the built-in broker and are no longer renamed by less reliable sources\nBridge mode: the `alive` state is set from the last will topic (LWT), so devices are recognized as offline\nCommands for auto-created states are sent to `cmnd/...` again, also for nested full topics\n`info.connection` contains the list of the connected clients again (server mode), in bridge mode the URL of the broker\nBridge mode: support for the full topic structure `%topic%/%prefix%/` (device first), detected automatically per device\nBridge mode: encrypted connections with CA/client certificates and optional certificate check, configurable client ID, keepalive and clean session\nBridge mode: a fix prefix in front of the full topic (e.g. `gateway/tele/device/STATE`) is recognized and used for the commands\nAdd support for OpenBeken LED datapoints (led_enableAll, led_dimmer, led_temperature, led_basecolor_rgb, led_finalcolor_rgbcw, led_basecolor_rgbcw, led_hue, led_saturation) - enables control of OpenBeken LED devices with automatic topic mapping for /get and /set suffixes\nAdd PulseTime1-PulseTime16 datapoint support - users can now read and set PulseTime values directly from ioBroker to control relay auto-off timers\nBreaking: minimal supported Node.js version is now 22",
8
21
  "de": "Der Adapter benötigt jetzt js-controller >= 6.0.11.\nFügen Sie den Bridge-Modus hinzu, um eine Verbindung zu einem externen MQTT-Broker herzustellen, anstatt einen integrierten Broker zu verwenden.\nBeheben Sie das Problem, dass das Objekt mit dem Status „lebendig“ nicht erstellt wird (Warnung: „Es existiert kein Objekt“).\nDie Namen der Datenpunkte innerhalb einer Gruppe wurden korrigiert: Seit Version 3.3.0 wurde beispielsweise `SML_Total_in` als `SML_in` erstellt (#489).\nDie MAC-Adresse und die übrigen Netzwerk- und Firmware-Informationen eines Geräts werden als Datenpunkte gespeichert (`INFO.Mac`, `INFO.Gateway`, `INFO.Hardware`, ...) (#513)\nServermodus: Der Adapter fordert mit seiner ersten Nachricht die Statuscodes „5“ und „2“ von einem Gerät an, sodass die INFO-Statuscodes auch dann gefüllt werden, wenn das Gerät nicht neu gestartet wurde.\nDie von Version 3.3.x mit einem Kurznamen erstellten Zustände werden beim Start im Protokoll aufgelistet und können daher gelöscht werden (#489).\nBridge-Modus: Die zu abonnierenden Themen sind jetzt konfigurierbar, und sowohl verschachtelte vollständige Themen als auch OpenBeken-Themen werden unterstützt.\nBridge-Modus: Geräte werden wie beim integrierten Broker nach ihrer MQTT-Client-ID benannt und nicht mehr von weniger zuverlässigen Quellen umbenannt.\nBridge-Modus: Der Status „aktiv“ wird anhand des letzten Will-Topics (LWT) gesetzt, daher werden Geräte als offline erkannt.\nBefehle für automatisch erstellte Zustände werden erneut an `cmnd/...` gesendet, auch für verschachtelte vollständige Themen.\n`info.connection` enthält im Servermodus die Liste der verbundenen Clients, im Bridge-Modus die URL des Brokers.\nBridge-Modus: Unterstützung für die vollständige Themenstruktur `%topic%/%prefix%/` (Gerät zuerst), automatische Erkennung pro Gerät\nBridge-Modus: Verschlüsselte Verbindungen mit CA-/Client-Zertifikaten und optionaler Zertifikatsprüfung, konfigurierbare Client-ID, Keepalive und Clean Session\nBridge-Modus: Ein festes Präfix vor dem vollständigen Thema (z. B. `gateway/tele/device/STATE`) wird erkannt und für die Befehle verwendet.\nUnterstützung für OpenBeken-LED-Datenpunkte (led_enableAll, led_dimmer, led_temperature, led_basecolor_rgb, led_finalcolor_rgbcw, led_basecolor_rgbcw, led_hue, led_saturation) hinzugefügt – ermöglicht die Steuerung von OpenBeken-LED-Geräten mit automatischer Themenzuordnung für die Suffixe /get und /set.\nUnterstützung für die Datenpunkte PulseTime1-PulseTime16 hinzugefügt – Benutzer können nun PulseTime-Werte direkt von ioBroker lesen und festlegen, um die automatischen Abschalttimer von Relais zu steuern.\nWichtiger Hinweis: Die minimal unterstützte Node.js-Version ist jetzt 22.",
@@ -80,19 +93,6 @@
80
93
  "pl": "Ważne: Node.js 18.x i sterownik js- 5.0.19 + jest potrzebny co najmniej\nzaktualizowane stany dla Tasmota 13.4.0.3 20240402\npoprawiła niektóre komunikaty dziennika\nDodano PWM Pozycje\nNaprawiono obsługę QoS, aby zapobiec niepoprawnym ponownym uruchomieniom\nZapobieganie tworzeniu magazynu Map właściwość wspólne i sprzątanie",
81
94
  "uk": "Важливо: Node.js 18.x і js-controller 5.0.19+ необхідний мінімум\nоновлені стани для Тасмота 13.4.0.3 20240402\nрозширено деяких повідомлень журналу\nДодано PWM Товари\nВиправлена обробка QoS для запобігання недійсних відповідей\nПрофілактика створення магазину Карта нерухомості в загальному і чистому вигляді",
82
95
  "zh-cn": "重要:节点.js 18.x和js控制器 5.0.19+至少需要\n塔斯莫塔州升级\n增强一些日志消息\n已添加的 PWM 项目\n防止重新提交无效的固定QoS处理\n防止创建仓库 共同和清理的映射属性"
83
- },
84
- "3.0.3": {
85
- "en": "Added migration of password on JSON Config",
86
- "de": "Migration von Passwort auf JSON Config hinzugefügt",
87
- "ru": "Добавлена миграция пароля на JSON Config",
88
- "pt": "Adicionado migração de senha em JSON Config",
89
- "nl": "Vermelding van wachtwoord op JSON Config",
90
- "fr": "Ajout de la migration de mot de passe sur JSON Config",
91
- "it": "Aggiunta migrazione di password su JSON Config",
92
- "es": "Migración agregada de contraseña en JSON Config",
93
- "pl": "Dostęp do migracji haseł JSON Config",
94
- "uk": "Додано міграції пароля на JSON Config",
95
- "zh-cn": "A. 增加联索行动密码的移徙"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -146,6 +146,9 @@
146
146
  ],
147
147
  "connectionType": "local",
148
148
  "dataSource": "push",
149
+ "supportedMessages": {
150
+ "deviceManager": true
151
+ },
149
152
  "tier": 2,
150
153
  "extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.sonoff/master/admin/sonoff.png",
151
154
  "type": "lighting",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "iobroker.sonoff",
3
3
  "description": "The adapter allows to send and receive MQTT messages from ioBroker and to be a broker.",
4
- "version": "4.0.0",
4
+ "version": "4.2.0",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "homepage": "https://github.com/ioBroker/ioBroker.sonoff",
7
7
  "repository": {
@@ -17,6 +17,7 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@iobroker/adapter-core": "^3.4.3",
20
+ "@iobroker/dm-utils": "^3.2.0",
20
21
  "mqtt": "^5.15.2",
21
22
  "mqtt-connection": "^4.1.0"
22
23
  },
@@ -26,10 +27,11 @@
26
27
  "@alcalzone/release-script-plugin-license": "^5.2.2",
27
28
  "@alcalzone/release-script-plugin-manual-review": "^5.2.0",
28
29
  "@iobroker/adapter-dev": "^1.5.0",
30
+ "@iobroker/build-tools": "^3.0.3",
29
31
  "@iobroker/eslint-config": "^2.3.4",
30
- "@iobroker/testing": "^5.3.0",
32
+ "@iobroker/testing": "^6.1.0",
31
33
  "@iobroker/types": "^7.2.2",
32
- "@tsconfig/node22": "^22.0.5",
34
+ "@tsconfig/node22": "^22.0.6",
33
35
  "typescript": "~6.0.3"
34
36
  },
35
37
  "bugs": {
@@ -43,12 +45,13 @@
43
45
  "LICENSE"
44
46
  ],
45
47
  "scripts": {
46
- "test:unit": "mocha test/bridge.js test/checkStates.js --exit",
48
+ "test:unit": "mocha test/bridge.js test/checkStates.js test/deviceManager.js --exit",
47
49
  "test:integration": "mocha test/integration.js --exit",
48
50
  "test:package": "mocha test/testPackageFiles.js --exit",
49
51
  "test": "npm run test:unit && npm run test:integration",
50
52
  "lint": "eslint -c eslint.config.mjs",
51
- "build": "tsc -p tsconfig.build.json",
53
+ "build": "node tasks.js && npm run build:tsc",
54
+ "build:tsc": "tsc -p tsconfig.build.json",
52
55
  "release": "release-script",
53
56
  "release-patch": "release-script patch --yes",
54
57
  "release-minor": "release-script minor --yes",
@@ -56,7 +59,7 @@
56
59
  "update-packages": "npx -y npm-check-updates --upgrade"
57
60
  },
58
61
  "engines": {
59
- "node": ">=22"
62
+ "node": ">=22.19.0"
60
63
  },
61
64
  "license": "MIT"
62
65
  }