@iobroker/js-controller-adapter 6.0.7-alpha.0-20240702-5c723a4ac → 6.0.8

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.
@@ -350,7 +350,7 @@ export declare class AdapterClass extends EventEmitter {
350
350
  /** contents of package.json */
351
351
  pack?: Record<string, any>;
352
352
  /** contents of io-package.json */
353
- ioPack: Record<string, any>;
353
+ ioPack: ioBroker.InstanceObject;
354
354
  private _initializeTimeout?;
355
355
  private inited?;
356
356
  /** contents of iobroker.json if required via AdapterOptions */
@@ -782,6 +782,13 @@ export declare class AdapterClass extends EventEmitter {
782
782
  * @param options information about version to remove feature and the log message
783
783
  */
784
784
  private reportDeprecation;
785
+ /**
786
+ * Initialize the plugin handler for this adapter
787
+ */
788
+ private _initPluginHandler;
789
+ /**
790
+ * Initializes the adapter
791
+ */
785
792
  private _init;
786
793
  }
787
794
  /**
@@ -6266,7 +6266,10 @@ class AdapterClass extends import_node_events.EventEmitter {
6266
6266
  });
6267
6267
  if (this._options.instance === void 0) {
6268
6268
  this.version = this.pack?.version ? this.pack.version : this.ioPack?.common ? this.ioPack.common.version : "unknown";
6269
- const isNpmVersion = !this.ioPack || !this.ioPack.common || typeof this.ioPack.common.installedFrom !== "string" || this.ioPack.common.installedFrom.startsWith(`${import_js_controller_common.tools.appName.toLowerCase()}.${this.name}`);
6269
+ const isNpmVersion = (0, import_js_controller_common.isInstalledFromNpm)({
6270
+ adapterName: this.name,
6271
+ installedFrom: this.ioPack.common.installedFrom
6272
+ });
6270
6273
  this._logger.info(`${this.namespaceLog} starting. Version ${this.version} ${!isNpmVersion ? `(non-npm: ${this.ioPack.common.installedFrom}) ` : ""}in ${this.adapterDir}, node: ${process.version}, js-controller: ${controllerVersion}`);
6271
6274
  this._config.system = this._config.system || {};
6272
6275
  this._config.system.statisticsInterval = parseInt(this._config.system.statisticsInterval, 10) || 15e3;
@@ -6277,7 +6280,7 @@ class AdapterClass extends import_node_events.EventEmitter {
6277
6280
  this.#states.setState(`${id}.compactMode`, {
6278
6281
  ack: true,
6279
6282
  from: id,
6280
- val: !!this.startedInCompactMode
6283
+ val: this.startedInCompactMode
6281
6284
  });
6282
6285
  this.outputCount++;
6283
6286
  if (this.startedInCompactMode) {
@@ -6529,6 +6532,23 @@ class AdapterClass extends import_node_events.EventEmitter {
6529
6532
  };
6530
6533
  await this.#states.pushMessage(`system.host.${this.host}`, obj);
6531
6534
  }
6535
+ _initPluginHandler() {
6536
+ const pluginSettings = {
6537
+ scope: "adapter",
6538
+ namespace: `system.adapter.${this.namespace}`,
6539
+ logNamespace: this.namespaceLog,
6540
+ log: this._logger,
6541
+ iobrokerConfig: this._config,
6542
+ parentPackage: this.pack,
6543
+ controllerVersion
6544
+ };
6545
+ this.pluginHandler = new import_plugin_base.PluginHandler(pluginSettings);
6546
+ try {
6547
+ this.pluginHandler.addPlugins(this.ioPack.common.plugins || {}, [this.adapterDir, thisDir]);
6548
+ } catch (e) {
6549
+ this._logger.error(`Could not add plugins: ${e.message}`);
6550
+ }
6551
+ }
6532
6552
  async _init() {
6533
6553
  const _initDBs = () => {
6534
6554
  this._initObjects(() => {
@@ -6583,21 +6603,7 @@ class AdapterClass extends import_node_events.EventEmitter {
6583
6603
  process.once("exit", () => this._stop());
6584
6604
  process.on("uncaughtException", (err) => this._exceptionHandler(err));
6585
6605
  process.on("unhandledRejection", (err) => this._exceptionHandler(err, true));
6586
- const pluginSettings = {
6587
- scope: "adapter",
6588
- namespace: `system.adapter.${this.namespace}`,
6589
- logNamespace: this.namespaceLog,
6590
- log: this._logger,
6591
- iobrokerConfig: this._config,
6592
- parentPackage: this.pack,
6593
- controllerVersion
6594
- };
6595
- this.pluginHandler = new import_plugin_base.PluginHandler(pluginSettings);
6596
- try {
6597
- this.pluginHandler.addPlugins(this.ioPack.common.plugins, [this.adapterDir, thisDir]);
6598
- } catch (e) {
6599
- this._logger.error(`Could not add plugins: ${e.message}`);
6600
- }
6606
+ this._initPluginHandler();
6601
6607
  _initDBs();
6602
6608
  }
6603
6609
  }