iobroker.mg-saic 0.1.4 → 0.3.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/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # ioBroker MG/SAIC
2
2
 
3
+
3
4
  [![NPM version](https://img.shields.io/npm/v/iobroker.mg-saic.svg)](https://www.npmjs.com/package/iobroker.mg-saic)
4
- [![Downloads](https://img.shields.io/npm/dm/iobroker.mg-saic.svg)](https://www.npmjs.com/package/iobroker.mg-saic)
5
+ ![Number of Installations](http://iobroker.live/badges/mg-saic-stable.svg)
6
+ ![Number of Installations](http://iobroker.live/badges/mg-saic-installed.svg)
5
7
 
6
8
  <img src="admin/MG.png" alt="MG" width="314">
7
9
 
@@ -15,36 +17,49 @@ For manufacturer information, see [MG Motor](https://www.mgmotor.eu/) and [SAIC
15
17
 
16
18
  - Node.js 22.22.2 or later is required.
17
19
  - ioBroker js-controller 7.2.2 or later is required.
18
- - ioBroker Admin 8.2.0 or later is required.
20
+ - ioBroker Admin 8.3.15 or later is required.
19
21
  - Use an iSmart account that has access to the vehicle. A separate account shared with the vehicle is recommended to avoid interfering with the mobile app session.
20
- - Have the account password ready. The adapter stores it as a protected setting.
22
+ - Create or select a custom Login/Password credential in ioBroker's credential store. Use the iSmart email address or phone number as its login.
21
23
  - Select the region for the account. Available regions are European Union, China, Australia, Brazil, Israel, Turkey, Thailand, and Rest of World. India is not supported.
22
24
 
23
25
  ### Configure the adapter
24
26
 
25
27
  1. Install the adapter and create an instance in ioBroker Admin.
26
- 2. Select the account region and login type (email or phone number).
27
- 3. Enter the account's email address or phone number and password. For phone login, also enter the phone country calling code.
28
- 4. Set the status polling interval to 60 seconds or more. The default is 1800 seconds.
29
- 5. Save the settings and start the instance. Vehicles available to the account appear under `vehicles.<VIN>`.
30
- Existing vehicle object IDs are reused if the cloud API changes the VIN casing. Device labels use the localized generic vehicle name; the VIN, brand, model, and other available vehicle metadata are provided as read-only states.
28
+ 2. Select the account region, login type (email or phone number), and the matching custom Login/Password credential from the credential store. The credential's login must be the iSmart email address or phone number; the password is stored centrally. For phone login, also enter the phone country calling code in the adapter settings.
29
+ 3. Set the status polling interval to 60 seconds or more. The default is 1800 seconds.
30
+ 4. Save the settings and start the instance. Vehicles available to the account appear under `vehicles.<VIN>`.
31
+ Existing vehicle object IDs are reused if the cloud API changes the VIN casing. Device labels use the localized generic vehicle name; the VIN, brand, model, and other available vehicle metadata are provided as read-only states. The read-only text state `vehicles.<VIN>.commands.lastCommand` reports the SAIC API's response to the most recent command or action. The matching boolean state `vehicles.<VIN>.commands.lastCommandSucceeded` is `true` when the API accepts the request and returns a successful result; it is `false` while a request is in progress or after an API failure. The last result is retained across adapter restarts. This reflects SAIC's API response and does not independently verify that the vehicle physically completed the action. If the adapter stops before recording a response, startup marks the request as interrupted with an unknown outcome and sets `lastCommandSucceeded` to `false`.
32
+
33
+ The adapter does not import previously saved native login or password values. On startup it clears those deprecated fields; configure a central Login/Password credential before the adapter can connect.
31
34
 
32
35
  ## Features
33
36
 
34
37
  - Connects ioBroker to the iSmart cloud service and retrieves vehicle status.
35
38
  - Provides remote controls for supported vehicle functions.
39
+ - Reports whether the SAIC API accepted remote commands, settings actions, and seat-heating changes and returned a successful result. Each vehicle's read-only `commands.lastCommand` text state describes the API response, while `commands.lastCommandSucceeded` is `true` on API success and `false` while the request is pending or after failure, or when an interrupted request has an unknown outcome. This is confirmation from SAIC's API and does not independently verify physical completion by the vehicle.
36
40
  - Supports climate, heating, and charging features where available for the vehicle.
37
41
  - Omits unrecognized free-form charging text while retaining numeric measurements and validated charging-point identifiers.
38
42
 
39
43
  ## Installation
40
44
 
41
- The adapter is published on npm and available from ioBroker's Latest adapter repository.
45
+ The adapter is published on npm and available from ioBroker's Stable adapter repository.
42
46
 
43
47
  ## Support
44
48
 
45
- [![Donate](https://camo.githubusercontent.com/ef8c60305542390406855547e32850909812a73c4abada236de22a6dc88b313f/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f64655f44452f44452f692f62746e2f62746e5f646f6e61746543435f4c472e676966)](https://www.paypal.com/donate/?hosted_button_id=3RJQGSJNRSHUJ)
49
+ <a href="https://www.paypal.com/donate/?hosted_button_id=3RJQGSJNRSHUJ">
50
+ <img src=".github/Donate_eng.png" alt="Mit PayPal spenden" width="220">
51
+ </a>
46
52
 
47
53
  ## Changelog
54
+
55
+ ### 0.3.0 (2026-11-28)
56
+
57
+ - (Voodoo2man) Reported SAIC API acceptance and success results for commands through text and boolean feedback states.
58
+
59
+ ### 0.2.0 (2026-11-28)
60
+
61
+ - (Voodoo2man) Moved iSmart credentials to ioBroker's credential store; existing users must create a new Login/Password credential and re-enter their login details.
62
+
48
63
  ### 0.1.4 (2026-11-11)
49
64
 
50
65
  - (Voodoo2man) Corrected command-response validation, status values, charging-field handling, vehicle ID reuse, and cloud polling intervals; removed the non-informative vehicle name state.
@@ -59,17 +74,6 @@ The adapter is published on npm and available from ioBroker's Latest adapter rep
59
74
  - (Voodoo2man) Replaced untrusted cloud error text with English code-based diagnostics and standardized the product title as MG/SAIC across locales.
60
75
  - (Voodoo2man) Reused dynamic charging datapoints across field-name casing changes and normalized known status fields.
61
76
 
62
- ### 0.1.1 (2026-11-07)
63
-
64
- - (Voodoo2man) Lowered the minimum Node.js requirement to 22.22.2.
65
- - (Voodoo2man) Improved charging datapoint labels and units, enforced safe polling interval limits, and added manufacturer references.
66
-
67
- ### 0.1.0 (2026-11-01)
68
-
69
- - (Voodoo2man) Reported real-time charging power in kW using the pack current and voltage.
70
- - (Voodoo2man) Applied confirmed profile-specific charging conversions.
71
- - (Voodoo2man) Calculated available battery energy from battery level and usable capacity.
72
-
73
77
  Older changelog entries are available in [CHANGELOG_OLD.md](CHANGELOG_OLD.md).
74
78
 
75
79
  ## License
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "iSmart-Konto",
3
3
  "Cloud connection": "Cloud-Verbindung",
4
4
  "Account credentials": "Kontozugangsdaten",
5
+ "iSmart login credential": "iSmart-Anmeldezugang",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Wählen Sie einen Login/Passwort-Zugang aus oder erstellen Sie einen. Der Login muss zum oben gewählten Anmeldetyp passen.",
5
7
  "Status updates": "Statusaktualisierung",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Um mögliche Konflikte mit der mobilen App zu vermeiden, verwenden Sie nach Möglichkeit ein separates iSmart-Konto für ioBroker. Teilen Sie das Fahrzeug mit diesem Konto und erteilen Sie die für die gewünschte Nutzung erforderlichen Berechtigungen.",
7
9
  "Region": "Region",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Anmeldetyp",
17
19
  "Email": "E-Mail",
18
20
  "Phone number": "Telefonnummer",
19
- "Email address or phone number": "E-Mail-Adresse oder Telefonnummer",
20
21
  "Phone country calling code": "Internationale Ländervorwahl",
21
- "Password": "Passwort",
22
22
  "Status polling interval (seconds)": "Status-Abrufintervall (Sekunden)"
23
- }
23
+ }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "iSmart account",
3
3
  "Cloud connection": "Cloud connection",
4
4
  "Account credentials": "Account credentials",
5
+ "iSmart login credential": "iSmart login credential",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Select or create a Login/Password credential. The login must match the login type selected above.",
5
7
  "Status updates": "Status updates",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.",
7
9
  "Region": "Region",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Login type",
17
19
  "Email": "Email",
18
20
  "Phone number": "Phone number",
19
- "Email address or phone number": "Email address or phone number",
20
21
  "Phone country calling code": "Phone country calling code",
21
- "Password": "Password",
22
22
  "Status polling interval (seconds)": "Status polling interval (seconds)"
23
- }
23
+ }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Cuenta iSmart",
3
3
  "Cloud connection": "Conexión a la nube",
4
4
  "Account credentials": "Credenciales de la cuenta",
5
+ "iSmart login credential": "Credencial de acceso de iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Seleccione o cree una credencial Login/Password. El login debe coincidir con el tipo seleccionado arriba.",
5
7
  "Status updates": "Actualizaciones de estado",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Para evitar posibles interferencias de sesión con la aplicación móvil, utiliza una cuenta iSmart independiente para ioBroker siempre que sea posible. Comparte el vehículo con esa cuenta y concede los permisos necesarios para el uso previsto.",
7
9
  "Region": "Región",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Tipo de inicio de sesión",
17
19
  "Email": "Correo electrónico",
18
20
  "Phone number": "Número de teléfono",
19
- "Email address or phone number": "Dirección de correo electrónico o número de teléfono",
20
21
  "Phone country calling code": "Prefijo telefónico internacional",
21
- "Password": "Contraseña",
22
22
  "Status polling interval (seconds)": "Intervalo de consulta del estado (segundos)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Compte iSmart",
3
3
  "Cloud connection": "Connexion au cloud",
4
4
  "Account credentials": "Identifiants du compte",
5
+ "iSmart login credential": "Identifiant de connexion iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Sélectionnez ou créez un identifiant Login/Password. Le login doit correspondre au type choisi ci-dessus.",
5
7
  "Status updates": "Mises à jour du statut",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Pour éviter toute interférence de session avec l'application mobile, utilisez si possible un compte iSmart distinct pour ioBroker. Partagez le véhicule avec ce compte et accordez les autorisations nécessaires à l'utilisation souhaitée.",
7
9
  "Region": "Région",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Type de connexion",
17
19
  "Email": "E-mail",
18
20
  "Phone number": "Numéro de téléphone",
19
- "Email address or phone number": "Adresse e-mail ou numéro de téléphone",
20
21
  "Phone country calling code": "Indicatif téléphonique international",
21
- "Password": "Mot de passe",
22
22
  "Status polling interval (seconds)": "Intervalle d'interrogation du statut (secondes)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Account iSmart",
3
3
  "Cloud connection": "Connessione cloud",
4
4
  "Account credentials": "Credenziali dell'account",
5
+ "iSmart login credential": "Credenziale di accesso iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Seleziona o crea una credenziale Login/Password. Il login deve corrispondere al tipo scelto sopra.",
5
7
  "Status updates": "Aggiornamenti dello stato",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Per evitare possibili interferenze di sessione con l'app mobile, utilizza, se possibile, un account iSmart separato per ioBroker. Condividi il veicolo con quell'account e concedi le autorizzazioni necessarie per l'uso previsto.",
7
9
  "Region": "Regione",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Tipo di accesso",
17
19
  "Email": "E-mail",
18
20
  "Phone number": "Numero di telefono",
19
- "Email address or phone number": "Indirizzo e-mail o numero di telefono",
20
21
  "Phone country calling code": "Prefisso telefonico internazionale",
21
- "Password": "Password",
22
22
  "Status polling interval (seconds)": "Intervallo di interrogazione dello stato (secondi)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "iSmart-account",
3
3
  "Cloud connection": "Cloudverbinding",
4
4
  "Account credentials": "Accountgegevens",
5
+ "iSmart login credential": "iSmart-inloggegevens",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Selecteer of maak een Login/Password-referentie. De login moet overeenkomen met het hierboven geselecteerde inlogtype.",
5
7
  "Status updates": "Statusupdates",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Gebruik waar mogelijk een apart iSmart-account voor ioBroker om mogelijke sessieproblemen met de mobiele app te voorkomen. Deel het voertuig met dat account en verleen de benodigde rechten voor het beoogde gebruik.",
7
9
  "Region": "Regio",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Aanmeldtype",
17
19
  "Email": "E-mailadres",
18
20
  "Phone number": "Telefoonnummer",
19
- "Email address or phone number": "E-mailadres of telefoonnummer",
20
21
  "Phone country calling code": "Internationale landcode",
21
- "Password": "Wachtwoord",
22
22
  "Status polling interval (seconds)": "Interval voor statusopvraging (seconden)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Konto iSmart",
3
3
  "Cloud connection": "Połączenie z chmurą",
4
4
  "Account credentials": "Dane logowania do konta",
5
+ "iSmart login credential": "Dane logowania iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Wybierz lub utwórz poświadczenie Login/Password. Login musi odpowiadać wybranemu powyżej typowi logowania.",
5
7
  "Status updates": "Aktualizacje statusu",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Aby uniknąć możliwych konfliktów sesji z aplikacją mobilną, w miarę możliwości użyj osobnego konta iSmart dla ioBroker. Udostępnij temu kontu pojazd i nadaj uprawnienia wymagane do planowanego użycia.",
7
9
  "Region": "Region",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Typ logowania",
17
19
  "Email": "E-mail",
18
20
  "Phone number": "Numer telefonu",
19
- "Email address or phone number": "Adres e-mail lub numer telefonu",
20
21
  "Phone country calling code": "Międzynarodowy numer kierunkowy kraju",
21
- "Password": "Hasło",
22
22
  "Status polling interval (seconds)": "Interwał pobierania statusu (sekundy)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Conta iSmart",
3
3
  "Cloud connection": "Ligação à nuvem",
4
4
  "Account credentials": "Credenciais da conta",
5
+ "iSmart login credential": "Credencial de início de sessão iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Selecione ou crie uma credencial Login/Password. O login tem de corresponder ao tipo selecionado acima.",
5
7
  "Status updates": "Atualizações de estado",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Para evitar possíveis interferências de sessão com a aplicação móvel, utilize, sempre que possível, uma conta iSmart separada para o ioBroker. Partilhe o veículo com essa conta e conceda as permissões necessárias para a utilização pretendida.",
7
9
  "Region": "Região",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Tipo de início de sessão",
17
19
  "Email": "E-mail",
18
20
  "Phone number": "Número de telefone",
19
- "Email address or phone number": "Endereço de e-mail ou número de telefone",
20
21
  "Phone country calling code": "Indicativo internacional do país",
21
- "Password": "Palavra-passe",
22
22
  "Status polling interval (seconds)": "Intervalo de consulta do estado (segundos)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Учетная запись iSmart",
3
3
  "Cloud connection": "Подключение к облаку",
4
4
  "Account credentials": "Данные учетной записи",
5
+ "iSmart login credential": "Учетные данные iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Выберите или создайте учетные данные типа Login/Password. Логин должен соответствовать выбранному выше типу входа.",
5
7
  "Status updates": "Обновление статуса",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Чтобы избежать возможных конфликтов сеанса с мобильным приложением, по возможности используйте отдельную учетную запись iSmart для ioBroker. Предоставьте этой учетной записи доступ к автомобилю и необходимые для использования разрешения.",
7
9
  "Region": "Регион",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Тип входа",
17
19
  "Email": "Электронная почта",
18
20
  "Phone number": "Номер телефона",
19
- "Email address or phone number": "Адрес электронной почты или номер телефона",
20
21
  "Phone country calling code": "Международный телефонный код страны",
21
- "Password": "Пароль",
22
22
  "Status polling interval (seconds)": "Интервал опроса статуса (секунды)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "Обліковий запис iSmart",
3
3
  "Cloud connection": "Підключення до хмари",
4
4
  "Account credentials": "Облікові дані облікового запису",
5
+ "iSmart login credential": "Облікові дані iSmart",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "Виберіть або створіть облікові дані Login/Password. Логін має відповідати вибраному вище типу входу.",
5
7
  "Status updates": "Оновлення стану",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "Щоб уникнути можливих конфліктів сеансів із мобільним застосунком, за можливості використовуйте окремий обліковий запис iSmart для ioBroker. Надайте йому доступ до автомобіля та необхідні для використання дозволи.",
7
9
  "Region": "Регіон",
@@ -16,8 +18,6 @@
16
18
  "Login type": "Тип входу",
17
19
  "Email": "Електронна пошта",
18
20
  "Phone number": "Номер телефону",
19
- "Email address or phone number": "Адреса електронної пошти або номер телефону",
20
21
  "Phone country calling code": "Міжнародний телефонний код країни",
21
- "Password": "Пароль",
22
22
  "Status polling interval (seconds)": "Інтервал опитування стану (секунди)"
23
23
  }
@@ -2,6 +2,8 @@
2
2
  "iSmart account": "iSmart 账户",
3
3
  "Cloud connection": "云连接",
4
4
  "Account credentials": "账户凭据",
5
+ "iSmart login credential": "iSmart 登录凭据",
6
+ "Select or create a Login/Password credential. The login must match the login type selected above.": "选择或创建 Login/Password 凭据。登录名必须与上方选择的登录类型相匹配。",
5
7
  "Status updates": "状态更新",
6
8
  "To avoid possible session interference with the mobile app, use a separate iSmart account for ioBroker where possible. Share the vehicle with that account and grant the permissions needed for your intended use.": "为避免与手机应用的会话发生冲突,请尽可能为 ioBroker 使用单独的 iSmart 账户。将车辆共享给该账户,并授予预期用途所需的权限。",
7
9
  "Region": "地区",
@@ -16,8 +18,6 @@
16
18
  "Login type": "登录类型",
17
19
  "Email": "电子邮箱",
18
20
  "Phone number": "电话号码",
19
- "Email address or phone number": "电子邮箱地址或电话号码",
20
21
  "Phone country calling code": "国际电话区号",
21
- "Password": "密码",
22
22
  "Status polling interval (seconds)": "状态轮询间隔(秒)"
23
23
  }
@@ -68,10 +68,20 @@
68
68
  "xs": 12,
69
69
  "sm": 12
70
70
  },
71
- "accountIdentifier": {
72
- "type": "text",
73
- "label": "Email address or phone number",
74
- "maxLength": 254,
71
+ "_credentialHelp": {
72
+ "type": "staticText",
73
+ "text": "Select or create a Login/Password credential. The login must match the login type selected above.",
74
+ "xs": 12,
75
+ "sm": 12,
76
+ "md": 12,
77
+ "lg": 12,
78
+ "xl": 12
79
+ },
80
+ "credentialId": {
81
+ "type": "credential",
82
+ "label": "iSmart login credential",
83
+ "credentialType": "custom",
84
+ "disableCreation": false,
75
85
  "xs": 12,
76
86
  "sm": 12,
77
87
  "md": 6,
@@ -89,16 +99,6 @@
89
99
  "lg": 6,
90
100
  "xl": 6
91
101
  },
92
- "password": {
93
- "type": "password",
94
- "label": "Password",
95
- "visible": false,
96
- "xs": 12,
97
- "sm": 12,
98
- "md": 6,
99
- "lg": 6,
100
- "xl": 6
101
- },
102
102
  "_statusHeader": {
103
103
  "type": "header",
104
104
  "text": "Status updates",
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var command_feedback_exports = {};
20
+ __export(command_feedback_exports, {
21
+ CommandFeedbackSequence: () => CommandFeedbackSequence,
22
+ findInProgressCommandFeedback: () => findInProgressCommandFeedback,
23
+ formatCommandFeedback: () => formatCommandFeedback,
24
+ isCommandSuccessful: () => isCommandSuccessful
25
+ });
26
+ module.exports = __toCommonJS(command_feedback_exports);
27
+ var import_runtime_translations = require("./runtime-translations");
28
+ const feedbackTranslationKeys = {
29
+ inProgress: "commandFeedbackInProgress",
30
+ apiConfirmed: "commandFeedbackApiConfirmed",
31
+ failed: "commandFeedbackFailed",
32
+ interrupted: "commandFeedbackInterrupted"
33
+ };
34
+ const commandSucceeded = {
35
+ inProgress: false,
36
+ apiConfirmed: true,
37
+ failed: false,
38
+ interrupted: false
39
+ };
40
+ class CommandFeedbackSequence {
41
+ currentAttemptByVehicle = /* @__PURE__ */ new Map();
42
+ pendingWritesByVehicle = /* @__PURE__ */ new Map();
43
+ /**
44
+ * Starts a new feedback generation for a vehicle.
45
+ *
46
+ * @param vin Vehicle identifier.
47
+ */
48
+ beginAttempt(vin) {
49
+ var _a;
50
+ const key = vin.toLowerCase();
51
+ const attempt = ((_a = this.currentAttemptByVehicle.get(key)) != null ? _a : 0) + 1;
52
+ this.currentAttemptByVehicle.set(key, attempt);
53
+ return attempt;
54
+ }
55
+ /**
56
+ * Serializes state writes and skips feedback from superseded attempts.
57
+ *
58
+ * @param vin Vehicle identifier.
59
+ * @param attempt Generation returned by {@link beginAttempt}.
60
+ * @param write Asynchronous state-write operation.
61
+ */
62
+ writeIfCurrent(vin, attempt, write) {
63
+ var _a;
64
+ const key = vin.toLowerCase();
65
+ const previous = (_a = this.pendingWritesByVehicle.get(key)) != null ? _a : Promise.resolve();
66
+ const next = previous.catch(() => void 0).then(async () => {
67
+ if (this.currentAttemptByVehicle.get(key) === attempt) {
68
+ await write();
69
+ }
70
+ });
71
+ this.pendingWritesByVehicle.set(key, next);
72
+ return next;
73
+ }
74
+ }
75
+ function isCommandSuccessful(status) {
76
+ return commandSucceeded[status];
77
+ }
78
+ function formatCommandFeedback(commandId, status, language) {
79
+ var _a;
80
+ const selectedLanguage = (_a = import_runtime_translations.supportedLanguages.find((item) => item === language)) != null ? _a : "en";
81
+ const commandName = (0, import_runtime_translations.getRuntimeName)(commandId)[selectedLanguage];
82
+ return (0, import_runtime_translations.getRuntimeName)(feedbackTranslationKeys[status])[selectedLanguage].replace("%s", commandName);
83
+ }
84
+ function findInProgressCommandFeedback(feedbackValue, commandIds) {
85
+ if (typeof feedbackValue !== "string") {
86
+ return void 0;
87
+ }
88
+ for (const commandId of commandIds) {
89
+ if (import_runtime_translations.supportedLanguages.some(
90
+ (language) => formatCommandFeedback(commandId, "inProgress", language) === feedbackValue
91
+ )) {
92
+ return commandId;
93
+ }
94
+ }
95
+ return void 0;
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ CommandFeedbackSequence,
100
+ findInProgressCommandFeedback,
101
+ formatCommandFeedback,
102
+ isCommandSuccessful
103
+ });
104
+ //# sourceMappingURL=command-feedback.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/command-feedback.ts"],
4
+ "sourcesContent": ["import { getRuntimeName, supportedLanguages, type SupportedLanguage } from './runtime-translations';\n\nexport type CommandFeedbackStatus = 'inProgress' | 'apiConfirmed' | 'failed' | 'interrupted';\n\nconst feedbackTranslationKeys: Record<CommandFeedbackStatus, string> = {\n\tinProgress: 'commandFeedbackInProgress',\n\tapiConfirmed: 'commandFeedbackApiConfirmed',\n\tfailed: 'commandFeedbackFailed',\n\tinterrupted: 'commandFeedbackInterrupted',\n};\n\nconst commandSucceeded: Record<CommandFeedbackStatus, boolean> = {\n\tinProgress: false,\n\tapiConfirmed: true,\n\tfailed: false,\n\tinterrupted: false,\n};\n\n/** Tracks and serializes per-vehicle command feedback attempts. */\nexport class CommandFeedbackSequence {\n\tprivate readonly currentAttemptByVehicle = new Map<string, number>();\n\tprivate readonly pendingWritesByVehicle = new Map<string, Promise<void>>();\n\n\t/**\n\t * Starts a new feedback generation for a vehicle.\n\t *\n\t * @param vin Vehicle identifier.\n\t */\n\tpublic beginAttempt(vin: string): number {\n\t\tconst key = vin.toLowerCase();\n\t\tconst attempt = (this.currentAttemptByVehicle.get(key) ?? 0) + 1;\n\t\tthis.currentAttemptByVehicle.set(key, attempt);\n\t\treturn attempt;\n\t}\n\n\t/**\n\t * Serializes state writes and skips feedback from superseded attempts.\n\t *\n\t * @param vin Vehicle identifier.\n\t * @param attempt Generation returned by {@link beginAttempt}.\n\t * @param write Asynchronous state-write operation.\n\t */\n\tpublic writeIfCurrent(vin: string, attempt: number, write: () => Promise<void>): Promise<void> {\n\t\tconst key = vin.toLowerCase();\n\t\tconst previous = this.pendingWritesByVehicle.get(key) ?? Promise.resolve();\n\t\tconst next = previous\n\t\t\t.catch(() => undefined)\n\t\t\t.then(async () => {\n\t\t\t\tif (this.currentAttemptByVehicle.get(key) === attempt) {\n\t\t\t\t\tawait write();\n\t\t\t\t}\n\t\t\t});\n\t\tthis.pendingWritesByVehicle.set(key, next);\n\t\treturn next;\n\t}\n}\n\n/**\n * Returns whether SAIC confirmed the command API action.\n *\n * @param status Feedback status.\n */\nexport function isCommandSuccessful(status: CommandFeedbackStatus): boolean {\n\treturn commandSucceeded[status];\n}\n\n/**\n * Formats command feedback from trusted translation keys, without including API response content.\n *\n * @param commandId Runtime translation key for the command or action.\n * @param status Feedback status.\n * @param language Configured ioBroker language.\n */\nexport function formatCommandFeedback(commandId: string, status: CommandFeedbackStatus, language: string): string {\n\tconst selectedLanguage: SupportedLanguage = supportedLanguages.find(item => item === language) ?? 'en';\n\tconst commandName = getRuntimeName(commandId)[selectedLanguage];\n\treturn getRuntimeName(feedbackTranslationKeys[status])[selectedLanguage].replace('%s', commandName);\n}\n\n/**\n * Finds an unfinished feedback value regardless of the language used when it was written.\n *\n * @param feedbackValue Persisted last-command text.\n * @param commandIds Runtime translation keys that can identify a command attempt.\n */\nexport function findInProgressCommandFeedback(\n\tfeedbackValue: unknown,\n\tcommandIds: readonly string[],\n): string | undefined {\n\tif (typeof feedbackValue !== 'string') {\n\t\treturn undefined;\n\t}\n\tfor (const commandId of commandIds) {\n\t\tif (\n\t\t\tsupportedLanguages.some(\n\t\t\t\tlanguage => formatCommandFeedback(commandId, 'inProgress', language) === feedbackValue,\n\t\t\t)\n\t\t) {\n\t\t\treturn commandId;\n\t\t}\n\t}\n\treturn undefined;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAA2E;AAI3E,MAAM,0BAAiE;AAAA,EACtE,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AACd;AAEA,MAAM,mBAA2D;AAAA,EAChE,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AACd;AAGO,MAAM,wBAAwB;AAAA,EACnB,0BAA0B,oBAAI,IAAoB;AAAA,EAClD,yBAAyB,oBAAI,IAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlE,aAAa,KAAqB;AA5B1C;AA6BE,UAAM,MAAM,IAAI,YAAY;AAC5B,UAAM,YAAW,UAAK,wBAAwB,IAAI,GAAG,MAApC,YAAyC,KAAK;AAC/D,SAAK,wBAAwB,IAAI,KAAK,OAAO;AAC7C,WAAO;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,eAAe,KAAa,SAAiB,OAA2C;AA1ChG;AA2CE,UAAM,MAAM,IAAI,YAAY;AAC5B,UAAM,YAAW,UAAK,uBAAuB,IAAI,GAAG,MAAnC,YAAwC,QAAQ,QAAQ;AACzE,UAAM,OAAO,SACX,MAAM,MAAM,MAAS,EACrB,KAAK,YAAY;AACjB,UAAI,KAAK,wBAAwB,IAAI,GAAG,MAAM,SAAS;AACtD,cAAM,MAAM;AAAA,MACb;AAAA,IACD,CAAC;AACF,SAAK,uBAAuB,IAAI,KAAK,IAAI;AACzC,WAAO;AAAA,EACR;AACD;AAOO,SAAS,oBAAoB,QAAwC;AAC3E,SAAO,iBAAiB,MAAM;AAC/B;AASO,SAAS,sBAAsB,WAAmB,QAA+B,UAA0B;AAzElH;AA0EC,QAAM,oBAAsC,oDAAmB,KAAK,UAAQ,SAAS,QAAQ,MAAjD,YAAsD;AAClG,QAAM,kBAAc,4CAAe,SAAS,EAAE,gBAAgB;AAC9D,aAAO,4CAAe,wBAAwB,MAAM,CAAC,EAAE,gBAAgB,EAAE,QAAQ,MAAM,WAAW;AACnG;AAQO,SAAS,8BACf,eACA,YACqB;AACrB,MAAI,OAAO,kBAAkB,UAAU;AACtC,WAAO;AAAA,EACR;AACA,aAAW,aAAa,YAAY;AACnC,QACC,+CAAmB;AAAA,MAClB,cAAY,sBAAsB,WAAW,cAAc,QAAQ,MAAM;AAAA,IAC1E,GACC;AACD,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AACR;",
6
+ "names": []
7
+ }
package/build/config.js CHANGED
@@ -42,15 +42,12 @@ function validateConfig(config) {
42
42
  if (config.accountType !== "email" && config.accountType !== "phone") {
43
43
  errors.push("Login type must be email or phone");
44
44
  }
45
- if (!((_b = config.accountIdentifier) == null ? void 0 : _b.trim())) {
46
- errors.push("Email address or phone number is required");
45
+ if (!((_b = config.credentialId) == null ? void 0 : _b.trim())) {
46
+ errors.push("An ioBroker Login/Password credential is required");
47
47
  }
48
48
  if (config.accountType === "phone" && !((_c = config.phoneCountryCode) == null ? void 0 : _c.trim())) {
49
49
  errors.push("Phone country calling code is required");
50
50
  }
51
- if (!config.password) {
52
- errors.push("Password is required");
53
- }
54
51
  return errors;
55
52
  }
56
53
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/config.ts"],
4
- "sourcesContent": ["import { isIndiaRegion, resolveSaicRegion } from './regions';\n\n/** Settings entered for one iSmart account and backend. */\nexport interface MgSaicConfig {\n\t/** Automatic status polling interval in seconds. */\n\tpollIntervalSeconds?: number;\n\t/** Backend region code. */\n\tregion?: string;\n\t/** Whether the account identifier is an email address or phone number. */\n\taccountType?: string;\n\t/** Email address or phone number used to sign in. */\n\taccountIdentifier?: string;\n\t/** International calling code when using a phone account. */\n\tphoneCountryCode?: string;\n\t/** Account password, decrypted by ioBroker for the adapter process. */\n\tpassword?: string;\n}\n\nexport const DEFAULT_POLL_INTERVAL_SECONDS = 1800;\nexport const MAX_POLL_INTERVAL_SECONDS = 2_147_483;\n\n/**\n * Returns configuration problems without logging any credential values.\n *\n * @param config The instance's native configuration.\n */\nexport function validateConfig(config: MgSaicConfig): string[] {\n\tconst errors: string[] = [];\n\tif (\n\t\tconfig.pollIntervalSeconds !== undefined &&\n\t\t(!Number.isInteger(config.pollIntervalSeconds) ||\n\t\t\tconfig.pollIntervalSeconds < 60 ||\n\t\t\tconfig.pollIntervalSeconds > MAX_POLL_INTERVAL_SECONDS)\n\t) {\n\t\terrors.push(`Polling interval must be an integer between 60 and ${MAX_POLL_INTERVAL_SECONDS} seconds`);\n\t}\n\tif (!config.region?.trim()) {\n\t\terrors.push('Region/backend code is required');\n\t} else if (isIndiaRegion(config.region)) {\n\t\terrors.push('India TAP connectivity is not implemented yet');\n\t} else if (!resolveSaicRegion(config.region)) {\n\t\terrors.push('Unsupported SAIC region');\n\t}\n\tif (config.accountType !== 'email' && config.accountType !== 'phone') {\n\t\terrors.push('Login type must be email or phone');\n\t}\n\tif (!config.accountIdentifier?.trim()) {\n\t\terrors.push('Email address or phone number is required');\n\t}\n\tif (config.accountType === 'phone' && !config.phoneCountryCode?.trim()) {\n\t\terrors.push('Phone country calling code is required');\n\t}\n\tif (!config.password) {\n\t\terrors.push('Password is required');\n\t}\n\treturn errors;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiD;AAkB1C,MAAM,gCAAgC;AACtC,MAAM,4BAA4B;AAOlC,SAAS,eAAe,QAAgC;AA1B/D;AA2BC,QAAM,SAAmB,CAAC;AAC1B,MACC,OAAO,wBAAwB,WAC9B,CAAC,OAAO,UAAU,OAAO,mBAAmB,KAC5C,OAAO,sBAAsB,MAC7B,OAAO,sBAAsB,4BAC7B;AACD,WAAO,KAAK,sDAAsD,yBAAyB,UAAU;AAAA,EACtG;AACA,MAAI,GAAC,YAAO,WAAP,mBAAe,SAAQ;AAC3B,WAAO,KAAK,iCAAiC;AAAA,EAC9C,eAAW,8BAAc,OAAO,MAAM,GAAG;AACxC,WAAO,KAAK,+CAA+C;AAAA,EAC5D,WAAW,KAAC,kCAAkB,OAAO,MAAM,GAAG;AAC7C,WAAO,KAAK,yBAAyB;AAAA,EACtC;AACA,MAAI,OAAO,gBAAgB,WAAW,OAAO,gBAAgB,SAAS;AACrE,WAAO,KAAK,mCAAmC;AAAA,EAChD;AACA,MAAI,GAAC,YAAO,sBAAP,mBAA0B,SAAQ;AACtC,WAAO,KAAK,2CAA2C;AAAA,EACxD;AACA,MAAI,OAAO,gBAAgB,WAAW,GAAC,YAAO,qBAAP,mBAAyB,SAAQ;AACvE,WAAO,KAAK,wCAAwC;AAAA,EACrD;AACA,MAAI,CAAC,OAAO,UAAU;AACrB,WAAO,KAAK,sBAAsB;AAAA,EACnC;AACA,SAAO;AACR;",
4
+ "sourcesContent": ["import { isIndiaRegion, resolveSaicRegion } from './regions';\n\n/** Settings entered for one iSmart account and backend. */\nexport interface MgSaicConfig {\n\t/** Automatic status polling interval in seconds. */\n\tpollIntervalSeconds?: number;\n\t/** Backend region code. */\n\tregion?: string;\n\t/** Whether the account identifier is an email address or phone number. */\n\taccountType?: string;\n\t/** Selected custom Login/Password credential in ioBroker's credential store. */\n\tcredentialId?: string;\n\t/** International calling code when using a phone account. */\n\tphoneCountryCode?: string;\n}\n\nexport const DEFAULT_POLL_INTERVAL_SECONDS = 1800;\nexport const MAX_POLL_INTERVAL_SECONDS = 2_147_483;\n\n/**\n * Returns configuration problems without logging any credential values.\n *\n * @param config The instance's native configuration.\n */\nexport function validateConfig(config: MgSaicConfig): string[] {\n\tconst errors: string[] = [];\n\tif (\n\t\tconfig.pollIntervalSeconds !== undefined &&\n\t\t(!Number.isInteger(config.pollIntervalSeconds) ||\n\t\t\tconfig.pollIntervalSeconds < 60 ||\n\t\t\tconfig.pollIntervalSeconds > MAX_POLL_INTERVAL_SECONDS)\n\t) {\n\t\terrors.push(`Polling interval must be an integer between 60 and ${MAX_POLL_INTERVAL_SECONDS} seconds`);\n\t}\n\tif (!config.region?.trim()) {\n\t\terrors.push('Region/backend code is required');\n\t} else if (isIndiaRegion(config.region)) {\n\t\terrors.push('India TAP connectivity is not implemented yet');\n\t} else if (!resolveSaicRegion(config.region)) {\n\t\terrors.push('Unsupported SAIC region');\n\t}\n\tif (config.accountType !== 'email' && config.accountType !== 'phone') {\n\t\terrors.push('Login type must be email or phone');\n\t}\n\tif (!config.credentialId?.trim()) {\n\t\terrors.push('An ioBroker Login/Password credential is required');\n\t}\n\tif (config.accountType === 'phone' && !config.phoneCountryCode?.trim()) {\n\t\terrors.push('Phone country calling code is required');\n\t}\n\treturn errors;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiD;AAgB1C,MAAM,gCAAgC;AACtC,MAAM,4BAA4B;AAOlC,SAAS,eAAe,QAAgC;AAxB/D;AAyBC,QAAM,SAAmB,CAAC;AAC1B,MACC,OAAO,wBAAwB,WAC9B,CAAC,OAAO,UAAU,OAAO,mBAAmB,KAC5C,OAAO,sBAAsB,MAC7B,OAAO,sBAAsB,4BAC7B;AACD,WAAO,KAAK,sDAAsD,yBAAyB,UAAU;AAAA,EACtG;AACA,MAAI,GAAC,YAAO,WAAP,mBAAe,SAAQ;AAC3B,WAAO,KAAK,iCAAiC;AAAA,EAC9C,eAAW,8BAAc,OAAO,MAAM,GAAG;AACxC,WAAO,KAAK,+CAA+C;AAAA,EAC5D,WAAW,KAAC,kCAAkB,OAAO,MAAM,GAAG;AAC7C,WAAO,KAAK,yBAAyB;AAAA,EACtC;AACA,MAAI,OAAO,gBAAgB,WAAW,OAAO,gBAAgB,SAAS;AACrE,WAAO,KAAK,mCAAmC;AAAA,EAChD;AACA,MAAI,GAAC,YAAO,iBAAP,mBAAqB,SAAQ;AACjC,WAAO,KAAK,mDAAmD;AAAA,EAChE;AACA,MAAI,OAAO,gBAAgB,WAAW,GAAC,YAAO,qBAAP,mBAAyB,SAAQ;AACvE,WAAO,KAAK,wCAAwC;AAAA,EACrD;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var credentials_exports = {};
20
+ __export(credentials_exports, {
21
+ clearDeprecatedNativeCredentials: () => clearDeprecatedNativeCredentials,
22
+ getLoginPasswordCredential: () => getLoginPasswordCredential
23
+ });
24
+ module.exports = __toCommonJS(credentials_exports);
25
+ function getLoginPasswordCredential(credential, getCredentialForm) {
26
+ if (credential.type !== "custom" || !credential.values || typeof credential.values !== "object") {
27
+ throw new Error("A custom Login/Password credential is required");
28
+ }
29
+ const values = credential.values;
30
+ if (getCredentialForm(values) !== "login" || typeof values.login !== "string" || !values.login.trim() || typeof values.password !== "string" || !values.password) {
31
+ throw new Error("The selected credential must contain a login and password");
32
+ }
33
+ return { accountIdentifier: values.login.trim(), password: values.password };
34
+ }
35
+ async function clearDeprecatedNativeCredentials(config, updateConfig) {
36
+ if (!config.accountIdentifier && !config.password) {
37
+ return true;
38
+ }
39
+ try {
40
+ await updateConfig({ accountIdentifier: "", password: "" });
41
+ config.accountIdentifier = "";
42
+ config.password = "";
43
+ return true;
44
+ } catch {
45
+ return false;
46
+ }
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ clearDeprecatedNativeCredentials,
51
+ getLoginPasswordCredential
52
+ });
53
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/credentials.ts"],
4
+ "sourcesContent": ["/** Login values supplied by a central ioBroker credential. */\nexport interface AccountLoginCredential {\n\t/** iSmart email address or phone number. */\n\taccountIdentifier: string;\n\t/** Password from the central credential store. */\n\tpassword: string;\n}\n\ninterface CredentialInfo {\n\ttype: string;\n\tvalues: unknown;\n}\n\n/**\n * Extracts the login and password from an ioBroker custom Login/Password credential.\n *\n * @param credential Credential returned by ioBroker's credential API.\n * @param getCredentialForm Resolves the form type for custom credentials.\n */\nexport function getLoginPasswordCredential(\n\tcredential: CredentialInfo,\n\tgetCredentialForm: (values: Record<string, unknown>) => string,\n): AccountLoginCredential {\n\tif (credential.type !== 'custom' || !credential.values || typeof credential.values !== 'object') {\n\t\tthrow new Error('A custom Login/Password credential is required');\n\t}\n\tconst values = credential.values as Record<string, unknown>;\n\tif (\n\t\tgetCredentialForm(values) !== 'login' ||\n\t\ttypeof values.login !== 'string' ||\n\t\t!values.login.trim() ||\n\t\ttypeof values.password !== 'string' ||\n\t\t!values.password\n\t) {\n\t\tthrow new Error('The selected credential must contain a login and password');\n\t}\n\treturn { accountIdentifier: values.login.trim(), password: values.password };\n}\n\n/**\n * Clears deprecated native login fields only after their empty values are persisted.\n *\n * @param config The adapter's native instance configuration.\n * @param updateConfig Persists the cleared legacy values.\n * @returns Whether the legacy values are cleared or already absent.\n */\nexport async function clearDeprecatedNativeCredentials(\n\tconfig: Record<string, unknown>,\n\tupdateConfig: (changes: { accountIdentifier: string; password: string }) => Promise<unknown>,\n): Promise<boolean> {\n\tif (!config.accountIdentifier && !config.password) {\n\t\treturn true;\n\t}\n\ttry {\n\t\tawait updateConfig({ accountIdentifier: '', password: '' });\n\t\tconfig.accountIdentifier = '';\n\t\tconfig.password = '';\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBO,SAAS,2BACf,YACA,mBACyB;AACzB,MAAI,WAAW,SAAS,YAAY,CAAC,WAAW,UAAU,OAAO,WAAW,WAAW,UAAU;AAChG,UAAM,IAAI,MAAM,gDAAgD;AAAA,EACjE;AACA,QAAM,SAAS,WAAW;AAC1B,MACC,kBAAkB,MAAM,MAAM,WAC9B,OAAO,OAAO,UAAU,YACxB,CAAC,OAAO,MAAM,KAAK,KACnB,OAAO,OAAO,aAAa,YAC3B,CAAC,OAAO,UACP;AACD,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC5E;AACA,SAAO,EAAE,mBAAmB,OAAO,MAAM,KAAK,GAAG,UAAU,OAAO,SAAS;AAC5E;AASA,eAAsB,iCACrB,QACA,cACmB;AACnB,MAAI,CAAC,OAAO,qBAAqB,CAAC,OAAO,UAAU;AAClD,WAAO;AAAA,EACR;AACA,MAAI;AACH,UAAM,aAAa,EAAE,mBAAmB,IAAI,UAAU,GAAG,CAAC;AAC1D,WAAO,oBAAoB;AAC3B,WAAO,WAAW;AAClB,WAAO;AAAA,EACR,QAAQ;AACP,WAAO;AAAA,EACR;AACD;",
6
+ "names": []
7
+ }