@iobroker/js-controller-adapter 7.0.7-alpha.8-20250324-d7f4b9128 → 7.0.7
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/cjs/lib/_Types.d.ts +1 -1
- package/build/cjs/lib/adapter/adapter.d.ts +2 -2
- package/build/cjs/lib/adapter/adapter.js +17 -8
- package/build/cjs/lib/adapter/adapter.js.map +2 -2
- package/build/cjs/lib/adapter/utils.d.ts +23 -0
- package/build/cjs/lib/adapter/utils.js +97 -8
- package/build/cjs/lib/adapter/utils.js.map +2 -2
- package/build/esm/lib/_Types.d.ts +1 -1
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/adapter/adapter.d.ts +2 -2
- package/build/esm/lib/adapter/adapter.d.ts.map +1 -1
- package/build/esm/lib/adapter/adapter.js +21 -12
- package/build/esm/lib/adapter/adapter.js.map +1 -1
- package/build/esm/lib/adapter/utils.d.ts +23 -0
- package/build/esm/lib/adapter/utils.d.ts.map +1 -1
- package/build/esm/lib/adapter/utils.js +136 -6
- package/build/esm/lib/adapter/utils.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -10
|
@@ -282,7 +282,7 @@ export interface InternalGetCertificatesOptions {
|
|
|
282
282
|
export interface InternalUpdateConfigOptions {
|
|
283
283
|
newConfig: Record<string, any>;
|
|
284
284
|
}
|
|
285
|
-
export type GetEncryptedConfigCallback = (error: Error | null | undefined, result?: string) => void;
|
|
285
|
+
export type GetEncryptedConfigCallback = (error: Error | null | undefined, result?: string | string[]) => void;
|
|
286
286
|
export interface InternalGetEncryptedConfigOptions {
|
|
287
287
|
attribute: string;
|
|
288
288
|
callback?: GetEncryptedConfigCallback;
|
|
@@ -491,7 +491,7 @@ export declare class AdapterClass extends EventEmitter {
|
|
|
491
491
|
*
|
|
492
492
|
*/
|
|
493
493
|
disable(): ioBroker.SetObjectPromise;
|
|
494
|
-
getEncryptedConfig(attribute: string, callback?: GetEncryptedConfigCallback): Promise<string | void>;
|
|
494
|
+
getEncryptedConfig(attribute: string, callback?: GetEncryptedConfigCallback): Promise<string | string[] | void>;
|
|
495
495
|
private _getEncryptedConfig;
|
|
496
496
|
/**
|
|
497
497
|
* Get the system secret, after retrieved once it will be read from the cache
|
|
@@ -818,7 +818,7 @@ export declare class AdapterClass extends EventEmitter {
|
|
|
818
818
|
/**
|
|
819
819
|
* Initialize the adapter
|
|
820
820
|
*
|
|
821
|
-
* @param adapterConfig the AdapterOptions or the InstanceObject, is null/undefined if it is
|
|
821
|
+
* @param adapterConfig the AdapterOptions or the InstanceObject, is null/undefined if it is an installation process
|
|
822
822
|
*/
|
|
823
823
|
private _initAdapter;
|
|
824
824
|
/**
|
|
@@ -1358,7 +1358,7 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
1358
1358
|
mergedConfig = { ...oldConfig, ...newConfig };
|
|
1359
1359
|
}
|
|
1360
1360
|
obj.native = mergedConfig;
|
|
1361
|
-
return this.
|
|
1361
|
+
return this.setForeignObject(configObjId, obj);
|
|
1362
1362
|
}
|
|
1363
1363
|
/**
|
|
1364
1364
|
* Disables and stops the adapter instance.
|
|
@@ -1393,8 +1393,17 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
1393
1393
|
}
|
|
1394
1394
|
async _getEncryptedConfig(options) {
|
|
1395
1395
|
const { attribute, callback } = options;
|
|
1396
|
-
const value = this.config
|
|
1397
|
-
if (
|
|
1396
|
+
const value = (0, import_utils.getObjectAttribute)(this.config, attribute);
|
|
1397
|
+
if (Array.isArray(value)) {
|
|
1398
|
+
const secret = await this.getSystemSecret();
|
|
1399
|
+
const result = [];
|
|
1400
|
+
for (let i = 0; i < value.length; i++) {
|
|
1401
|
+
if (typeof value[i] === "string") {
|
|
1402
|
+
result[i] = import_js_controller_common.tools.decrypt(secret, value[i]);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
return import_js_controller_common.tools.maybeCallbackWithError(callback, null, result);
|
|
1406
|
+
} else if (typeof value === "string") {
|
|
1398
1407
|
const secret = await this.getSystemSecret();
|
|
1399
1408
|
return import_js_controller_common.tools.maybeCallbackWithError(callback, null, import_js_controller_common.tools.decrypt(secret, value));
|
|
1400
1409
|
}
|
|
@@ -2635,7 +2644,7 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
2635
2644
|
}
|
|
2636
2645
|
if (obj && "protectedNative" in obj && Array.isArray(obj.protectedNative) && obj.native && id && id.startsWith("system.adapter.") && !import_constants.NO_PROTECT_ADAPTERS.includes(this.name) && this.name !== id.split(".")[2]) {
|
|
2637
2646
|
for (const attr of obj.protectedNative) {
|
|
2638
|
-
|
|
2647
|
+
(0, import_utils.deleteObjectAttribute)(obj.native, attr);
|
|
2639
2648
|
}
|
|
2640
2649
|
}
|
|
2641
2650
|
}
|
|
@@ -2742,7 +2751,7 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
2742
2751
|
const obj = await this.#objects.getObjectAsync(options.id, options);
|
|
2743
2752
|
if (obj && "protectedNative" in obj && Array.isArray(obj.protectedNative) && obj._id && obj._id.startsWith("system.adapter.") && obj.native && !import_constants.NO_PROTECT_ADAPTERS.includes(this.name) && this.name !== obj._id.split(".")[2]) {
|
|
2744
2753
|
for (const attr of obj.protectedNative) {
|
|
2745
|
-
|
|
2754
|
+
(0, import_utils.deleteObjectAttribute)(obj.native, attr);
|
|
2746
2755
|
}
|
|
2747
2756
|
}
|
|
2748
2757
|
return import_js_controller_common.tools.maybeCallbackWithError(options.callback, null, obj);
|
|
@@ -7543,7 +7552,7 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
7543
7552
|
}
|
|
7544
7553
|
if (obj && "protectedNative" in obj && Array.isArray(obj.protectedNative) && obj._id && obj._id.startsWith("system.adapter.") && obj.native && !import_constants.NO_PROTECT_ADAPTERS.includes(this.name) && this.name !== obj._id.split(".")[2]) {
|
|
7545
7554
|
for (const attr of obj.protectedNative) {
|
|
7546
|
-
|
|
7555
|
+
(0, import_utils.deleteObjectAttribute)(obj.native, attr);
|
|
7547
7556
|
}
|
|
7548
7557
|
}
|
|
7549
7558
|
if (this.adapterReady) {
|
|
@@ -7615,7 +7624,7 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
7615
7624
|
/**
|
|
7616
7625
|
* Initialize the adapter
|
|
7617
7626
|
*
|
|
7618
|
-
* @param adapterConfig the AdapterOptions or the InstanceObject, is null/undefined if it is
|
|
7627
|
+
* @param adapterConfig the AdapterOptions or the InstanceObject, is null/undefined if it is an installation process
|
|
7619
7628
|
*/
|
|
7620
7629
|
async _initAdapter(adapterConfig) {
|
|
7621
7630
|
await this._initLogging();
|
|
@@ -7745,7 +7754,7 @@ class AdapterClass extends import_node_events.EventEmitter {
|
|
|
7745
7754
|
if (Array.isArray(adapterConfig.encryptedNative)) {
|
|
7746
7755
|
for (const attr of adapterConfig.encryptedNative) {
|
|
7747
7756
|
if (typeof this.config[attr] === "string") {
|
|
7748
|
-
promises.push(this.getEncryptedConfig(attr).then((decryptedValue) => this.config
|
|
7757
|
+
promises.push(this.getEncryptedConfig(attr).then((decryptedValue) => (0, import_utils.setObjectAttribute)(this.config, attr, decryptedValue)).catch((e) => this._logger.error(`${this.namespaceLog} Can not decrypt attribute ${attr}: ${e.message}`)));
|
|
7749
7758
|
}
|
|
7750
7759
|
}
|
|
7751
7760
|
} else {
|