poe-svelte-ui-lib 2.5.0 → 2.6.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.
@@ -308,18 +308,6 @@ const message = decodeWsEnvelope(cborToValue(new Uint8Array(event.data)))
308
308
 
309
309
  </details>
310
310
 
311
- <details>
312
- <summary>⏳ Переход со старого конверта {HDR, ARG, VAL} (временно)</summary>
313
-
314
- Прошивки до перехода шлют старый конверт `{HDR, ARG, VAL}`: `HDR` и `ARG` строками (`ARG` модуля за хабом - числом), флага ответа нет. Чтобы обновить все устройства удалённо через облако, облако один выпуск понимает оба формата.
315
-
316
- - `decodeLegacyWsEnvelope(packet, dictionary?)` разбирает старый конверт в ту же структуру `{ header, argument, code, reply, VAL }`. `reply` - по заголовку (`GET`/`SET` - да). Неизвестный заголовок, имя не из словаря, код вне 0..8191 или `VAL` не объект - `null`.
317
- - `encodeLegacyWsEnvelope(header, argument, VAL, dictionary?)` собирает ответ старому устройству: `ARG` - имя по словарю, код без имени - числом.
318
- - Порядок разбора в облаке: сначала `decodeWsEnvelope`, при `null` - `decodeLegacyWsEnvelope`. Устройству, приславшему старый конверт, облако отвечает старым конвертом.
319
- - ⚠️ Обе функции и тип `LegacyWsEnvelope` удаляются в следующем выпуске библиотеки, когда прошивки всех устройств будут на `{HAR, VAL}`.
320
-
321
- </details>
322
-
323
311
  <details>
324
312
  <summary>🔐 Аутентификация устройства в облаке (TOFU)</summary>
325
313
 
@@ -368,7 +356,7 @@ const message = decodeWsEnvelope(cborToValue(new Uint8Array(event.data)))
368
356
  | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- |
369
357
  | Пакет | `CBOR_PktEncInit`, `CBOR_PktEncAddRaw`, `CBOR_PACK`, `CBOR_PktEncFinish`, `CBOR_PktDecInit`, `CBOR_PktDecNext`, поток `CBOR_PktStreamPush` | `encodePacket`, `decodePacket`, `createPacketStreamParser`, `encodePacketBytesPayload` |
370
358
  | HAR | `har_t`, `HAR`, `HAR_NR`, коды `A_*` в `api_har.h` (имён в прошивке нет, лог печатает `HAR 0x%04X`) | `makeHar`, `splitHar`, `encodeHar`, `decodeHar`, `createDictionary`, `HEADER_CODES`, `DEFAULT_ARGUMENT_CODES` |
371
- | WS | `API_Service_ReceiveWsPacket`, `API_Service_BeginResponse` | `encodeWsEnvelope`, `decodeWsEnvelope` (переход: `decodeLegacyWsEnvelope`, `encodeLegacyWsEnvelope`) |
359
+ | WS | `API_Service_ReceiveWsPacket`, `API_Service_BeginResponse` | `encodeWsEnvelope`, `decodeWsEnvelope` |
372
360
  | Приём | `API_Service_ReceiveBusPacket`, `API_Service_ReceiveWsPacket`, консоль в `system_console` | `createXPoeDebugParser`, `createCanParser` |
373
361
  | Ответ | `API_Service_BeginResponse`, `Writer_*`, `API_Service_FinishResponse` | |
374
362
  | Консоль | `LOG_*`, `LOG_HEX`, `LOG_PLOT` | `encodeXPoeDebugFrame`, `xPoeDebugRow`, `xPoeDebugTableColumns`, `debugPlotValues` |
@@ -10,4 +10,3 @@ export { formatXPoeDebugValue, formatXPoeDebugPretty } from "./xPoeDebugView.js"
10
10
  export { CAN_FINAL_BIT, CAN_PACKET_ID_MASK, canFragments, encodeSlcanFrame, encodeCanPacket, createCanParser, slcanOpenCommands, type CanFrame, type CanMessage, } from "./can.js";
11
11
  export { HEADER_CODES, DEFAULT_ARGUMENT_CODES, DEFAULT_DICTIONARY, parseArgumentDictionary, createDictionary, encodeHar, decodeHar, type Dictionary, type HarParts, } from "./dictionary.js";
12
12
  export { encodeWsEnvelope, decodeWsEnvelope, type WsEnvelope, type WsMessage } from "./wsEnvelope.js";
13
- export { decodeLegacyWsEnvelope, encodeLegacyWsEnvelope, type LegacyWsEnvelope } from "./wsEnvelope.js";
@@ -20,5 +20,3 @@ export { CAN_FINAL_BIT, CAN_PACKET_ID_MASK, canFragments, encodeSlcanFrame, enco
20
20
  export { HEADER_CODES, DEFAULT_ARGUMENT_CODES, DEFAULT_DICTIONARY, parseArgumentDictionary, createDictionary, encodeHar, decodeHar, } from "./dictionary.js";
21
21
  /* Конверт WebSocket {HAR, VAL} на всех соединениях: сборка из заголовка и аргумента (имя или код), разбор в слова по словарю */
22
22
  export { encodeWsEnvelope, decodeWsEnvelope } from "./wsEnvelope.js";
23
- /* ВРЕМЕННО, переход (удаляется в следующем выпуске): старый конверт {HDR, ARG, VAL} прошивок до {HAR, VAL} - разбор в ту же структуру и сборка ответа старому устройству */
24
- export { decodeLegacyWsEnvelope, encodeLegacyWsEnvelope } from "./wsEnvelope.js";
@@ -8,10 +8,3 @@ export interface WsMessage<V = Record<string, unknown>> extends HarParts {
8
8
  }
9
9
  export declare const encodeWsEnvelope: <V>(header: string, argument: string | number, VAL: V, reply?: boolean, dictionary?: Dictionary) => WsEnvelope<V>;
10
10
  export declare const decodeWsEnvelope: <V extends object = Record<string, unknown>>(packet: unknown, dictionary?: Dictionary) => WsMessage<V> | null;
11
- export interface LegacyWsEnvelope<V = Record<string, unknown>> {
12
- HDR: string;
13
- ARG: string | number;
14
- VAL: V;
15
- }
16
- export declare const decodeLegacyWsEnvelope: <V extends object = Record<string, unknown>>(packet: unknown, dictionary?: Dictionary) => WsMessage<V> | null;
17
- export declare const encodeLegacyWsEnvelope: <V>(header: string, argument: string | number, VAL: V, dictionary?: Dictionary) => LegacyWsEnvelope<V>;
@@ -15,24 +15,3 @@ export const decodeWsEnvelope = (packet, dictionary = DEFAULT_DICTIONARY) => {
15
15
  return null;
16
16
  return { ...decodeHar(HAR, dictionary), VAL: VAL };
17
17
  };
18
- /* ВРЕМЕННО: старый конверт в ту же структуру, что decodeWsEnvelope; reply - как у запроса (GET/SET) или ответа (OK!/ER!). Неизвестный заголовок, имя аргумента не из словаря, код вне 0..8191, VAL не объект - null */
19
- export const decodeLegacyWsEnvelope = (packet, dictionary = DEFAULT_DICTIONARY) => {
20
- if (!packet || typeof packet !== "object")
21
- return null;
22
- const { HDR, ARG, VAL } = packet;
23
- if (typeof HDR !== "string" || !(typeof ARG === "string" || typeof ARG === "number"))
24
- return null;
25
- if (!VAL || typeof VAL !== "object" || Array.isArray(VAL))
26
- return null;
27
- try {
28
- return decodeWsEnvelope({ HAR: encodeHar(HDR, ARG, defaultReply(HDR), dictionary), VAL }, dictionary);
29
- }
30
- catch {
31
- return null;
32
- }
33
- };
34
- /* ВРЕМЕННО: старый конверт для устройства на старой прошивке: ARG - имя по словарю, код без имени - числом; неизвестный заголовок или имя - ошибка */
35
- export const encodeLegacyWsEnvelope = (header, argument, VAL, dictionary = DEFAULT_DICTIONARY) => {
36
- const { header: HDR, argument: name, code } = decodeHar(encodeHar(header, argument, false, dictionary), dictionary);
37
- return { HDR, ARG: name === String(code) ? code : name, VAL };
38
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Oleg-Perevyshin/ElementsUI.git"