From 0444f90bdfbecef91d10547ed19beb6c999a9721 Mon Sep 17 00:00:00 2001 From: GermanBluefox Date: Sun, 24 Nov 2024 20:56:22 +0000 Subject: [PATCH] Rules are working --- build-backend/main.js | 11 +- build-backend/main.js.map | 2 +- src-editor/src/App.tsx | 2 +- src-editor/src/Components/BlocklyEditor.tsx | 8 +- .../components/Blocks/ActionOperateStates.tsx | 6 +- .../components/Blocks/ActionSetState.tsx | 2 +- .../Blocks/ActionSetStateDelayed.tsx | 6 +- .../components/Blocks/ConditionState.tsx | 25 +- .../components/Blocks/TriggerSchedule.tsx | 92 +-- .../components/Blocks/TriggerScriptSave.tsx | 7 +- .../components/Blocks/TriggerState.tsx | 175 +++-- .../components/ContextWrapper/index.tsx | 22 +- .../components/CurrentItem/index.tsx | 6 +- .../components/CustomModal/index.tsx | 6 +- .../components/GenericBlock/index.tsx | 158 ++-- .../RulesEditor/helpers/Compile.tsx | 24 +- .../src/Components/RulesEditor/index.tsx | 30 +- .../src/Components/RulesEditor/types.d.ts | 4 +- .../Components/ScriptEditorVanilaMonaco.tsx | 4 +- src-editor/src/Editor.tsx | 25 +- src-editor/src/GenericBlock.tsx | 2 +- src-editor/src/SideMenu.tsx | 7 +- src-editor/src/bootstrap.tsx | 2 +- src-editor/src/i18n/de.json | 740 +++++++++--------- src-editor/src/i18n/en.json | 738 ++++++++--------- src-editor/src/i18n/es.json | 738 ++++++++--------- src-editor/src/i18n/fr.json | 738 ++++++++--------- src-editor/src/i18n/it.json | 738 ++++++++--------- src-editor/src/i18n/nl.json | 738 ++++++++--------- src-editor/src/i18n/pl.json | 738 ++++++++--------- src-editor/src/i18n/pt.json | 738 ++++++++--------- src-editor/src/i18n/ru.json | 738 ++++++++--------- src-editor/src/i18n/uk.json | 738 ++++++++--------- src-editor/src/i18n/zh-cn.json | 738 ++++++++--------- src/main.ts | 11 +- 35 files changed, 4427 insertions(+), 4330 deletions(-) diff --git a/build-backend/main.js b/build-backend/main.js index 2291aebac..e6a72b6aa 100644 --- a/build-backend/main.js +++ b/build-backend/main.js @@ -215,7 +215,13 @@ const jsDeclarationServer = new virtual_tsc_1.Server(typescriptSettings_1.jsDecl */ class JavaScript extends adapter_core_1.Adapter { context; - errorLogFunction; + errorLogFunction = { + error: (msg) => console.error(msg), + warn: (msg) => console.warn(msg), + info: (msg) => console.log(msg), + debug: (msg) => console.debug(msg), + silly: (msg) => console.debug(msg), + }; mods; objectsInitDone = false; statesInitDone = false; @@ -351,7 +357,6 @@ class JavaScript extends adapter_core_1.Adapter { } } } - this.errorLogFunction = this.log; this.context = { mods: this.mods, objects: this.objects, @@ -661,6 +666,8 @@ class JavaScript extends adapter_core_1.Adapter { } } async onReady() { + this.errorLogFunction = this.log; + this.context.errorLogFunction = this.log; this.config.maxSetStatePerMinute = parseInt(this.config.maxSetStatePerMinute, 10) || 1000; this.config.maxTriggersPerScript = parseInt(this.config.maxTriggersPerScript, 10) || 100; if (this.supportsFeature && this.supportsFeature('PLUGINS')) { diff --git a/build-backend/main.js.map b/build-backend/main.js.map index de61dd525..5c84826a4 100644 --- a/build-backend/main.js.map +++ b/build-backend/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAqD;AACrD,qCAAwF;AACxF,yCAAiD;AACjD,2DAA4D;AAC5D,6CAAkE;AAClE,yCAA8C;AAE9C,kDAAoC;AACpC,oDAAsC;AACtC,8CAAgC;AAChC,oDAAsC;AACtC,gDAAkC;AAClC,kDAAoC;AACpC,kDAAoC;AACpC,8CAAgC;AAChC,4CAA8B;AAC9B,gDAAkC;AAClC,gDAAkC;AAClC,kEAAoD;AACpD,oDAAsC;AACtC,gDAAkC;AAElC,sCAAsC;AACtC,kDAAoC;AACpC,6CAA+B;AAC/B,sCAAsC;AACtC,yDAA2C;AAC3C,4DAA8C;AAE9C,yDAA6G;AAK7G,yCAAsC;AACt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CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAA4C,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/F,CAAC;KAAM,CAAC;IACJ,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["/*\n * Javascript adapter\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2024 bluefox ,\n *\n * Copyright (c) 2014 hobbyquaker\n */\n\nimport { Script, type ScriptOptions } from 'node:vm';\nimport { readFileSync, existsSync, statSync, writeFileSync, type Stats } from 'node:fs';\nimport { join, sep, normalize } from 'node:path';\nimport { fork, type ForkOptions } from 'node:child_process';\nimport { setTypeScriptResolveOptions, Server } from 'virtual-tsc';\nimport { isDeepStrictEqual } from 'node:util';\n\nimport * as dgram from 'node:dgram';\nimport * as crypto from 'node:crypto';\nimport * as dns from 'node:dns';\nimport * as events from 'node:events';\nimport * as http from 'node:http';\nimport * as https from 'node:https';\nimport * as http2 from 'node:http2';\nimport * as net from 'node:net';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport * as util from 'node:util';\nimport * as child_process from 'node:child_process';\nimport * as stream from 'node:stream';\nimport * as zlib from 'node:zlib';\n\n// @ts-expect-error no types available\nimport * as suncalc from 'suncalc2';\nimport * as axios from 'axios';\n// @ts-expect-error no types available\nimport * as wake_on_lan from 'wake_on_lan';\nimport * as nodeSchedule from 'node-schedule';\n\nimport { getAbsoluteDefaultDataDir, Adapter, EXIT_CODES, type AdapterOptions } from '@iobroker/adapter-core';\nimport type SentryPlugin from '@iobroker/plugin-sentry';\nimport type { GetTimesResult } from 'suncalc';\nimport type { CompileResult } from 'virtual-tsc/build/util';\n\nimport { Mirror } from './lib/mirror';\nimport ProtectFs from './lib/protectFs';\nimport { setLanguage, getLanguage } from './lib/words';\nimport { sandBox } from './lib/sandbox';\nimport { requestModuleNameByUrl } from './lib/nodeModulesManagement';\nimport { createEventObject, type EventObj } from './lib/eventObj';\nimport { type AstroEventName, Scheduler } from './lib/scheduler';\nimport { targetTsLib, tsCompilerOptions, jsDeclarationCompilerOptions } from './lib/typescriptSettings';\nimport { hashSource } from './lib/tools';\nimport {\n resolveTypescriptLibs,\n resolveTypings,\n scriptIdToTSFilename,\n transformScriptBeforeCompilation,\n transformGlobalDeclarations,\n} from './lib/typescriptTools';\nimport type {\n FileSubscriptionResult,\n JavascriptContext,\n JavaScriptAdapterConfig,\n JsScript,\n ScriptType,\n SubscriptionResult,\n SubscribeObject,\n JavascriptTimer,\n SandboxType,\n LogMessage,\n DebugState,\n} from './types';\nimport type { PatternEventCompareFunction } from './lib/patternCompareFunctions';\n\ntype MODULES = {\n fs: ProtectFs;\n 'fs/promises': ProtectFs['promises'];\n dgram: typeof dgram;\n crypto: typeof crypto;\n dns: typeof dns;\n events: typeof events;\n http: typeof http;\n https: typeof https;\n http2: typeof http2;\n net: typeof net;\n os: typeof os;\n path: typeof path;\n util: typeof util;\n child_process: typeof child_process;\n stream: typeof stream;\n zlib: typeof zlib;\n suncalc: typeof suncalc;\n axios: typeof axios;\n wake_on_lan: typeof wake_on_lan;\n nodeSchedule: typeof nodeSchedule;\n};\n\n/**\n * List of forbidden Locations for a mirror directory\n * relative to the default data directory\n * ATTENTION: the same list is also located in index_m.html!!\n */\nconst forbiddenMirrorLocations: string[] = [\n 'backup-objects',\n 'files',\n 'backitup',\n '../backups',\n '../node_modules',\n '../log',\n];\n\nconst packageJson: Record = JSON.parse(readFileSync(`${__dirname}/../package.json`).toString());\nconst SCRIPT_CODE_MARKER = 'script.js.';\n\nlet webstormDebug: string | undefined;\n\nconst isCI = !!process.env.CI;\n\n// ambient declarations for typescript\nlet tsAmbient: Record;\n\n// TypeScript's scripts are only recompiled if their source hash changes.\n// If an adapter update fixes the compilation bugs, a user won't notice until the changes and re-saves the script.\n// To avoid that, we also include the\n// adapter version and TypeScript version in the hash\nconst tsSourceHashBase = `versions:adapter=${packageJson.version},typescript=${packageJson.dependencies.typescript}`;\n\n// taken from here: https://stackoverflow.com/questions/11887934/how-to-check-if-dst-daylight-saving-time-is-in-effect-and-if-so-the-offset\nfunction dstOffsetAtDate(dateInput: Date): number {\n const fullYear: number = dateInput.getFullYear() | 0;\n // \"Leap Years are any year that can be exactly divided by 4 (2012, 2016, etc)\n // except if it can be exactly divided by 100, then it isn't (2100, 2200, etc)\n // except if it can be exactly divided by 400, then it is (2000, 2400)\"\n // (https://www.mathsisfun.com/leap-years.html).\n const isLeapYear: 1 | 0 = ((fullYear & 3) | ((fullYear / 100) & 3)) === 0 ? 1 : 0;\n // (fullYear & 3) = (fullYear % 4), but faster\n //Alternative:var isLeapYear=(new Date(currentYear,1,29,12)).getDate()===29?1:0\n const fullMonth: number = dateInput.getMonth() | 0;\n return (\n // 1. We know what the time since the Epoch really is\n +dateInput - // same as the dateInput.getTime() method\n // 2. We know what the time since the Epoch at the start of the year is\n +new Date(fullYear, 0) - // day defaults to 1 if not explicitly zeroed\n // 3. Now, subtract what we would expect the time to be if daylight savings\n // did not exist. This yields the time-offset due to daylight savings.\n // Calculate the day of the year in the Gregorian calendar\n // The code below works based upon the facts of signed right shifts\n // • (x) >> n: shifts n and fills in the n highest bits with 0s\n // • (-x) >> n: shifts n and fills in the n highest bits with 1s\n // (This assumes that x is a positive integer)\n ((((-1 + // the first day in the year is day 1\n (31 & (-fullMonth >> 4)) + // January // (-11)>>4 = -1\n ((28 + isLeapYear) & ((1 - fullMonth) >> 4)) + // February\n (31 & ((2 - fullMonth) >> 4)) + // March\n (30 & ((3 - fullMonth) >> 4)) + // April\n (31 & ((4 - fullMonth) >> 4)) + // May\n (30 & ((5 - fullMonth) >> 4)) + // June\n (31 & ((6 - fullMonth) >> 4)) + // July\n (31 & ((7 - fullMonth) >> 4)) + // August\n (30 & ((8 - fullMonth) >> 4)) + // September\n (31 & ((9 - fullMonth) >> 4)) + // October\n (30 & ((10 - fullMonth) >> 4)) + // November\n // There are no months past December: the year rolls into the next.\n // Thus, \"fullMonth\" is 0-based, so it will never be 12 in JavaScript\n\n (dateInput.getDate() | 0)) & // get day of the month\n 0xffff) *\n 24 *\n 60 + // 24 hours in a day, 60 minutes in an hour\n (dateInput.getHours() & 0xff) * 60 + // 60 minutes in an hour\n (dateInput.getMinutes() & 0xff)) |\n 0) *\n 60 *\n 1000 - // 60 seconds in a minute * 1000 milliseconds in a second\n (dateInput.getSeconds() & 0xff) * 1000 - // 1000 milliseconds in a second\n dateInput.getMilliseconds()\n );\n}\n\nconst regExGlobalOld = /_global$/;\nconst regExGlobalNew = /script\\.js\\.global\\./;\n\nfunction checkIsGlobal(obj: ioBroker.ScriptObject): boolean {\n return obj?.common && (regExGlobalOld.test(obj.common.name) || regExGlobalNew.test(obj._id));\n}\n\nfunction fileMatching(sub: FileSubscriptionResult, id: string, fileName: string): boolean {\n if (sub.idRegEx) {\n if (!sub.idRegEx.test(id)) {\n return false;\n }\n } else {\n if (sub.id !== id) {\n return false;\n }\n }\n if (sub.fileRegEx) {\n if (!sub.fileRegEx.test(fileName)) {\n return false;\n }\n } else {\n if (sub.fileNamePattern !== fileName) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction getNextTimeEvent(time: string, useNextDay?: boolean): Date {\n const now: Date = getAstroStartOfDay();\n const [timeHours, timeMinutes] = time.split(':');\n const nTimeHours = parseInt(timeHours, 10);\n const nTimeMinutes = parseInt(timeMinutes, 10);\n if (\n useNextDay &&\n (now.getHours() > nTimeHours || (now.getHours() === nTimeHours && now.getMinutes() > nTimeMinutes))\n ) {\n now.setDate(now.getDate() + 1);\n }\n\n now.setHours(nTimeHours);\n now.setMinutes(nTimeMinutes);\n\n return now;\n}\n\nfunction getAstroStartOfDay(): Date {\n const d = new Date();\n d.setMinutes(0);\n d.setSeconds(0);\n d.setMilliseconds(0);\n d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1000);\n d.setUTCHours(0);\n\n return d;\n}\n\nfunction formatHoursMinutesSeconds(date: Date): string {\n const h = String(date.getHours());\n const m = String(date.getMinutes());\n const s = String(date.getSeconds());\n\n return `${h.padStart(2, '0')}:${m.padStart(2, '0')}:${s.padStart(2, '0')}`;\n}\n\n// Due to a npm bug, virtual-tsc may be hoisted to the top level node_modules but\n// typescript may still be in the adapter level (https://npm.community/t/packages-with-peerdependencies-are-incorrectly-hoisted/4794),\n// so we need to tell virtual-tsc where typescript is\nsetTypeScriptResolveOptions({\n paths: [require.resolve('typescript')],\n});\n\n// compiler instance for global JS declarations\nconst jsDeclarationServer: Server = new Server(jsDeclarationCompilerOptions, isCI ? false : undefined);\n/**\n * Stores the IDs of script objects whose change should be ignored because\n * the compiled source was just updated\n */\n\nclass JavaScript extends Adapter {\n public declare config: JavaScriptAdapterConfig;\n\n private readonly context: JavascriptContext;\n\n private errorLogFunction: {\n error: (msg: string) => void;\n warn: (msg: string) => void;\n info: (msg: string) => void;\n debug: (msg: string) => void;\n silly: (msg: string) => void;\n };\n\n private readonly mods: MODULES;\n\n private objectsInitDone = false;\n private statesInitDone = false;\n\n private objects: Record = {};\n private states: Record = {};\n private readonly interimStateValues: Record = {};\n private readonly stateIds: string[] = [];\n private readonly subscriptions: SubscriptionResult[] = [];\n private readonly subscriptionsFile: FileSubscriptionResult[] = [];\n private readonly subscriptionsObject: SubscribeObject[] = [];\n private readonly subscribedPatterns: Record = {};\n private readonly subscribedPatternsFile: Record = {};\n private readonly adapterSubs: Record = {};\n private readonly timers: { [scriptName: string]: JavascriptTimer[] } = {};\n private readonly _enums: string[] = [];\n private readonly names: { [name: string]: string | string[] } = {}; // name: id\n private readonly scripts: Record = {};\n private readonly messageBusHandlers: Record<\n string,\n Record void }[]>\n > = {};\n private readonly logSubscriptions: Record<\n string,\n {\n sandbox: SandboxType;\n cb: (info: LogMessage) => void;\n id: number;\n severity: ioBroker.LogLevel | '*';\n }[]\n > = {};\n private readonly tempDirectories: { [scriptName: string]: string } = {}; // name: path\n private readonly folderCreationVerifiedObjects: Record = {};\n\n /** if logs are subscribed or not */\n private logSubscribed = false;\n\n private timeSettings: {\n format12: boolean;\n leadingZeros: boolean;\n } = { format12: false, leadingZeros: true };\n\n private dayScheduleTimer: NodeJS.Timeout | null = null; // schedule for astrological day\n private sunScheduleTimer: NodeJS.Timeout | null = null; // schedule for sun moment times\n private timeScheduleTimer: NodeJS.Timeout | null = null; // schedule for astrological day\n\n private activeStr = ''; // enabled state prefix\n\n private mirror: Mirror | undefined;\n\n private stopCounters: Record = {};\n\n private setStateCountCheckInterval: NodeJS.Timeout | null = null;\n\n private globalScript = '';\n /** Generated declarations for global TypeScripts */\n private globalDeclarations = '';\n // Remember which definitions the global scripts\n // have access to, because it depends on the compilation order\n private knownGlobalDeclarationsByScript: Record = {};\n private globalScriptLines = 0;\n // compiler instance for typescript\n private tsServer: Server;\n\n private readonly ignoreObjectChange: Set = new Set();\n\n private debugState: DebugState = {\n scriptName: '',\n child: null,\n promiseOnEnd: null,\n paused: false,\n started: 0,\n running: false,\n };\n\n constructor(options: Partial = {}) {\n options = {\n ...options,\n name: 'javascript', // adapter name\n useFormatDate: true,\n /**\n * If the JS-Controller catches an unhandled error, this will be called\n * so we have a chance to handle it ourselves.\n */\n error: (err: Error): boolean => {\n // Identify unhandled errors originating from callbacks in scripts\n // These are not caught by wrapping the execution code in try-catch\n if (err && typeof err.stack === 'string') {\n const scriptCodeMarkerIndex = err.stack.indexOf(SCRIPT_CODE_MARKER);\n if (scriptCodeMarkerIndex > -1) {\n // This is a script error\n let scriptName = err.stack.substring(scriptCodeMarkerIndex);\n scriptName = scriptName.substring(0, scriptName.indexOf(':'));\n this.logError(scriptName, err);\n\n // Leave the script running for now\n // signal to the JS-Controller that we handled the error ourselves\n return true;\n }\n // check if a path contains adaptername but not own node_module\n // this regex matched \"iobroker.javascript/\" if NOT followed by \"node_modules\"\n if (!err.stack.match(/iobroker\\.javascript[/\\\\](?!.*node_modules).*/g)) {\n // This is an error without any info on origin (mostly async errors like connection errors)\n // also consider it as being from a script\n this.log.error(\n 'An error happened which is most likely from one of your scripts, but the originating script could not be detected.',\n );\n this.log.error(`Error: ${err.message}`);\n this.log.error(err.stack);\n\n // signal to the JS-Controller that we handled the error ourselves\n return true;\n }\n }\n\n return false;\n },\n };\n\n super(options as AdapterOptions);\n\n this.on('objectChange', this.onObjectChange.bind(this));\n this.on('stateChange', this.onStateChange.bind(this));\n this.on('ready', this.onReady.bind(this));\n this.on('message', this.onMessage.bind(this));\n this.on('unload', this.onUnload.bind(this));\n this.on('fileChange', this.onFileChange.bind(this));\n this.on('log', this.onLog.bind(this));\n\n this.mods = {\n fs: {} as ProtectFs,\n 'fs/promises': {} as ProtectFs['promises'],\n dgram,\n crypto,\n dns,\n events,\n http,\n https,\n http2,\n net,\n os,\n path,\n util,\n child_process,\n stream,\n zlib,\n\n suncalc,\n axios,\n wake_on_lan,\n nodeSchedule,\n };\n\n // check the webstorm debug and just debug modes\n let debugMode: string | undefined;\n if (process.argv) {\n for (let a = 1; a < process.argv.length; a++) {\n if (process.argv[a].startsWith('--webstorm')) {\n webstormDebug = process.argv[a].replace(/^(.*?=\\s*)/, '');\n }\n if (process.argv[a] === '--debugScript') {\n if (!process.argv[a + 1]) {\n console.log('No script name provided');\n process.exit(300);\n } else {\n debugMode = process.argv[a + 1];\n }\n }\n }\n }\n\n this.errorLogFunction = this.log;\n\n this.context = {\n mods: this.mods,\n objects: this.objects,\n states: this.states,\n interimStateValues: this.interimStateValues,\n stateIds: this.stateIds,\n errorLogFunction: this.errorLogFunction,\n subscriptions: this.subscriptions,\n subscriptionsFile: this.subscriptionsFile,\n subscriptionsObject: this.subscriptionsObject,\n subscribedPatterns: this.subscribedPatterns,\n subscribedPatternsFile: this.subscribedPatternsFile,\n adapterSubs: this.adapterSubs,\n cacheObjectEnums: {},\n timers: this.timers,\n enums: this._enums,\n names: this.names,\n scripts: this.scripts,\n messageBusHandlers: this.messageBusHandlers,\n logSubscriptions: this.logSubscriptions,\n tempDirectories: this.tempDirectories,\n folderCreationVerifiedObjects: this.folderCreationVerifiedObjects,\n\n isEnums: false, // If some subscription wants enum\n channels: null,\n devices: null,\n logWithLineInfo: this.logWithLineInfo.bind(this),\n scheduler: null,\n timerId: 0,\n rulesOpened: null, // opened rules\n language: this.language || 'en',\n\n updateLogSubscriptions: this.updateLogSubscriptions.bind(this),\n convertBackStringifiedValues: this.convertBackStringifiedValues.bind(this),\n updateObjectContext: this.updateObjectContext.bind(this),\n prepareStateObject: this.prepareStateObject.bind(this),\n debugMode,\n getAbsoluteDefaultDataDir,\n adapter: this as unknown as ioBroker.Adapter,\n logError: this.logError.bind(this),\n };\n\n this.tsServer = new Server(tsCompilerOptions, this.tsLog);\n }\n\n async onObjectChange(id: string, obj?: ioBroker.Object | null): Promise {\n // Check if we should ignore this change (once!) because we just updated the compiled sources\n if (this.ignoreObjectChange.has(id)) {\n // Update the cached script object and do nothing more\n this.objects[id] = obj as ioBroker.Object;\n this.ignoreObjectChange.delete(id);\n return;\n }\n\n // When still in initializing: already remember current values,\n // but data structures are initialized elsewhere\n if (!this.objectsInitDone) {\n if (obj) {\n this.objects[id] = obj;\n }\n return;\n }\n\n if (id.startsWith('enum.')) {\n // clear cache\n this.context.cacheObjectEnums = {};\n\n // update this._enums array\n if (obj) {\n // If new\n if (!this._enums.includes(id)) {\n this._enums.push(id);\n this._enums.sort();\n }\n } else {\n const pos = this._enums.indexOf(id);\n // if deleted\n if (pos !== -1) {\n this._enums.splice(pos, 1);\n }\n }\n }\n\n if (id === 'system.config' && obj?.common?.language) {\n // set language for debug messages\n setLanguage(obj.common.language);\n this.language = obj.common.language;\n this.context.language = this.language as ioBroker.Languages;\n }\n\n // update stored time format for variables.dayTime\n if (id === `${this.namespace}.variables.dayTime` && obj?.native) {\n this.timeSettings.format12 = obj.native.format12 || false;\n this.timeSettings.leadingZeros = obj.native.leadingZeros === undefined ? true : obj.native.leadingZeros;\n }\n\n // send changes to disk mirror\n this.mirror?.onObjectChange(id, obj as ioBroker.ScriptObject | null);\n\n const formerObj = this.objects[id];\n\n this.updateObjectContext(id, obj); // Update all Meta object data\n\n // for the alias object changes on the state objects, we need to manually update the\n // state cache value, because the new value is only published on the next change\n if (obj?.type === 'state' && id.startsWith('alias.0.')) {\n // execute async for speed\n this.getForeignStateAsync(id)\n .then(state => {\n if (state) {\n this.states[id] = state;\n } else if (this.states[id] !== undefined) {\n delete this.states[id];\n }\n })\n .catch(() => {\n /* ignore */\n });\n }\n\n this.subscriptionsObject.forEach(sub => {\n // ToDo: implement comparing with id.0.* too\n if (sub.pattern === id) {\n try {\n sub.callback(id, obj);\n } catch (err: any) {\n this.log.error(`Error in callback: ${err.toString()}`);\n }\n }\n });\n\n // handle Script object updates\n if (!obj && formerObj?.type === 'script') {\n // Object Deleted just now\n if (checkIsGlobal(formerObj)) {\n // it was a global Script, and it was enabled and is now deleted => restart adapter\n if (formerObj.common.enabled) {\n this.log.info(`Active global Script ${id} deleted. Restart instance.`);\n this.restart();\n }\n } else if (formerObj.common?.engine === `system.adapter.${this.namespace}`) {\n // It was a non-global Script and deleted => stop and remove it\n await this.stopScript(id);\n\n // delete scriptEnabled.blabla variable\n const idActive = `scriptEnabled.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n await this.delStateAsync(idActive);\n await this.delObjectAsync(idActive);\n\n // delete scriptProblem.blabla variable\n const idProblem = `scriptProblem.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n await this.delStateAsync(idProblem);\n await this.delObjectAsync(idProblem);\n }\n } else if (!formerObj && obj?.type === 'script') {\n // New script that does not exist before\n if (checkIsGlobal(obj)) {\n // new global script added => restart adapter\n if (obj.common.enabled) {\n this.log.info(`Active global Script ${id} created. Restart instance.`);\n this.restart();\n }\n } else if (obj.common?.engine === `system.adapter.${this.namespace}`) {\n // new non-global script - create states for scripts\n await this.createActiveObject(id, obj.common.enabled);\n await this.createProblemObject(id);\n if (obj.common.enabled) {\n // if enabled => Start script\n await this.loadScriptById(id);\n }\n }\n } else if (obj?.type === 'script' && formerObj?.common) {\n // Script changed ...\n if (checkIsGlobal(obj)) {\n if (obj.common.enabled || formerObj.common.enabled) {\n this.log.info(`Global Script ${id} updated. Restart instance.`);\n this.restart();\n }\n } else {\n // No global script\n if (obj.common?.engine === `system.adapter.${this.namespace}`) {\n // create states for scripts\n await this.createActiveObject(id, obj.common.enabled);\n await this.createProblemObject(id);\n }\n\n if (\n (formerObj.common.enabled && !obj.common.enabled) ||\n (formerObj.common.engine === `system.adapter.${this.namespace}` &&\n obj.common.engine !== `system.adapter.${this.namespace}`)\n ) {\n // Script disabled\n if (formerObj.common.enabled && formerObj.common.engine === `system.adapter.${this.namespace}`) {\n // Remove it from executing\n await this.stopScript(id);\n }\n } else if (\n (!formerObj.common.enabled && obj.common.enabled) ||\n (formerObj.common.engine !== `system.adapter.${this.namespace}` &&\n obj.common.engine === `system.adapter.${this.namespace}`)\n ) {\n // Script enabled\n\n if (obj.common.enabled && obj.common.engine === `system.adapter.${this.namespace}`) {\n // Start script\n await this.loadScriptById(id);\n }\n } else {\n // if (obj.common.source !== formerObj.common.source) {\n // Source changed => restart the script\n this.stopCounters[id] = this.stopCounters[id] ? this.stopCounters[id] + 1 : 1;\n this.stopScript(id).then(() => {\n // only start again after stop when \"last\" object change to prevent problems on\n // multiple changes in fast frequency\n if (!--this.stopCounters[id]) {\n this.loadScriptById(id);\n }\n });\n }\n }\n }\n }\n\n onStateChange(id: string, state?: ioBroker.State | null): void {\n if (this.interimStateValues[id] !== undefined) {\n // any update invalidates the remembered interim value\n delete this.interimStateValues[id];\n }\n if (!id || id.startsWith('messagebox.') || id.startsWith('log.')) {\n return;\n }\n\n if (id === `${this.namespace}.debug.to` && state && !state.ack) {\n if (!this.context.debugMode) {\n this.debugSendToInspector(state.val);\n }\n return;\n }\n\n // When still in initializing: already remember current values,\n // but data structures are initialized elsewhere\n if (!this.statesInitDone) {\n if (state) {\n this.states[id] = state;\n }\n return;\n }\n\n const oldState: ioBroker.State | null | undefined = this.states[id];\n if (state) {\n if (oldState) {\n // enable or disable script\n if (!state.ack && id.startsWith(this.activeStr) && this.objects[id]?.native?.script) {\n this.extendForeignObject(this.objects[id].native.script, {\n common: { enabled: state.val },\n });\n }\n\n // monitor if adapter is alive and send all subscriptions once more, after adapter goes online\n if (/*oldState && */ oldState.val === false && state.val && id.endsWith('.alive')) {\n if (this.adapterSubs[id]) {\n const parts = id.split('.');\n const a = `${parts[2]}.${parts[3]}`;\n for (let t = 0; t < this.adapterSubs[id].length; t++) {\n this.log.info(`Detected coming adapter \"${a}\". Send subscribe: ${this.adapterSubs[id][t]}`);\n this.sendTo(a, 'subscribe', this.adapterSubs[id][t]);\n }\n }\n }\n } else if (/*!oldState && */ !this.stateIds.includes(id)) {\n this.stateIds.push(id);\n this.stateIds.sort();\n }\n this.states[id] = state;\n } else {\n if (oldState) {\n delete this.states[id];\n }\n state = {} as ioBroker.State;\n const pos = this.stateIds.indexOf(id);\n if (pos !== -1) {\n this.stateIds.splice(pos, 1);\n }\n }\n const _eventObj = createEventObject(\n this.context,\n id,\n this.convertBackStringifiedValues(id, state),\n this.convertBackStringifiedValues(id, oldState),\n );\n\n // if this state matches any subscriptions\n for (let i = 0, l = this.subscriptions.length; i < l; i++) {\n const sub = this.subscriptions[i];\n if (sub?.patternCompareFunctions && patternMatching(_eventObj, sub.patternCompareFunctions)) {\n try {\n sub.callback(_eventObj);\n } catch (err: any) {\n this.log.error(`Error in callback: ${err.toString()}`);\n }\n }\n }\n }\n\n onFileChange(id: string, fileName: string, size: number | null): void {\n // if this file matches any subscriptions\n for (let i = 0, l = this.subscriptionsFile.length; i < l; i++) {\n const sub = this.subscriptionsFile[i];\n if (sub && fileMatching(sub, id, fileName)) {\n try {\n sub.callback(id, fileName, size, sub.withFile);\n } catch (err: any) {\n this.log.error(`Error in callback: ${err.toString()}`);\n }\n }\n }\n }\n\n async onUnload(callback: () => void): Promise {\n await this.debugStop();\n this.stopTimeSchedules();\n if (this.setStateCountCheckInterval) {\n clearInterval(this.setStateCountCheckInterval);\n this.setStateCountCheckInterval = null;\n }\n await this.stopAllScripts();\n if (typeof callback === 'function') {\n callback();\n }\n }\n\n async onReady(): Promise {\n this.config.maxSetStatePerMinute = parseInt(this.config.maxSetStatePerMinute as unknown as string, 10) || 1000;\n this.config.maxTriggersPerScript = parseInt(this.config.maxTriggersPerScript as unknown as string, 10) || 100;\n\n if (this.supportsFeature && this.supportsFeature('PLUGINS')) {\n const sentryInstance: InstanceType = this.getPluginInstance('sentry') as InstanceType<\n typeof SentryPlugin\n >;\n if (sentryInstance) {\n const Sentry = sentryInstance.getSentryObject();\n if (Sentry) {\n const scope = Sentry.getCurrentScope();\n scope.addEventProcessor((event, _hint) => {\n if (event.exception?.values?.[0]) {\n const eventData = event.exception.values[0];\n if (\n eventData.stacktrace?.frames &&\n Array.isArray(eventData.stacktrace.frames) &&\n eventData.stacktrace.frames.length\n ) {\n // Exclude event if script Marker is included\n if (\n eventData.stacktrace.frames.find(frame =>\n frame.filename?.includes(SCRIPT_CODE_MARKER),\n )\n ) {\n return null;\n }\n //Exclude event if own directory is included but not inside own node_modules\n const ownNodeModulesDir = join(__dirname, 'node_modules');\n if (\n !eventData.stacktrace.frames.find(\n frame =>\n frame.filename &&\n frame.filename.includes(__dirname) &&\n !frame.filename.includes(ownNodeModulesDir),\n )\n ) {\n return null;\n }\n // We have exception data and did not sort it out, so report it\n return event;\n }\n }\n\n // No exception in it ... do not report\n return null;\n });\n }\n }\n }\n\n await this.main();\n }\n\n onMessage(obj: ioBroker.Message): void {\n switch (obj?.command) {\n // process messageTo commands\n case 'toScript':\n case 'jsMessageBus':\n if (\n obj.message &&\n (obj.message.instance === null ||\n obj.message.instance === undefined ||\n `javascript.${obj.message.instance}` === this.namespace ||\n obj.message.instance === this.namespace)\n ) {\n Object.keys(this.messageBusHandlers).forEach(name => {\n // script name could be script.js.xxx or only xxx\n if (\n (!obj.message.script || obj.message.script === name) &&\n this.messageBusHandlers[name][obj.message.message]\n ) {\n this.messageBusHandlers[name][obj.message.message].forEach(handler => {\n const sandbox = handler.sandbox;\n\n sandbox.verbose && sandbox.log(`onMessage: ${JSON.stringify(obj.message)}`, 'info');\n\n try {\n if (obj.callback) {\n handler.cb.call(sandbox, obj.message.data, (result: any) => {\n if (sandbox.verbose) {\n sandbox.log(`onMessage result: ${JSON.stringify(result)}`, 'info');\n }\n\n this.sendTo(obj.from, obj.command, result, obj.callback);\n });\n } else {\n handler.cb.call(sandbox, obj.message.data, (result: any) => {\n sandbox.verbose &&\n sandbox.log(`onMessage result: ${JSON.stringify(result)}`, 'info');\n });\n }\n } catch (err: unknown) {\n this.setState(\n `scriptProblem.${name.substring(SCRIPT_CODE_MARKER.length)}`,\n true,\n true,\n );\n this.logError('Error in callback', err as Error);\n }\n });\n }\n });\n }\n break;\n\n case 'loadTypings': {\n // Load typings for the editor\n const typings: Record = {};\n\n // try to load TypeScript lib files from disk\n try {\n const typescriptLibs = resolveTypescriptLibs(targetTsLib);\n Object.assign(typings, typescriptLibs);\n } catch {\n /* ok, no lib then */\n }\n\n // provide the already-loaded ioBroker typings and global script declarations\n Object.assign(typings, tsAmbient);\n\n // also provide the known global declarations for each global script\n for (const globalScriptPaths of Object.keys(this.knownGlobalDeclarationsByScript)) {\n typings[`${globalScriptPaths}.d.ts`] = this.knownGlobalDeclarationsByScript[globalScriptPaths];\n }\n\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, { typings }, obj.callback);\n }\n break;\n }\n\n case 'calcAstroAll': {\n if (obj.message) {\n const sunriseOffset =\n parseInt(\n obj.message.sunriseOffset === undefined\n ? this.config.sunriseOffset\n : obj.message.sunriseOffset,\n 10,\n ) || 0;\n const sunsetOffset =\n parseInt(\n obj.message.sunsetOffset === undefined\n ? this.config.sunsetOffset\n : obj.message.sunsetOffset,\n 10,\n ) || 0;\n const longitude =\n parseFloat(\n obj.message.longitude === undefined ? this.config.longitude : obj.message.longitude,\n ) || 0;\n const latitude =\n parseFloat(obj.message.latitude === undefined ? this.config.latitude : obj.message.latitude) ||\n 0;\n const today = getAstroStartOfDay();\n let astroEvents: GetTimesResult & { nextSunrise: Date; nextSunset: Date } = {} as GetTimesResult & {\n nextSunrise: Date;\n nextSunset: Date;\n };\n try {\n astroEvents = this.mods.suncalc.getTimes(today, latitude, longitude);\n } catch (err: unknown) {\n this.log.error(`Cannot calculate astro data: ${err as Error}`);\n }\n if (astroEvents) {\n try {\n astroEvents.nextSunrise = this.getAstroEvent(\n today,\n obj.message.sunriseEvent || this.config.sunriseEvent,\n obj.message.sunriseLimitStart || this.config.sunriseLimitStart,\n obj.message.sunriseLimitEnd || this.config.sunriseLimitEnd,\n sunriseOffset,\n false,\n latitude,\n longitude,\n true,\n );\n astroEvents.nextSunset = this.getAstroEvent(\n today,\n obj.message.sunsetEvent || this.config.sunsetEvent,\n obj.message.sunsetLimitStart || this.config.sunsetLimitStart,\n obj.message.sunsetLimitEnd || this.config.sunsetLimitEnd,\n sunsetOffset,\n true,\n latitude,\n longitude,\n true,\n );\n } catch (err: unknown) {\n this.log.error(`Cannot calculate astro data: ${err as Error}`);\n }\n }\n\n const result: Record = {};\n const keys = Object.keys(astroEvents).sort(\n (a, b) =>\n (astroEvents as unknown as Record)[a] -\n (astroEvents as unknown as Record)[b],\n );\n keys.forEach(key => {\n const validDate =\n (astroEvents as unknown as Record)[key] !== null &&\n !isNaN((astroEvents as unknown as Record)[key].getTime());\n\n result[key] = {\n isValidDate: validDate,\n serverTime: validDate\n ? formatHoursMinutesSeconds((astroEvents as unknown as Record)[key])\n : 'n/a',\n date: validDate\n ? (astroEvents as unknown as Record)[key].toISOString()\n : 'n/a',\n };\n });\n\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, result, obj.callback);\n }\n }\n break;\n }\n\n case 'calcAstro': {\n if (obj.message) {\n const longitude =\n parseFloat(\n obj.message.longitude === undefined ? this.config.longitude : obj.message.longitude,\n ) || 0;\n const latitude =\n parseFloat(obj.message.latitude === undefined ? this.config.latitude : obj.message.latitude) ||\n 0;\n const today = getAstroStartOfDay();\n\n const sunriseEvent = obj.message?.sunriseEvent || this.config.sunriseEvent;\n const sunriseLimitStart = obj.message?.sunriseLimitStart || this.config.sunriseLimitStart;\n const sunriseLimitEnd = obj.message?.sunriseLimitEnd || this.config.sunriseLimitEnd;\n const sunriseOffset =\n parseInt(\n obj.message.sunriseOffset === undefined\n ? this.config.sunriseOffset\n : obj.message.sunriseOffset,\n 10,\n ) || 0;\n const nextSunrise = this.getAstroEvent(\n today,\n sunriseEvent,\n sunriseLimitStart,\n sunriseLimitEnd,\n sunriseOffset,\n false,\n latitude,\n longitude,\n true,\n );\n\n const sunsetEvent = obj.message?.sunsetEvent || this.config.sunsetEvent;\n const sunsetLimitStart = obj.message?.sunsetLimitStart || this.config.sunsetLimitStart;\n const sunsetLimitEnd = obj.message?.sunsetLimitEnd || this.config.sunsetLimitEnd;\n const sunsetOffset =\n parseInt(\n obj.message.sunsetOffset === undefined\n ? this.config.sunsetOffset\n : obj.message.sunsetOffset,\n 10,\n ) || 0;\n const nextSunset = this.getAstroEvent(\n today,\n sunsetEvent,\n sunsetLimitStart,\n sunsetLimitEnd,\n sunsetOffset,\n true,\n latitude,\n longitude,\n true,\n );\n\n const validDateSunrise = nextSunrise !== null && !isNaN(nextSunrise.getTime());\n const validDateSunset = nextSunset !== null && !isNaN(nextSunset.getTime());\n\n this.log.debug(\n `calcAstro sunrise: ${sunriseEvent} -> start ${sunriseLimitStart}, end: ${sunriseLimitEnd}, offset: ${sunriseOffset} - ${validDateSunrise ? nextSunrise.toISOString() : 'n/a'}`,\n );\n this.log.debug(\n `calcAstro sunset: ${sunsetEvent} -> start ${sunsetLimitStart}, end: ${sunsetLimitEnd}, offset: ${sunsetOffset} - ${validDateSunset ? nextSunset.toISOString() : 'n/a'}`,\n );\n\n if (obj.callback) {\n this.sendTo(\n obj.from,\n obj.command,\n {\n nextSunrise: {\n isValidDate: validDateSunrise,\n serverTime: validDateSunrise ? formatHoursMinutesSeconds(nextSunrise) : 'n/a',\n date: nextSunrise.toISOString(),\n },\n nextSunset: {\n isValidDate: validDateSunset,\n serverTime: validDateSunset ? formatHoursMinutesSeconds(nextSunset) : 'n/a',\n date: nextSunset.toISOString(),\n },\n },\n obj.callback,\n );\n }\n }\n break;\n }\n\n case 'debug': {\n if (!this.context.debugMode) {\n this.debugStart(obj.message);\n }\n break;\n }\n\n case 'debugStop': {\n if (!this.context.debugMode) {\n this.debugStop().then(() => console.log('stopped'));\n }\n break;\n }\n\n case 'rulesOn': {\n this.context.rulesOpened = obj.message;\n console.log(`Enable messaging for ${this.context.rulesOpened}`);\n break;\n }\n\n case 'rulesOff': {\n // maybe if (context.rulesOpened === obj.message)\n console.log(`Disable messaging for ${this.context.rulesOpened}`);\n this.context.rulesOpened = null;\n break;\n }\n\n case 'getIoBrokerDataDir': {\n if (obj.callback) {\n this.sendTo(\n obj.from,\n obj.command,\n {\n dataDir: getAbsoluteDefaultDataDir(),\n sep,\n },\n obj.callback,\n );\n }\n break;\n }\n }\n }\n\n onLog(msg: any): void {\n Object.keys(this.logSubscriptions).forEach((name: string): void =>\n this.logSubscriptions[name].forEach(handler => {\n if (\n typeof handler.cb === 'function' &&\n (handler.severity === '*' || handler.severity === msg.severity)\n ) {\n handler.sandbox.logHandler = handler.severity || '*';\n handler.cb.call(handler.sandbox, msg);\n handler.sandbox.logHandler = undefined;\n }\n }),\n );\n }\n\n logError(msg: string, e: Error, offs?: number): void {\n const stack = e.stack ? e.stack.toString().split('\\n') : e ? e.toString() : '';\n if (!msg.includes('\\n')) {\n msg = msg.replace(/[: ]*$/, ': ');\n }\n\n this.errorLogFunction.error(msg + this.fixLineNo(stack[0]));\n for (let i = offs || 1; i < stack.length; i++) {\n if (!stack[i]) {\n continue;\n }\n if (stack[i].match(/runInNewContext|javascript\\.js:/)) {\n break;\n }\n this.errorLogFunction.error(this.fixLineNo(stack[i]));\n }\n }\n\n logWithLineInfo(msg: string): void {\n this.errorLogFunction.warn(msg);\n\n // get current error stack\n const stack = new Error().stack?.split('\\n');\n\n if (stack) {\n for (let i = 3; i < stack.length; i++) {\n if (!stack[i]) {\n continue;\n }\n if (stack[i].match(/runInContext|runInNewContext|javascript\\.js:/)) {\n break;\n }\n this.errorLogFunction.warn(this.fixLineNo(stack[i]));\n }\n }\n }\n\n async main(): Promise {\n // Patch the font as it sometimes is wrong\n if (!this.context.debugMode) {\n if (await this.patchFont()) {\n this.log.debug('Font patched');\n }\n }\n\n this.log.debug(`config.subscribe (Do not subscribe all states on start): ${this.config.subscribe}`);\n\n // correct jsonConfig for admin\n const instObj: ioBroker.InstanceObject | null | undefined = await this.getForeignObjectAsync(\n `system.adapter.${this.namespace}`,\n );\n if (instObj?.common) {\n if (instObj.common.adminUI?.config !== 'json') {\n if (instObj.common.adminUI) {\n instObj.common.adminUI.config = 'json';\n } else {\n instObj.common.adminUI = { config: 'json' };\n }\n this.setForeignObject(instObj._id, instObj);\n }\n }\n\n if (webstormDebug) {\n this.errorLogFunction = {\n error: console.error,\n warn: console.warn,\n info: console.info,\n debug: console.log,\n silly: console.log,\n };\n this.context.errorLogFunction = this.errorLogFunction;\n }\n this.activeStr = `${this.namespace}.scriptEnabled.`;\n\n this.mods.fs = new ProtectFs(this.log, getAbsoluteDefaultDataDir());\n this.mods['fs/promises'] = this.mods.fs.promises; // to avoid require('fs/promises');\n\n // try to read TS declarations\n try {\n tsAmbient = {\n 'javascript.d.ts': readFileSync(this.mods.path.join(__dirname, 'lib/javascript.d.ts'), 'utf8'),\n };\n this.tsServer.provideAmbientDeclarations(tsAmbient);\n jsDeclarationServer.provideAmbientDeclarations(tsAmbient);\n } catch (err: unknown) {\n this.log.warn(`Could not read TypeScript ambient declarations: ${err as Error}`);\n // This should not happen, so send an error report to Sentry\n if (this.supportsFeature && this.supportsFeature('PLUGINS')) {\n const sentryInstance = this.getPluginInstance('sentry');\n if (sentryInstance) {\n const sentryObject = sentryInstance.getSentryObject();\n sentryObject?.captureException(err as Error);\n }\n }\n // Keep the adapter from crashing when the included typings cannot be read\n tsAmbient = {};\n }\n\n await this.installLibraries();\n // Load the TS declarations for Node.js and all 3rd party modules\n this.loadTypeScriptDeclarations();\n\n await this.getData();\n this.context.scheduler = new Scheduler(\n this.log,\n Date,\n this.mods.suncalc,\n this.config.latitude,\n this.config.longitude,\n );\n await this.dayTimeSchedules();\n await this.sunTimeSchedules();\n await this.timeSchedule();\n\n // Warning. It could have a side effect in compact mode, so all adapters will accept self-signed certificates\n if (this.config.allowSelfSignedCerts) {\n process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';\n }\n\n const doc = await this.getObjectViewAsync('script', 'javascript', {});\n if (doc?.rows?.length) {\n // assemble global script\n for (let g = 0; g < doc.rows.length; g++) {\n const obj = doc.rows[g].value;\n if (checkIsGlobal(obj)) {\n if (obj && obj.common) {\n const engineType = (obj.common.engineType || '').toLowerCase();\n\n if (obj.common.enabled) {\n if (engineType.startsWith('typescript')) {\n // TypeScript\n this.log.info(`${obj._id}: compiling TypeScript source...`);\n // In order to compile global TypeScript, we need to do some transformations\n // 1. For top-level-await, some statements must be wrapped in an immediately-invoked async function\n // 2. If any global script uses `import`, the declarations are no longer visible if they are not exported with `declare global`\n const transformedSource = transformScriptBeforeCompilation(obj.common.source, true);\n // The source code must be transformed in order to support top level await\n // Global scripts must not be treated as a module, otherwise their methods\n // cannot be found by the normal scripts\n // We need to hash both global declarations that are known until now\n // AND the script source, because changing either can change the compilation output\n const sourceHash: string = hashSource(\n tsSourceHashBase + this.globalDeclarations + transformedSource,\n );\n\n let compiled: string | undefined;\n let declarations: string | undefined;\n // If we already stored the compiled source code and the original source hash,\n // use the hash to check whether we can rely on the compiled source code or\n // if we need to compile it again\n if (\n typeof obj.common.compiled === 'string' &&\n typeof obj.common.sourceHash === 'string' &&\n sourceHash === obj.common.sourceHash\n ) {\n // We can reuse the stored source\n compiled = obj.common.compiled;\n declarations = obj.common.declarations;\n this.log.info(\n `${obj._id}: source code did not change, using cached compilation result...`,\n );\n } else {\n // We don't have a hashed source code, or the original source changed, compile it\n const filename = scriptIdToTSFilename(obj._id);\n let tsCompiled: CompileResult;\n try {\n tsCompiled = this.tsServer.compile(filename, transformedSource);\n } catch (err: unknown) {\n this.log.error(`${obj._id}: TypeScript compilation failed:\\n${err as Error}`);\n continue;\n }\n\n const errors = tsCompiled.diagnostics\n .map(diag => `${diag.annotatedSource}\\n`)\n .join('\\n');\n\n if (tsCompiled.success) {\n if (errors.length > 0) {\n this.log.warn(\n `${obj._id}: TypeScript compilation completed with errors:\\n${errors}`,\n );\n } else {\n this.log.info(`${obj._id}: TypeScript compilation successful`);\n }\n compiled = tsCompiled.result;\n // Global scripts that have been transformed to support `import` need to have their declarations transformed aswell\n declarations = transformGlobalDeclarations(tsCompiled.declarations || '');\n\n const newCommon: {\n compiled: string | undefined;\n declarations?: string;\n sourceHash: string;\n } = {\n sourceHash,\n compiled,\n };\n if (declarations) {\n newCommon.declarations = declarations;\n }\n\n // Store the compiled source and the original source hash, so we don't need to do the work again next time\n this.ignoreObjectChange.add(obj._id); // ignore the next change and don't restart scripts\n this.extendForeignObject(obj._id, {\n common: newCommon,\n });\n } else {\n this.log.error(`${obj._id}: TypeScript compilation failed:\\n${errors}`);\n continue;\n }\n }\n this.globalScript += `${compiled}\\n`;\n // if declarations were generated, remember them\n if (declarations != null) {\n this.provideDeclarationsForGlobalScript(obj._id, declarations);\n }\n } else {\n // javascript\n const sourceCode = obj.common.source;\n this.globalScript += `${sourceCode}\\n`;\n\n // try to compile the declarations so TypeScripts can use\n // functions defined in global JavaScripts\n const filename = scriptIdToTSFilename(obj._id);\n let tsCompiled: CompileResult;\n try {\n tsCompiled = jsDeclarationServer.compile(filename, sourceCode);\n } catch (err: unknown) {\n this.log.warn(\n `${obj._id}: Error while generating type declarations, skipping:\\n${err as Error}`,\n );\n continue;\n }\n // if declarations were generated, remember them\n if (tsCompiled.success && tsCompiled.declarations != null) {\n this.provideDeclarationsForGlobalScript(obj._id, tsCompiled.declarations);\n }\n }\n }\n }\n }\n }\n }\n\n this.globalScript = this.globalScript.replace(/\\r\\n/g, '\\n');\n this.globalScriptLines = this.globalScript.split(/\\n/g).length - 1;\n\n if (doc?.rows?.length) {\n // load all scripts\n for (let i = 0; i < doc.rows.length; i++) {\n if (!checkIsGlobal(doc.rows[i].value)) {\n this.loadScript(doc.rows[i].value);\n }\n }\n }\n\n if (this.config.mirrorPath) {\n this.config.mirrorInstance = parseInt(this.config.mirrorInstance as unknown as string, 10) || 0;\n if (this.instance === this.config.mirrorInstance) {\n const ioBDataDir = getAbsoluteDefaultDataDir() + sep;\n this.config.mirrorPath = normalize(this.config.mirrorPath);\n let mirrorForbidden = false;\n for (let dir of forbiddenMirrorLocations) {\n dir = join(ioBDataDir, dir) + sep;\n if (dir.includes(this.config.mirrorPath) || this.config.mirrorPath.startsWith(dir)) {\n this.log.error(`The Mirror directory is not allowed to be a central ioBroker directory!`);\n this.log.error(`Directory ${this.config.mirrorPath} is not allowed to mirror files!`);\n mirrorForbidden = true;\n break;\n }\n }\n if (!mirrorForbidden) {\n this.mirror = new Mirror({\n adapter: this,\n log: this.log,\n diskRoot: this.config.mirrorPath,\n });\n }\n }\n }\n\n // CHeck setState counter per minute and stop script if too high\n this.setStateCountCheckInterval = setInterval(() => {\n Object.keys(this.scripts).forEach(id => {\n if (!this.scripts[id]) {\n return;\n }\n const currentSetStatePerMinuteCounter = this.scripts[id].setStatePerMinuteCounter;\n this.scripts[id].setStatePerMinuteCounter = 0;\n if (currentSetStatePerMinuteCounter > this.config.maxSetStatePerMinute) {\n this.scripts[id].setStatePerMinuteProblemCounter++;\n this.log.debug(\n `Script ${id} has reached the maximum of ${this.config.maxSetStatePerMinute} setState calls per minute in ${this.scripts[id].setStatePerMinuteProblemCounter} consecutive minutes`,\n );\n // Allow \"too high counters\" for 1 minute for script starts or such and only\n // stop the script when lasts longer\n if (this.scripts[id].setStatePerMinuteProblemCounter > 1) {\n this.log.error(\n `Script ${id} is calling setState more than ${this.config.maxSetStatePerMinute} times per minute! Stopping Script now! Please check your script!`,\n );\n this.stopScript(id);\n }\n } else if (this.scripts[id].setStatePerMinuteProblemCounter > 0) {\n this.scripts[id].setStatePerMinuteProblemCounter--;\n this.log.debug(\n `Script ${id} has NOT reached the maximum of ${this.config.maxSetStatePerMinute} setState calls per minute. Decrease problem counter to ${this.scripts[id].setStatePerMinuteProblemCounter}`,\n );\n }\n });\n }, 60000);\n }\n\n private loadTypeScriptDeclarations(): void {\n // try to load the typings on disk for all 3rd party modules\n const packages = [\n 'node', // this provides auto-completion for most builtins\n '@iobroker/types', // this provides auto-completion for most builtins\n ];\n // Also include user-selected libraries (but only those that are also installed)\n if (typeof this.config?.libraries === 'string' && typeof this.config.libraryTypings === 'string') {\n const installedLibs = this.config.libraries\n .split(/[,;\\s]+/)\n .map(s => s.trim().split('@')[0])\n .filter(s => !!s);\n\n const wantsTypings = this.config.libraryTypings\n .split(/[,;\\s]+/)\n .map(s => s.trim())\n .filter(s => !!s);\n // Add all installed libraries the user has requested typings for to the list of packages\n for (const lib of installedLibs) {\n if (wantsTypings.includes(lib) && !packages.includes(lib)) {\n packages.push(lib);\n }\n }\n // Some packages have submodules (e.g., rxjs/operators) that are not exposed through the main entry point\n // If typings are requested for them, also add them if the base module is installed\n for (const lib of wantsTypings) {\n // Extract the package name and check if we need to add it\n if (!lib.includes('/')) {\n continue;\n }\n const pkgName = lib.substr(0, lib.indexOf('/'));\n\n if (installedLibs.includes(pkgName) && !packages.includes(lib)) {\n packages.push(lib);\n }\n }\n }\n for (const pkg of packages) {\n let pkgTypings = resolveTypings(\n pkg,\n this.getAdapterScopedPackageIdentifier ? this.getAdapterScopedPackageIdentifier(pkg) : pkg,\n // node needs ambient typings, so we don't wrap it in declare module\n pkg !== 'node',\n );\n if (!pkgTypings) {\n // Create the empty dummy declarations so users don't get the \"not found\" error\n // for installed packages\n pkgTypings = {\n [`node_modules/@types/${pkg}/index.d.ts`]: `declare module \"${pkg}\";`,\n };\n }\n this.log.debug(`Loaded TypeScript definitions for ${pkg}: ${JSON.stringify(Object.keys(pkgTypings))}`);\n // remember the declarations for the editor\n Object.assign(tsAmbient, pkgTypings);\n // and give the language servers access to them\n this.tsServer.provideAmbientDeclarations(pkgTypings);\n jsDeclarationServer.provideAmbientDeclarations(pkgTypings);\n }\n }\n\n updateObjectContext(id: string, obj: ioBroker.Object | null | undefined): void {\n if (obj) {\n // add state to state ID's list\n if (obj.type === 'state') {\n if (!this.stateIds.includes(id)) {\n this.stateIds.push(id);\n this.stateIds.sort();\n }\n if (this.context.devices && this.context.channels) {\n const parts = id.split('.');\n parts.pop();\n const chn = parts.join('.');\n this.context.channels[chn] = this.context.channels[chn] || [];\n this.context.channels[chn].push(id);\n\n parts.pop();\n const dev = parts.join('.');\n this.context.devices[dev] = this.context.devices[dev] || [];\n this.context.devices[dev].push(id);\n }\n }\n } else {\n // delete object from state ID's list\n const pos = this.stateIds.indexOf(id);\n if (pos !== -1) {\n this.stateIds.splice(pos, 1);\n }\n if (this.context.devices && this.context.channels) {\n const parts = id.split('.');\n parts.pop();\n const chn = parts.join('.');\n if (this.context.channels[chn]) {\n const posChn = this.context.channels[chn].indexOf(id);\n posChn !== -1 && this.context.channels[chn].splice(posChn, 1);\n }\n\n parts.pop();\n const dev = parts.join('.');\n if (this.context.devices[dev]) {\n const posDev = this.context.devices[dev].indexOf(id);\n posDev !== -1 && this.context.devices[dev].splice(posDev, 1);\n }\n }\n\n delete this.folderCreationVerifiedObjects[id];\n }\n\n if (!obj && this.objects[id]) {\n // objects was deleted\n this.removeFromNames(id);\n delete this.objects[id];\n } else if (obj && !this.objects[id]) {\n // object was added\n this.objects[id] = obj;\n this.addToNames(obj);\n } else if (obj && this.objects[id].common) {\n // Object just changed\n this.objects[id] = obj;\n\n const n = this.getName(id);\n let nn = this.objects[id].common ? this.objects[id].common.name : '';\n\n if (nn && typeof nn === 'object') {\n nn = nn[getLanguage()] || nn.en;\n }\n\n if (n !== nn) {\n if (n) {\n this.removeFromNames(id);\n }\n if (nn) {\n this.addToNames(obj);\n }\n }\n }\n }\n\n async stopAllScripts(): Promise {\n const scripts = Object.keys(this.scripts);\n const promises: Promise[] = [];\n for (let i = 0; i < scripts.length; i++) {\n promises.push(this.stopScript(scripts[i]));\n }\n return Promise.all(promises).then(() => {});\n }\n\n convertBackStringifiedValues(\n id: string,\n state: ioBroker.State | null | undefined,\n ): ioBroker.State | null | undefined {\n if (\n state &&\n typeof state.val === 'string' &&\n this.objects[id]?.common &&\n (this.objects[id].common.type === 'array' || this.objects[id].common.type === 'object')\n ) {\n try {\n state.val = JSON.parse(state.val);\n } catch (err: any) {\n if (id.startsWith('javascript.') || id.startsWith('0_userdata.0')) {\n this.log.info(\n `Could not parse value for id ${id} into ${this.objects[id].common.type}: ${err.toString()}`,\n );\n } else {\n this.log.debug(\n `Could not parse value for id ${id} into ${this.objects[id].common.type}: ${err.toString()}`,\n );\n }\n }\n }\n return state;\n }\n\n prepareStateObjectSimple(id: string, state: ioBroker.StateValue, isAck: boolean): ioBroker.State {\n let oState: ioBroker.State;\n\n if (typeof isAck === 'boolean') {\n // otherwise, assume that the given state is the value to be set\n oState = { val: state, ack: !!isAck } as ioBroker.State;\n } else {\n oState = { val: state } as ioBroker.State;\n }\n\n return this.prepareStateObject(id, oState);\n }\n\n prepareStateObject(id: string, state: ioBroker.SettableState | null): ioBroker.State {\n let oState: ioBroker.State;\n\n if (state && typeof state === 'object') {\n oState = state as ioBroker.State;\n } else {\n oState = { val: null } as ioBroker.State;\n }\n\n if (this.config.subscribe) {\n return oState;\n }\n // set other values to have a full state object\n // mirrors logic from statesInRedis\n if (oState.ts === undefined) {\n oState.ts = Date.now();\n }\n\n if (oState.q === undefined) {\n oState.q = 0;\n }\n\n oState.from =\n typeof oState.from === 'string' && oState.from !== '' ? oState.from : `system.adapter.${this.namespace}`;\n\n if (oState.lc === undefined) {\n const formerStateValue = this.interimStateValues[id] || this.states[id];\n if (!formerStateValue) {\n oState.lc = oState.ts;\n } else {\n // isDeepStrictEqual works on objects and primitive values\n const hasChanged = !isDeepStrictEqual(formerStateValue.val, oState.val);\n if (!formerStateValue.lc || hasChanged) {\n oState.lc = oState.ts;\n } else {\n oState.lc = formerStateValue.lc;\n }\n }\n }\n\n return oState;\n }\n\n async getData(): Promise {\n await this.subscribeForeignObjectsAsync('*');\n\n if (!this.config.subscribe) {\n await this.subscribeForeignStatesAsync('*');\n } else {\n await this.subscribeStatesAsync('debug.to');\n await this.subscribeStatesAsync('scriptEnabled.*');\n }\n\n this.log.info('requesting all states');\n\n const statesPromise = this.getForeignStatesAsync('*')\n .then(res => {\n if (!res) {\n this.log.error(`Could not initialize states: no result`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n return;\n }\n if (!this.config.subscribe) {\n this.states = Object.assign(res, this.states);\n this.context.states = this.states;\n\n this.addGetProperty(this.states);\n }\n\n // remember all IDs\n for (const id in res) {\n if (Object.prototype.hasOwnProperty.call(res, id)) {\n this.stateIds.push(id);\n }\n }\n this.statesInitDone = true;\n this.log.info('received all states');\n })\n .catch((err: any) => {\n this.log.error(`Could not initialize states: ${err?.message || 'no result'}`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n });\n\n this.log.info('requesting all objects');\n\n const objectsPromise = this.getObjectListAsync({ include_docs: true })\n .then(res => {\n if (!res?.rows) {\n this.log.error(`Could not initialize objects: no result`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n return;\n }\n this.objects = {};\n this.context.objects = this.objects;\n for (let i = 0; i < res.rows.length; i++) {\n if (!res.rows[i].doc) {\n this.log.debug(`Got empty object for index ${i} (${res.rows[i].id})`);\n continue;\n }\n if (this.objects[res.rows[i].doc._id] === undefined) {\n // If was already there ignore\n this.objects[res.rows[i].doc._id] = res.rows[i].doc;\n }\n this.objects[res.rows[i].doc._id].type === 'enum' && this._enums.push(res.rows[i].doc._id);\n\n // Collect all names\n this.addToNames(this.objects[res.rows[i].doc._id]);\n }\n this.addGetProperty(this.objects);\n\n const systemConfig = this.objects['system.config'];\n\n // set language for debug messages\n if (systemConfig?.common?.language) {\n setLanguage(systemConfig.common.language);\n this.language = systemConfig.common.language;\n this.context.language = this.language as ioBroker.Languages;\n } else if (this.language) {\n setLanguage(this.language);\n this.context.language = this.language;\n }\n\n // try to use system coordinates\n if (this.config.useSystemGPS) {\n if (systemConfig?.common?.latitude || systemConfig?.common?.longitude) {\n this.config.latitude = systemConfig.common.latitude;\n this.config.longitude = systemConfig.common.longitude;\n } else if (this.latitude && this.longitude) {\n this.config.latitude = this.latitude;\n this.config.longitude = this.longitude;\n }\n }\n this.config.latitude = parseFloat(this.config.latitude as unknown as string);\n this.config.longitude = parseFloat(this.config.longitude as unknown as string);\n\n if (isNaN(this.config.latitude)) {\n this.log.warn(`Configured latitude is not a number - check (instance/system) configuration`);\n } else if (this.config.latitude < -90 || this.config.latitude > 90) {\n this.log.warn(\n `Configured latitude \"${this.config.latitude}\" is invalid - check (instance/system) configuration`,\n );\n }\n\n if (isNaN(this.config.longitude)) {\n this.log.warn(`Configured longitude is not a number - check (instance/system) configuration`);\n } else if (this.config.longitude < -180 || this.config.longitude > 180) {\n this.log.warn(\n `Configured longitude \"${this.config.longitude}\" is invalid - check (instance/system) configuration`,\n );\n }\n\n this.config.sunriseEvent = this.config.sunriseEvent || 'nightEnd';\n this.config.sunriseOffset = this.config.sunriseOffset || 0;\n this.config.sunriseLimitStart = this.config.sunriseLimitStart || '06:00';\n this.config.sunriseLimitEnd = this.config.sunriseLimitEnd || '12:00';\n\n this.config.sunsetEvent = this.config.sunsetEvent || 'dusk';\n this.config.sunsetOffset = this.config.sunsetOffset || 0;\n this.config.sunsetLimitStart = this.config.sunsetLimitStart || '18:00';\n this.config.sunsetLimitEnd = this.config.sunsetLimitEnd || '23:00';\n\n this.objectsInitDone = true;\n this.log.info('received all objects');\n })\n .catch((err: any) => {\n this.log.error(`Could not initialize objects: ${err?.message || 'no result'}`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n });\n\n return Promise.all([statesPromise, objectsPromise]).then(() => {});\n }\n\n async createActiveObject(id: string, enabled: boolean): Promise {\n const idActive = `${this.namespace}.scriptEnabled.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n\n if (!this.objects[idActive]) {\n this.objects[idActive] = {\n _id: idActive,\n common: {\n name: `scriptEnabled.${id.substring(SCRIPT_CODE_MARKER.length)}`,\n desc: 'controls script activity',\n type: 'boolean',\n write: true,\n read: true,\n role: 'switch.active',\n },\n native: {\n script: id,\n },\n type: 'state',\n };\n try {\n this.setForeignObjectAsync(idActive, this.objects[idActive]);\n const intermediateStateValue = this.prepareStateObjectSimple(idActive, !!enabled, true);\n await this.setForeignStateAsync(idActive, !!enabled, true);\n if (enabled && !this.config.subscribe) {\n this.interimStateValues[idActive] = intermediateStateValue;\n }\n } catch {\n // ignore\n }\n } else {\n const state = await this.getForeignStateAsync(idActive);\n if (state && state.val !== enabled) {\n const intermediateStateValue = this.prepareStateObjectSimple(idActive, !!enabled, true);\n await this.setForeignStateAsync(idActive, !!enabled, true);\n if (enabled && !this.config.subscribe) {\n this.interimStateValues[id] = intermediateStateValue;\n }\n }\n }\n }\n\n async createProblemObject(id: string): Promise {\n const idProblem = `${this.namespace}.scriptProblem.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n\n if (!this.objects[idProblem]) {\n this.objects[idProblem] = {\n _id: idProblem,\n common: {\n name: `scriptProblem.${id.substring(SCRIPT_CODE_MARKER.length)}`,\n desc: 'Script has a problem',\n type: 'boolean',\n expert: true,\n write: false,\n read: true,\n role: 'indicator.error',\n },\n native: {\n script: id,\n },\n type: 'state',\n };\n try {\n await this.setForeignObjectAsync(idProblem, this.objects[idProblem]);\n await this.setForeignStateAsync(idProblem, false, true);\n } catch {\n // ignore\n }\n } else {\n const state = await this.getForeignStateAsync(idProblem);\n if (state && state.val !== false) {\n await this.setForeignStateAsync(idProblem, false, true);\n }\n }\n }\n\n addToNames(obj: ioBroker.Object): void {\n const id = obj._id;\n\n if (obj.common?.name) {\n let name = obj.common.name;\n if (name && typeof name === 'object') {\n name = name[getLanguage()] || name.en;\n }\n if (!name || typeof name !== 'string') {\n // TODO, take name in current language\n return;\n }\n\n if (!this.names[name]) {\n this.names[name] = id;\n } else {\n // convert to array\n if (!Array.isArray(this.names[name])) {\n this.names[name] = [this.names[name] as string];\n }\n\n (this.names[name] as string[]).push(id);\n }\n }\n }\n\n removeFromNames(id: string): void {\n const n = this.getName(id);\n\n if (n) {\n if (Array.isArray(this.names[n])) {\n const pos = this.names[n].indexOf(id);\n if (pos > -1) {\n this.names[n].splice(pos, 1);\n\n if (this.names[n].length === 1) {\n this.names[n] = this.names[n][0];\n }\n }\n } else {\n delete this.names[n];\n }\n }\n }\n\n getName(id: string): string | null {\n for (const n in this.names) {\n if (this.names[n] && Array.isArray(this.names[n])) {\n if (this.names[n].includes(id)) {\n return n;\n }\n } else if (this.names[n] === id) {\n return n;\n }\n }\n\n return null;\n }\n\n async installNpm(npmLib: string): Promise {\n return new Promise((resolve, reject) => {\n const path = __dirname;\n\n // Also, set the working directory (cwd) of the process instead of using --prefix\n // because that has ugly bugs on Windows\n const cmd = `npm install ${npmLib} --omit=dev`;\n this.log.info(`Installing ${npmLib} into ${__dirname} - cmd: ${cmd}`);\n\n // System call used for update of js-controller itself,\n // because during the installation the npm packet will be deleted too, but some files must be loaded even during the installation process.\n const child = this.mods.child_process.exec(cmd, {\n windowsHide: true,\n cwd: path,\n });\n\n child.stdout?.on('data', buf => this.log.info(buf.toString('utf8')));\n\n child.stderr?.on('data', buf => this.log.error(buf.toString('utf8')));\n\n child.on('err', err => {\n this.log.error(`Cannot install ${npmLib}: ${err}`);\n reject(new Error(`Cannot install ${npmLib}: ${err}`));\n });\n child.on('error', err => {\n this.log.error(`Cannot install ${npmLib}: ${err}`);\n reject(new Error(`Cannot install ${npmLib}: ${err}`));\n });\n\n child.on('exit', (code: number /* , signal */) => {\n if (code) {\n this.log.error(`Cannot install ${npmLib}: ${code}`);\n reject(new Error(`Cannot install ${npmLib}: ${code}`));\n }\n // command succeeded\n resolve(code);\n });\n });\n }\n\n async installLibraries(): Promise {\n if (typeof this.config?.libraries !== 'string') {\n this.config.libraries = '';\n }\n\n const libraries: string[] = this.config.libraries\n .split(/[,;\\s]+/)\n .map(d => d.trim())\n .filter(d => d);\n\n this.log.debug(`Custom libraries in config: \"${this.config.libraries}\": ${JSON.stringify(libraries)}`);\n\n let installedNodeModules: string[] = [];\n const keepModules: string[] = [];\n\n // js-controller >= 6.x\n if (typeof this.listInstalledNodeModules === 'function') {\n installedNodeModules = await this.listInstalledNodeModules();\n\n this.log.debug(`Found installed libraries: ${JSON.stringify(installedNodeModules)}`);\n }\n\n for (const lib of libraries) {\n let depName = lib;\n let version = 'latest';\n\n if (depName.includes('@') && depName.lastIndexOf('@') > 0) {\n const parts = depName.split('@');\n version = parts.pop() ?? 'latest';\n depName = parts.join('@');\n }\n\n /** The real module name, because the dependency can be an url too */\n let moduleName = depName;\n\n if (URL.canParse(depName)) {\n moduleName = await requestModuleNameByUrl(depName);\n\n this.log.debug(`Found custom library in config: \"${moduleName}@${version}\" (from ${depName})`);\n } else {\n this.log.debug(`Found custom library in config: \"${moduleName}@${version}\"`);\n }\n\n keepModules.push(moduleName);\n\n // js-controller >= 6.x\n if (typeof this.installNodeModule === 'function') {\n try {\n const result = await this.installNodeModule(depName, { version });\n if (result.success) {\n this.log.debug(`Installed custom library: \"${moduleName}@${version}\"`);\n\n const importedModule: any = await this.importNodeModule(moduleName);\n (this.mods as Record)[moduleName] = importedModule.default ?? importedModule;\n } else {\n this.log.warn(`Cannot install custom npm package \"${moduleName}@${version}\"`);\n }\n } catch (err: unknown) {\n this.log.warn(`Cannot install custom npm package \"${moduleName}@${version}\": ${err as Error}`);\n }\n } else if (!existsSync(`${__dirname}/node_modules/${depName}/package.json`)) {\n // js-controller < 6.x\n this.log.info(`Installing custom library (legacy mode): \"${lib}\"`);\n\n try {\n await this.installNpm(lib);\n this.log.info(`Installed custom npm package (legacy mode): \"${lib}\"`);\n } catch (err: any) {\n this.log.warn(`Cannot install custom npm package \"${lib}\" (legacy mode): ${err.toString()}`);\n }\n }\n }\n\n // js-controller >= 6.x\n if (typeof this.uninstallNodeModule === 'function') {\n for (const installedNodeModule of installedNodeModules) {\n if (!keepModules.includes(installedNodeModule)) {\n try {\n await this.uninstallNodeModule(installedNodeModule);\n\n this.log.info(`Removed custom npm package: \"${installedNodeModule}\"`);\n } catch (err: any) {\n this.log.warn(`Cannot remove custom npm package ${installedNodeModule}: ${err.toString()}`);\n }\n }\n }\n }\n }\n\n createVM(source: string, name: string, wrapAsync: boolean): false | JsScript {\n if (this.context.debugMode && name !== this.context.debugMode) {\n return false;\n }\n\n if (!this.context.debugMode) {\n const logSubscriptionsText =\n \"\\n;\\nlog(`registered ${__engine.__subscriptions} subscription${__engine.__subscriptions === 1 ? '' : 's'},\" +\n \" ${__engine.__schedules} schedule${__engine.__schedules === 1 ? '' : 's'},\" +\n \" ${__engine.__subscriptionsMessage} message${__engine.__subscriptionsMessage === 1 ? '' : 's'},\" +\n \" ${__engine.__subscriptionsLog} log${__engine.__subscriptionsLog === 1 ? '' : 's'}\" +\n \" and ${__engine.__subscriptionsFile} file subscription${__engine.__subscriptionsFile === 1 ? '' : 's'}`);\\n\";\n\n if (wrapAsync) {\n source = `(async () => {\\n${source}\\n${logSubscriptionsText}\\n})();`;\n } else {\n source = `${source}\\n${logSubscriptionsText}`;\n }\n } else {\n if (wrapAsync) {\n source = `(async () => {debugger;\\n${source}\\n})();`;\n } else {\n source = `debugger;${source}`;\n }\n }\n\n try {\n const options: ScriptOptions = {\n filename: name,\n // displayErrors: true,\n // lineOffset: this.globalScriptLines\n };\n return {\n script: new Script(source, options),\n } as JsScript;\n } catch (err: unknown) {\n this.logError(`${name} compile failed:\\r\\nat `, err as Error);\n return false;\n }\n }\n\n execute(script: JsScript, name: string, engineType: ScriptType, verbose: boolean, debug: boolean): void {\n script.intervals = [];\n script.timeouts = [];\n script.schedules = [];\n script.wizards = [];\n script.name = name;\n script.engineType = engineType;\n script._id = Math.floor(Math.random() * 0xffffffff);\n script.subscribes = {};\n script.subscribesFile = {};\n script.setStatePerMinuteCounter = 0;\n script.setStatePerMinuteProblemCounter = 0;\n this.setState(`scriptProblem.${name.substring(SCRIPT_CODE_MARKER.length)}`, {\n val: false,\n ack: true,\n expire: 1000,\n });\n\n const sandbox = sandBox(script, name, verbose, debug, this.context);\n\n try {\n script.script.runInNewContext(sandbox, {\n filename: name,\n displayErrors: true,\n // lineOffset: this.globalScriptLines\n });\n } catch (err: unknown) {\n this.setState(`scriptProblem.${name.substring(SCRIPT_CODE_MARKER.length)}`, {\n val: true,\n ack: true,\n c: 'execute',\n });\n this.logError(name, err as Error);\n }\n }\n\n unsubscribe(id: string | RegExp | string[]): void {\n if (!id) {\n this.log.warn('unsubscribe: empty name');\n return;\n }\n\n if (Array.isArray(id)) {\n id.forEach(sub => unsubscribe(sub));\n return;\n }\n\n if (id.constructor && id.constructor.name === 'RegExp') {\n // adapter.log.warn('unsubscribe: todo - process regexp');\n return;\n }\n\n if (typeof id !== 'string') {\n this.log.error(`unsubscribe: invalid type of id - ${typeof id}`);\n return;\n }\n const parts = id.split('.');\n const _adapter = `system.adapter.${parts[0]}.${parts[1]}`;\n if (this.objects[_adapter]?.common?.subscribable) {\n const a = `${parts[0]}.${parts[1]}`;\n const alive = `system.adapter.${a}.alive`;\n if (this.adapterSubs[alive]) {\n const pos = this.adapterSubs[alive].indexOf(id);\n if (pos !== -1) {\n this.adapterSubs[alive].splice(pos, 1);\n }\n if (!this.adapterSubs[alive].length) {\n delete this.adapterSubs[alive];\n }\n }\n this.sendTo(a, 'unsubscribe', id);\n }\n }\n\n // Analyze if logs are still required or not\n updateLogSubscriptions(): void {\n let found = false;\n // go through all scripts and check if some script still requires logs\n Object.keys(this.logSubscriptions).forEach(scriptName => {\n if (!this.logSubscriptions?.[scriptName] || !this.logSubscriptions[scriptName].length) {\n delete this.logSubscriptions[scriptName];\n } else {\n found = true;\n }\n });\n\n if (this.requireLog) {\n if (found && !this.logSubscribed) {\n this.logSubscribed = true;\n this.requireLog(this.logSubscribed);\n this.log.info(`Subscribed to log messages (found logSubscriptions)`);\n } else if (!found && this.logSubscribed) {\n this.logSubscribed = false;\n this.requireLog(this.logSubscribed);\n this.log.info(`Unsubscribed from log messages (not found logSubscriptions)`);\n }\n }\n }\n\n async stopScript(name: string): Promise {\n this.log.info(`Stopping script ${name}`);\n\n await this.setState(`scriptEnabled.${name.substring(SCRIPT_CODE_MARKER.length)}`, false, true);\n\n if (this.messageBusHandlers[name]) {\n delete this.messageBusHandlers[name];\n }\n\n if (this.tempDirectories[name]) {\n try {\n this.mods.fs.rmSync(this.tempDirectories[name], { recursive: true });\n\n this.log.debug(`Removed temp directory of ${name}: ${this.tempDirectories[name]}`);\n } catch {\n this.log.warn(`Unable to remove temp directory of ${name}: ${this.tempDirectories[name]}`);\n }\n\n delete this.tempDirectories[name];\n }\n\n if (this.logSubscriptions[name]) {\n delete this.logSubscriptions[name];\n this.updateLogSubscriptions();\n }\n\n if (this.scripts[name]) {\n // Remove from subscriptions\n this.context.isEnums = false;\n if (this.config.subscribe) {\n // check all subscribed IDs\n Object.keys(this.scripts[name].subscribes).forEach(id => {\n if (this.subscribedPatterns[id]) {\n this.subscribedPatterns[id] -= this.scripts[name].subscribes[id];\n if (this.subscribedPatterns[id] <= 0) {\n this.unsubscribeForeignStates(id);\n delete this.subscribedPatterns[id];\n if (this.states[id]) {\n delete this.states[id];\n }\n }\n }\n });\n }\n\n for (let i = this.subscriptions.length - 1; i >= 0; i--) {\n if (this.subscriptions[i].name === name) {\n const sub = this.subscriptions.splice(i, 1)[0];\n if (sub?.pattern.id) {\n this.unsubscribe(sub.pattern.id);\n }\n } else {\n if (\n (!this.context.isEnums && this.subscriptions[i].pattern.enumName) ||\n this.subscriptions[i].pattern.enumId\n ) {\n this.context.isEnums = true;\n }\n }\n }\n\n // check all subscribed files\n Object.keys(this.scripts[name].subscribesFile).forEach(key => {\n if (this.subscribedPatternsFile[key]) {\n this.subscribedPatternsFile[key] -= this.scripts[name].subscribesFile[key];\n if (this.subscribedPatternsFile[key] <= 0) {\n const [id, file] = key.split('$%$');\n this.unsubscribeForeignFiles(id, file);\n delete this.subscribedPatternsFile[key];\n }\n }\n });\n for (let i = this.subscriptionsFile.length - 1; i >= 0; i--) {\n if (this.subscriptionsFile[i].name === name) {\n this.subscriptionsFile.splice(i, 1);\n }\n }\n\n for (let i = this.subscriptionsObject.length - 1; i >= 0; i--) {\n if (this.subscriptionsObject[i].name === name) {\n const sub = this.subscriptionsObject.splice(i, 1)[0];\n if (sub) {\n this.unsubscribeForeignObjects(sub.pattern);\n }\n }\n }\n\n // Stop all timeouts\n for (let i = 0; i < this.scripts[name].timeouts.length; i++) {\n clearTimeout(this.scripts[name].timeouts[i]);\n }\n // Stop all intervals\n for (let i = 0; i < this.scripts[name].intervals.length; i++) {\n clearInterval(this.scripts[name].intervals[i]);\n }\n // Stop all scheduled jobs\n for (let i = 0; i < this.scripts[name].schedules.length; i++) {\n if (this.scripts[name].schedules[i]) {\n const _name = this.scripts[name].schedules[i].name;\n if (!this.mods.nodeSchedule.cancelJob(this.scripts[name].schedules[i])) {\n this.log.error(`Error by canceling scheduled job \"${_name}\"`);\n }\n }\n }\n\n // Stop all time wizards jobs\n if (this.context.scheduler) {\n for (let i = 0; i < this.scripts[name].wizards.length; i++) {\n if (this.scripts[name].wizards[i]) {\n this.context.scheduler.remove(this.scripts[name].wizards[i]);\n }\n }\n }\n\n // if callback for on stop\n if (typeof this.scripts[name].onStopCb === 'function') {\n this.scripts[name].onStopTimeout =\n parseInt(this.scripts[name].onStopTimeout as unknown as string, 10) || 1000;\n\n await new Promise(resolve => {\n let timeout: NodeJS.Timeout | null = setTimeout(() => {\n if (timeout) {\n timeout = null;\n resolve(true);\n }\n }, this.scripts[name].onStopTimeout);\n\n try {\n this.scripts[name].onStopCb(() => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n resolve(true);\n }\n });\n } catch (err: unknown) {\n this.log.error(`error in onStop callback: ${err as Error}`);\n }\n });\n }\n\n delete this.scripts[name];\n return true;\n }\n return false;\n }\n\n async prepareScript(obj: ioBroker.ScriptObject): Promise {\n if (obj?.common?.enabled && this.debugState.scriptName === obj._id) {\n const id = obj._id;\n await this.debugStop();\n this.log.info(`Debugging of ${id} was stopped, because started in normal mode`);\n return this.prepareScript(obj);\n }\n\n if (\n obj?.common?.source &&\n (obj.common.enabled || this.context.debugMode === obj._id) &&\n obj.common.engine === `system.adapter.${this.namespace}`\n ) {\n const name = obj._id;\n\n const nameId = name.substring(SCRIPT_CODE_MARKER.length);\n if (!nameId.length || nameId.endsWith('.')) {\n this.log.error(`Script name ${name} is invalid!`);\n return false;\n }\n const idActive = `scriptEnabled.${nameId}`;\n if (!this.config.subscribe) {\n this.interimStateValues[idActive] = this.prepareStateObjectSimple(\n `${this.namespace}.${idActive}`,\n true,\n true,\n );\n }\n await this.setState(idActive, true, true);\n obj.common.engineType = obj.common.engineType || '';\n\n if (\n (obj.common.engineType as ScriptType).toLowerCase().startsWith('javascript') ||\n (obj.common.engineType as ScriptType) === 'Blockly' ||\n (obj.common.engineType as ScriptType) === 'Rules'\n ) {\n // Javascript\n this.log.info(`Start JavaScript ${name} (${obj.common.engineType})`);\n\n let sourceFn = name;\n if (webstormDebug) {\n const fn = name.replace(/^script.js./, '').replace(/\\./g, '/');\n sourceFn = this.mods.path.join(webstormDebug, `${fn}.js`);\n }\n const createdScript = this.createVM(`${this.globalScript}\\n${obj.common.source}`, sourceFn, true);\n if (!createdScript) {\n return false;\n }\n this.scripts[name] = createdScript;\n this.execute(\n this.scripts[name],\n sourceFn,\n obj.common.engineType as ScriptType,\n obj.common.verbose,\n obj.common.debug,\n );\n return true;\n }\n\n if (obj.common.engineType.toLowerCase().startsWith('typescript')) {\n // TypeScript\n this.log.info(`Compiling TypeScript source ${name}`);\n // The source code must be transformed in order to support top level await\n // and to force TypeScript to compile the code as a module\n const transformedSource = transformScriptBeforeCompilation(obj.common.source, false);\n // We need to hash both global declarations that are known until now\n // AND the script source, because changing either can change the compilation output\n const sourceHash = hashSource(tsSourceHashBase + this.globalDeclarations + transformedSource);\n\n let compiled: string;\n // If we already stored the compiled source code and the original source hash,\n // use the hash to check whether we can rely on the compiled source code or\n // if we need to compile it again\n if (\n typeof obj.common.compiled === 'string' &&\n typeof obj.common.sourceHash === 'string' &&\n sourceHash === obj.common.sourceHash\n ) {\n // We can reuse the stored source\n compiled = obj.common.compiled;\n this.log.info(`${name}: source code did not change, using cached compilation result...`);\n } else {\n // We don't have a hashed source code, or the original source changed, compile it\n const filename = scriptIdToTSFilename(name);\n let tsCompiled: CompileResult;\n try {\n tsCompiled = this.tsServer.compile(filename, transformedSource);\n } catch (err: unknown) {\n this.log.error(`${obj._id}: TypeScript compilation failed:\\n${err as Error}`);\n return false;\n }\n\n const errors = tsCompiled.diagnostics.map(diag => `${diag.annotatedSource}\\n`).join('\\n');\n\n if (tsCompiled.success) {\n if (errors.length > 0) {\n this.log.warn(`${name}: TypeScript compilation had errors:\\n${errors}`);\n } else {\n this.log.info(`${name}: TypeScript compilation successful`);\n }\n compiled = tsCompiled.result || '';\n\n // Store the compiled source and the original source hash, so we don't need to do the work again next time\n this.ignoreObjectChange.add(name); // ignore the next change and don't restart scripts\n await this.extendForeignObjectAsync(name, {\n common: {\n sourceHash,\n compiled,\n },\n });\n } else {\n this.log.error(`${name}: TypeScript compilation failed:\\n${errors}`);\n return false;\n }\n }\n const createdScript: JsScript | false = this.createVM(`${this.globalScript}\\n${compiled}`, name, false);\n if (!createdScript) {\n return false;\n }\n this.scripts[name] = createdScript;\n this.execute(\n this.scripts[name],\n name,\n obj.common.engineType as ScriptType,\n obj.common.verbose,\n obj.common.debug,\n );\n return true;\n }\n\n this.log.warn(`Unknown engine type for \"${name}\": ${obj.common.engineType}`);\n return false;\n }\n\n let _name: string;\n if (obj?._id) {\n _name = obj._id;\n const scriptIdName = _name.substring(SCRIPT_CODE_MARKER.length);\n\n if (!scriptIdName.length || scriptIdName.endsWith('.')) {\n this.log.error(`Script name ${_name} is invalid!`);\n return false;\n }\n await this.setState(`scriptEnabled.${scriptIdName}`, false, true);\n }\n if (!obj) {\n this.log.error('Invalid script');\n }\n return false;\n }\n\n async loadScriptById(id: string): Promise {\n let obj: ioBroker.ScriptObject | null | undefined;\n try {\n obj = (await this.getForeignObjectAsync(id)) as ioBroker.ScriptObject | null | undefined;\n } catch (err: any) {\n this.log.error(`Invalid script \"${id}\": ${err}`);\n }\n if (!obj) {\n return false;\n }\n return this.loadScript(obj);\n }\n\n async loadScript(nameOrObject: ioBroker.ScriptObject): Promise {\n // create states for scripts\n await this.createActiveObject(nameOrObject._id, nameOrObject?.common?.enabled);\n await this.createProblemObject(nameOrObject._id);\n return this.prepareScript(nameOrObject);\n }\n\n getAstroEvent(\n date: Date,\n astroEvent: AstroEventName,\n start: string,\n end: string,\n offsetMinutes: number | string,\n isDayEnd: boolean,\n latitude: number,\n longitude: number,\n useNextDay?: boolean,\n ): Date {\n let ts: Date = this.mods.suncalc.getTimes(date, latitude, longitude)[astroEvent];\n\n if (!ts || ts.getTime().toString() === 'NaN') {\n ts = isDayEnd ? getNextTimeEvent(end, useNextDay) : getNextTimeEvent(start, useNextDay);\n }\n ts.setMilliseconds(0);\n ts.setMinutes(ts.getMinutes() + (parseInt(offsetMinutes as unknown as string, 10) || 0));\n\n const [timeHoursStart, timeMinutesStart] = start.split(':');\n const nTimeHoursStart = parseInt(timeHoursStart, 10);\n const nTimeMinutesStart = parseInt(timeMinutesStart, 10) || 0;\n\n if (\n ts.getHours() < nTimeHoursStart ||\n (ts.getHours() === nTimeHoursStart && ts.getMinutes() < nTimeMinutesStart)\n ) {\n ts = getNextTimeEvent(start, useNextDay);\n ts.setSeconds(0);\n }\n\n const [timeHoursEnd, timeMinutesEnd] = end.split(':');\n const nTimeHoursEnd = parseInt(timeHoursEnd, 10);\n const nTimeMinutesEnd = parseInt(timeMinutesEnd, 10) || 0;\n\n if (ts.getHours() > nTimeHoursEnd || (ts.getHours() === nTimeHoursEnd && ts.getMinutes() > nTimeMinutesEnd)) {\n ts = getNextTimeEvent(end, useNextDay);\n ts.setSeconds(0);\n }\n\n // if event in the past\n if (date > ts && useNextDay) {\n // take the next day\n ts.setDate(ts.getDate() + 1);\n }\n return ts;\n }\n\n async timeSchedule(): Promise {\n const now = new Date();\n let hours = now.getHours();\n const minutes = now.getMinutes();\n if (this.timeSettings.format12) {\n if (hours > 12) {\n hours -= 12;\n }\n }\n let sHours: string;\n if (this.timeSettings.leadingZeros) {\n sHours = hours.toString().padStart(2, '0');\n } else {\n sHours = hours.toString();\n }\n\n await this.setState('variables.dayTime', {\n val: `${sHours}:${minutes.toString().padStart(2, '0')}`,\n ack: true,\n });\n\n now.setMinutes(now.getMinutes() + 1);\n now.setSeconds(0);\n now.setMilliseconds(0);\n const interval = now.getTime() - Date.now();\n this.timeScheduleTimer = setTimeout(() => this.timeSchedule(), interval);\n }\n\n async dayTimeSchedules(): Promise {\n // get astrological event\n if (\n this.config.latitude === undefined ||\n this.config.longitude === undefined ||\n (this.config.latitude as unknown as string) === '' ||\n (this.config.longitude as unknown as string) === '' ||\n this.config.latitude === null ||\n this.config.longitude === null\n ) {\n this.log.error('Longitude or latitude does not set. Cannot use astro.');\n return;\n }\n\n // Calculate the next event today\n const todayDate = getAstroStartOfDay();\n const nowDate = new Date();\n\n const todaySunrise = this.getAstroEvent(\n todayDate,\n this.config.sunriseEvent,\n this.config.sunriseLimitStart,\n this.config.sunriseLimitEnd,\n this.config.sunriseOffset,\n false,\n this.config.latitude,\n this.config.longitude,\n );\n const todaySunset = this.getAstroEvent(\n todayDate,\n this.config.sunsetEvent,\n this.config.sunsetLimitStart,\n this.config.sunsetLimitEnd,\n this.config.sunsetOffset,\n true,\n this.config.latitude,\n this.config.longitude,\n );\n\n // Sunrise\n let sunriseTimeout = todaySunrise.getTime() - nowDate.getTime();\n if (sunriseTimeout < 0 || sunriseTimeout > 3600000) {\n sunriseTimeout = 3600000;\n }\n\n // Sunset\n let sunsetTimeout = todaySunset.getTime() - nowDate.getTime();\n if (sunsetTimeout < 0 || sunsetTimeout > 3600000) {\n sunsetTimeout = 3600000;\n }\n\n const isDayTime: ioBroker.State | null | undefined = await this.getStateAsync('variables.isDayTime');\n let isDay: boolean;\n if (sunriseTimeout < 5000) {\n isDay = true;\n } else if (sunsetTimeout < 5000) {\n isDay = false;\n } else {\n // check if in between\n isDay = nowDate.getTime() > todaySunrise.getTime() - 60000 && nowDate <= todaySunset;\n }\n\n const valDayTime = isDayTime ? !!isDayTime.val : false;\n if (valDayTime !== isDay || isDayTime === null) {\n await this.setState('variables.isDayTime', isDay, true);\n }\n\n const dayLightSaving: ioBroker.State | null | undefined =\n await this.getStateAsync('variables.isDaylightSaving');\n const isDayLightSaving = dstOffsetAtDate(nowDate) !== 0;\n const val = dayLightSaving ? !!dayLightSaving.val : false;\n\n if (val !== isDayLightSaving || dayLightSaving === null) {\n await this.setState('variables.isDaylightSaving', isDayLightSaving, true);\n }\n\n let nextTimeout = sunriseTimeout;\n if (sunriseTimeout > sunsetTimeout) {\n nextTimeout = sunsetTimeout;\n }\n nextTimeout = nextTimeout - 3000;\n if (nextTimeout < 3000) {\n nextTimeout = 3000;\n }\n\n this.dayScheduleTimer = setTimeout(() => this.dayTimeSchedules(), nextTimeout);\n }\n\n stopTimeSchedules(): void {\n if (this.dayScheduleTimer) {\n clearTimeout(this.dayScheduleTimer);\n this.dayScheduleTimer = null;\n }\n if (this.sunScheduleTimer) {\n clearTimeout(this.sunScheduleTimer);\n this.sunScheduleTimer = null;\n }\n if (this.timeScheduleTimer) {\n clearTimeout(this.timeScheduleTimer);\n this.timeScheduleTimer = null;\n }\n }\n\n async patchFont(): Promise {\n let stat: Stats | undefined;\n let dbFile: Buffer | undefined;\n try {\n stat = statSync(`${__dirname}/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf`);\n const _dbFile = await this.readFileAsync(\n 'javascript.admin',\n `vs/base/browser/ui/codicons/codicon/codicon.ttf`,\n );\n if (_dbFile?.file) {\n dbFile = _dbFile.file as Buffer;\n }\n } catch {\n // ignore\n }\n\n if (stat?.size !== 73452 || dbFile?.byteLength !== 73452) {\n try {\n const buffer = Buffer.from(\n JSON.parse(readFileSync(`${__dirname}/admin/vsFont/codicon.json`).toString()),\n 'base64',\n );\n\n const jszip = await import('jszip');\n const zip = await jszip.loadAsync(buffer);\n let data: ArrayBuffer | undefined;\n if (zip) {\n data = await zip.file('codicon.ttf')?.async('arraybuffer');\n if (data?.byteLength !== 73452) {\n this.log.error(`Cannot patch font: invalid font file!`);\n return false;\n }\n } else {\n this.log.error(`Cannot patch font: invalid font file!`);\n return false;\n }\n writeFileSync(`${__dirname}/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf`, Buffer.from(data));\n // upload this file\n await this.writeFileAsync(\n 'javascript.admin',\n 'vs/base/browser/ui/codicons/codicon/codicon.ttf',\n Buffer.from(data),\n );\n return true;\n } catch (err: unknown) {\n this.log.error(`Cannot patch font: ${err as Error}`);\n return false;\n }\n }\n return false;\n }\n\n async sunTimeSchedules(): Promise {\n if (this.config.createAstroStates) {\n if (!isNaN(this.config.longitude) && !isNaN(this.config.longitude)) {\n const calcDate = getAstroStartOfDay();\n\n const times = this.mods.suncalc.getTimes(calcDate, this.config.latitude, this.config.longitude);\n\n this.log.debug(`[sunTimeSchedules] Times: ${JSON.stringify(times)}`);\n\n for (const t in times) {\n try {\n const objId = `variables.astro.${t}`;\n\n await this.setObjectNotExistsAsync(objId, {\n type: 'state',\n common: {\n name: `Astro ${t}`,\n type: 'string',\n role: 'value',\n read: true,\n write: false,\n },\n native: {},\n });\n\n if (times[t] !== null && !isNaN(times[t].getTime())) {\n const timeFormatted = formatHoursMinutesSeconds(times[t]);\n await this.setState(objId, {\n val: timeFormatted,\n c: times[t].toISOString(),\n ack: true,\n });\n } else {\n await this.setState(objId, { val: null, c: 'n/a', ack: true, q: 0x01 });\n }\n } catch (err: unknown) {\n this.log.error(\n `[sunTimeSchedules] Unable to set state for astro time \"${t}\" (${times[t].getTime()}): ${err as Error}`,\n );\n }\n }\n\n const todayDate = new Date();\n todayDate.setHours(0);\n todayDate.setMinutes(0);\n todayDate.setSeconds(1);\n todayDate.setMilliseconds(0);\n todayDate.setDate(todayDate.getDate() + 1);\n\n this.log.debug(`[sunTimeSchedules] Next: ${todayDate.toISOString()}`);\n this.sunScheduleTimer = setTimeout(() => this.sunTimeSchedules(), todayDate.getTime() - Date.now());\n }\n } else {\n // remove astro states if disabled\n this.delObject('variables.astro', { recursive: true });\n }\n }\n\n /**\n * Redirects the virtual-tsc log output to the ioBroker log\n */\n tsLog = (message: string, severity?: ioBroker.LogLevel): void => {\n // shift the severities around, we don't care about the small details\n if (!severity || severity === 'info') {\n severity = 'debug';\n } else if (severity === 'debug') {\n // Don't spam build logs on Travis\n if (isCI) {\n return;\n }\n severity = 'silly';\n }\n\n if (this?.log) {\n this.log[severity](message);\n } else {\n console.log(`[${severity.toUpperCase()}] ${message}`);\n }\n };\n\n addGetProperty(object: Record): void {\n try {\n Object.defineProperty(object, 'get', {\n value: function (id: string): any {\n return this[id] || this[`${this.namespace}.${id}`];\n },\n enumerable: false,\n });\n } catch {\n console.error('Cannot install get property');\n }\n }\n\n /**\n * @param scriptID - The current script the declarations were generated from\n * @param declarations\n */\n provideDeclarationsForGlobalScript(scriptID: string, declarations: string): void {\n // Remember which declarations this global script had access to,\n // we need this so the editor doesn't show a duplicate identifier error\n if (this.globalDeclarations != null && this.globalDeclarations !== '') {\n this.knownGlobalDeclarationsByScript[scriptID] = this.globalDeclarations;\n }\n // and concatenate the global declarations for the next scripts\n this.globalDeclarations += `${declarations}\\n`;\n // remember all previously generated global declarations,\n // so global scripts can reference each other\n const globalDeclarationPath = 'global.d.ts';\n tsAmbient[globalDeclarationPath] = this.globalDeclarations;\n // make sure the next script compilation has access to the updated declarations\n this.tsServer.provideAmbientDeclarations({\n [globalDeclarationPath]: this.globalDeclarations,\n });\n jsDeclarationServer.provideAmbientDeclarations({\n [globalDeclarationPath]: this.globalDeclarations,\n });\n }\n\n fixLineNo(line: string): string {\n if (line.includes('javascript.js:')) {\n return line;\n }\n if (!/script[s]?\\.js[.\\\\/]/.test(line)) {\n return line;\n }\n if (/:([\\d]+):/.test(line)) {\n line = line.replace(\n /:([\\d]+):/,\n ($0, $1) => `:${$1 > this.globalScriptLines + 1 ? $1 - this.globalScriptLines - 1 : $1}:`,\n ); // one line for 'async function ()'\n } else {\n line = line.replace(\n /:([\\d]+)$/,\n ($0, $1) => `:${$1 > this.globalScriptLines + 1 ? $1 - this.globalScriptLines - 1 : $1}`,\n ); // one line for 'async function ()'\n }\n return line;\n }\n\n debugStop(): Promise {\n if (this.debugState.child) {\n this.debugSendToInspector({ cmd: 'end' });\n this.debugState.endTimeout = setTimeout(() => {\n this.debugState.endTimeout = null;\n this.debugState.child?.kill('SIGTERM');\n }, 500);\n this.debugState.promiseOnEnd = this.debugState.promiseOnEnd || Promise.resolve(0);\n } else {\n this.debugState.promiseOnEnd = Promise.resolve(0);\n }\n\n return this.debugState.promiseOnEnd.then(() => {\n this.debugState.child = null;\n this.debugState.running = false;\n this.debugState.scriptName = '';\n if (this.debugState.endTimeout) {\n clearTimeout(this.debugState.endTimeout);\n this.debugState.endTimeout = null;\n }\n });\n }\n\n async debugDisableScript(id: string | undefined): Promise {\n if (id) {\n const obj = this.objects[id];\n if (obj?.common?.enabled) {\n await this.extendForeignObjectAsync(obj._id, { common: { enabled: false } });\n }\n }\n }\n\n debugSendToInspector(message: any): void {\n if (this.debugState.child) {\n try {\n this.log.info(`send to debugger: ${message}`);\n this.debugState.child.send(message);\n } catch {\n this.debugStop().then(() =>\n this.log.info(\n `Debugging of \"${this.debugState.scriptName}\" was stopped, because started in normal mode`,\n ),\n );\n }\n } else {\n this.log.error(`Cannot send command to terminated inspector`);\n this.setState(\n 'debug.from',\n JSON.stringify({ cmd: 'error', error: `Cannot send command to terminated inspector`, id: 1 }),\n true,\n );\n }\n }\n\n debugStart(data: { breakOnStart?: boolean; scriptName?: string; adapter?: string }): void {\n if (Date.now() - this.debugState.started < 1000) {\n console.log('Start ignored');\n return;\n }\n\n this.debugState.started = Date.now();\n // stop the script if it's running\n this.debugDisableScript(data.scriptName)\n .then(() => this.debugStop())\n .then(() => {\n if (data.adapter) {\n this.debugState.adapterInstance = data.adapter;\n this.debugState.scriptName = '';\n } else {\n this.debugState.adapterInstance = '';\n this.debugState.scriptName = data.scriptName as string;\n }\n\n this.debugState.breakOnStart = data.breakOnStart;\n\n this.debugState.promiseOnEnd = new Promise(resolve => {\n const options: ForkOptions = {\n stdio: ['ignore', 'inherit', 'inherit', 'ipc'],\n //stdio: ['pipe', 'pipe', 'pipe', 'ipc']\n };\n const args: string[] = [];\n if (this.debugState.adapterInstance) {\n args.push('--breakOnStart');\n }\n\n this.debugState.child = fork(`${__dirname}/lib/inspect.ts`, args, options);\n\n /*debugState.child.stdout.setEncoding('utf8');\n debugState.child.stderr.setEncoding('utf8');\n debugState.child.stdout.on('data', childPrint);\n debugState.child.stderr.on('data', childPrint);*/\n\n this.debugState.child?.on(\n 'message',\n (\n message:\n | string\n | {\n cmd: 'ready' | 'watched' | 'paused' | 'resumed' | 'log' | 'readyToDebug';\n severity?: string;\n text?: string;\n scriptId?: string;\n script?: string;\n },\n ) => {\n let oMessage: {\n cmd: 'ready' | 'watched' | 'paused' | 'resumed' | 'log' | 'readyToDebug';\n severity?: string;\n text?: string;\n scriptId?: string;\n script?: string;\n };\n if (typeof message === 'string') {\n try {\n oMessage = JSON.parse(message);\n } catch {\n return this.log.error(`Cannot parse message from inspector: ${message}`);\n }\n } else {\n oMessage = message;\n }\n\n if (oMessage.cmd !== 'ready') {\n this.setState('debug.from', JSON.stringify(oMessage), true);\n }\n\n switch (oMessage.cmd) {\n case 'ready': {\n this.debugSendToInspector({\n cmd: 'start',\n scriptName: this.debugState.scriptName,\n adapterInstance: this.debugState.adapterInstance,\n instance: this.instance,\n });\n break;\n }\n\n case 'watched': {\n //console.log(`WATCHED: ${JSON.stringify(oMessage)}`);\n break;\n }\n\n case 'paused': {\n this.debugState.paused = true;\n console.log(`host: PAUSED`);\n break;\n }\n\n case 'resumed': {\n this.debugState.paused = false;\n //console.log(`STARTED`);\n break;\n }\n\n case 'log': {\n console.log(`[${oMessage.severity}] ${oMessage.text}`);\n break;\n }\n\n case 'readyToDebug': {\n console.log(\n `host: readyToDebug (set breakpoints): [${oMessage.scriptId}] ${oMessage.script}`,\n );\n break;\n }\n }\n },\n );\n this.debugState.child?.on('error', error => {\n this.log.error(`Cannot start inspector: ${error}`);\n this.setState('debug.from', JSON.stringify({ cmd: 'error', error }), true);\n });\n\n this.debugState.child?.on('exit', (code: number): void => {\n if (code) {\n this.setState(\n 'debug.from',\n JSON.stringify({ cmd: 'error', error: `invalid response code: ${code}` }),\n true,\n );\n }\n this.setState('debug.from', JSON.stringify({ cmd: 'debugStopped', code }), true);\n this.debugState.child = null;\n resolve(code);\n });\n });\n });\n }\n}\n\nfunction patternMatching(\n event: EventObj,\n patternFunctions: PatternEventCompareFunction[] & { logic?: 'and' | 'or' },\n): boolean {\n let matched = false;\n for (let i = 0, len = patternFunctions.length; i < len; i++) {\n if (patternFunctions[i](event)) {\n if (patternFunctions.logic === 'or') {\n return true;\n }\n matched = true;\n } else if (patternFunctions.logic === 'and') {\n return false;\n }\n }\n return matched;\n}\n\n// If started as allInOne mode => return function to create instance\nif (require.main !== module) {\n // Export the constructor in compact mode\n module.exports = (options: Partial | undefined) => new JavaScript(options);\n} else {\n // otherwise start the instance directly\n (() => new JavaScript())();\n}\n"]} \ No newline at end of file +{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qCAAqD;AACrD,qCAAwF;AACxF,yCAAiD;AACjD,2DAA4D;AAC5D,6CAAkE;A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,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;oBACjF,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC;oBAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACX,CAAC;CACJ;AAED,SAAS,eAAe,CACpB,KAAe,EACf,gBAA0E;IAE1E,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1D,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,gBAAgB,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;gBAClC,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;aAAM,IAAI,gBAAgB,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,oEAAoE;AACpE,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,yCAAyC;IACzC,MAAM,CAAC,OAAO,GAAG,CAAC,OAA4C,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/F,CAAC;KAAM,CAAC;IACJ,wCAAwC;IACxC,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["/*\n * Javascript adapter\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2014-2024 bluefox ,\n *\n * Copyright (c) 2014 hobbyquaker\n */\n\nimport { Script, type ScriptOptions } from 'node:vm';\nimport { readFileSync, existsSync, statSync, writeFileSync, type Stats } from 'node:fs';\nimport { join, sep, normalize } from 'node:path';\nimport { fork, type ForkOptions } from 'node:child_process';\nimport { setTypeScriptResolveOptions, Server } from 'virtual-tsc';\nimport { isDeepStrictEqual } from 'node:util';\n\nimport * as dgram from 'node:dgram';\nimport * as crypto from 'node:crypto';\nimport * as dns from 'node:dns';\nimport * as events from 'node:events';\nimport * as http from 'node:http';\nimport * as https from 'node:https';\nimport * as http2 from 'node:http2';\nimport * as net from 'node:net';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\nimport * as util from 'node:util';\nimport * as child_process from 'node:child_process';\nimport * as stream from 'node:stream';\nimport * as zlib from 'node:zlib';\n\n// @ts-expect-error no types available\nimport * as suncalc from 'suncalc2';\nimport * as axios from 'axios';\n// @ts-expect-error no types available\nimport * as wake_on_lan from 'wake_on_lan';\nimport * as nodeSchedule from 'node-schedule';\n\nimport { getAbsoluteDefaultDataDir, Adapter, EXIT_CODES, type AdapterOptions } from '@iobroker/adapter-core';\nimport type SentryPlugin from '@iobroker/plugin-sentry';\nimport type { GetTimesResult } from 'suncalc';\nimport type { CompileResult } from 'virtual-tsc/build/util';\n\nimport { Mirror } from './lib/mirror';\nimport ProtectFs from './lib/protectFs';\nimport { setLanguage, getLanguage } from './lib/words';\nimport { sandBox } from './lib/sandbox';\nimport { requestModuleNameByUrl } from './lib/nodeModulesManagement';\nimport { createEventObject, type EventObj } from './lib/eventObj';\nimport { type AstroEventName, Scheduler } from './lib/scheduler';\nimport { targetTsLib, tsCompilerOptions, jsDeclarationCompilerOptions } from './lib/typescriptSettings';\nimport { hashSource } from './lib/tools';\nimport {\n resolveTypescriptLibs,\n resolveTypings,\n scriptIdToTSFilename,\n transformScriptBeforeCompilation,\n transformGlobalDeclarations,\n} from './lib/typescriptTools';\nimport type {\n FileSubscriptionResult,\n JavascriptContext,\n JavaScriptAdapterConfig,\n JsScript,\n ScriptType,\n SubscriptionResult,\n SubscribeObject,\n JavascriptTimer,\n SandboxType,\n LogMessage,\n DebugState,\n} from './types';\nimport type { PatternEventCompareFunction } from './lib/patternCompareFunctions';\n\ntype MODULES = {\n fs: ProtectFs;\n 'fs/promises': ProtectFs['promises'];\n dgram: typeof dgram;\n crypto: typeof crypto;\n dns: typeof dns;\n events: typeof events;\n http: typeof http;\n https: typeof https;\n http2: typeof http2;\n net: typeof net;\n os: typeof os;\n path: typeof path;\n util: typeof util;\n child_process: typeof child_process;\n stream: typeof stream;\n zlib: typeof zlib;\n suncalc: typeof suncalc;\n axios: typeof axios;\n wake_on_lan: typeof wake_on_lan;\n nodeSchedule: typeof nodeSchedule;\n};\n\n/**\n * List of forbidden Locations for a mirror directory\n * relative to the default data directory\n * ATTENTION: the same list is also located in index_m.html!!\n */\nconst forbiddenMirrorLocations: string[] = [\n 'backup-objects',\n 'files',\n 'backitup',\n '../backups',\n '../node_modules',\n '../log',\n];\n\nconst packageJson: Record = JSON.parse(readFileSync(`${__dirname}/../package.json`).toString());\nconst SCRIPT_CODE_MARKER = 'script.js.';\n\nlet webstormDebug: string | undefined;\n\nconst isCI = !!process.env.CI;\n\n// ambient declarations for typescript\nlet tsAmbient: Record;\n\n// TypeScript's scripts are only recompiled if their source hash changes.\n// If an adapter update fixes the compilation bugs, a user won't notice until the changes and re-saves the script.\n// To avoid that, we also include the\n// adapter version and TypeScript version in the hash\nconst tsSourceHashBase = `versions:adapter=${packageJson.version},typescript=${packageJson.dependencies.typescript}`;\n\n// taken from here: https://stackoverflow.com/questions/11887934/how-to-check-if-dst-daylight-saving-time-is-in-effect-and-if-so-the-offset\nfunction dstOffsetAtDate(dateInput: Date): number {\n const fullYear: number = dateInput.getFullYear() | 0;\n // \"Leap Years are any year that can be exactly divided by 4 (2012, 2016, etc)\n // except if it can be exactly divided by 100, then it isn't (2100, 2200, etc)\n // except if it can be exactly divided by 400, then it is (2000, 2400)\"\n // (https://www.mathsisfun.com/leap-years.html).\n const isLeapYear: 1 | 0 = ((fullYear & 3) | ((fullYear / 100) & 3)) === 0 ? 1 : 0;\n // (fullYear & 3) = (fullYear % 4), but faster\n //Alternative:var isLeapYear=(new Date(currentYear,1,29,12)).getDate()===29?1:0\n const fullMonth: number = dateInput.getMonth() | 0;\n return (\n // 1. We know what the time since the Epoch really is\n +dateInput - // same as the dateInput.getTime() method\n // 2. We know what the time since the Epoch at the start of the year is\n +new Date(fullYear, 0) - // day defaults to 1 if not explicitly zeroed\n // 3. Now, subtract what we would expect the time to be if daylight savings\n // did not exist. This yields the time-offset due to daylight savings.\n // Calculate the day of the year in the Gregorian calendar\n // The code below works based upon the facts of signed right shifts\n // • (x) >> n: shifts n and fills in the n highest bits with 0s\n // • (-x) >> n: shifts n and fills in the n highest bits with 1s\n // (This assumes that x is a positive integer)\n ((((-1 + // the first day in the year is day 1\n (31 & (-fullMonth >> 4)) + // January // (-11)>>4 = -1\n ((28 + isLeapYear) & ((1 - fullMonth) >> 4)) + // February\n (31 & ((2 - fullMonth) >> 4)) + // March\n (30 & ((3 - fullMonth) >> 4)) + // April\n (31 & ((4 - fullMonth) >> 4)) + // May\n (30 & ((5 - fullMonth) >> 4)) + // June\n (31 & ((6 - fullMonth) >> 4)) + // July\n (31 & ((7 - fullMonth) >> 4)) + // August\n (30 & ((8 - fullMonth) >> 4)) + // September\n (31 & ((9 - fullMonth) >> 4)) + // October\n (30 & ((10 - fullMonth) >> 4)) + // November\n // There are no months past December: the year rolls into the next.\n // Thus, \"fullMonth\" is 0-based, so it will never be 12 in JavaScript\n\n (dateInput.getDate() | 0)) & // get day of the month\n 0xffff) *\n 24 *\n 60 + // 24 hours in a day, 60 minutes in an hour\n (dateInput.getHours() & 0xff) * 60 + // 60 minutes in an hour\n (dateInput.getMinutes() & 0xff)) |\n 0) *\n 60 *\n 1000 - // 60 seconds in a minute * 1000 milliseconds in a second\n (dateInput.getSeconds() & 0xff) * 1000 - // 1000 milliseconds in a second\n dateInput.getMilliseconds()\n );\n}\n\nconst regExGlobalOld = /_global$/;\nconst regExGlobalNew = /script\\.js\\.global\\./;\n\nfunction checkIsGlobal(obj: ioBroker.ScriptObject): boolean {\n return obj?.common && (regExGlobalOld.test(obj.common.name) || regExGlobalNew.test(obj._id));\n}\n\nfunction fileMatching(sub: FileSubscriptionResult, id: string, fileName: string): boolean {\n if (sub.idRegEx) {\n if (!sub.idRegEx.test(id)) {\n return false;\n }\n } else {\n if (sub.id !== id) {\n return false;\n }\n }\n if (sub.fileRegEx) {\n if (!sub.fileRegEx.test(fileName)) {\n return false;\n }\n } else {\n if (sub.fileNamePattern !== fileName) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction getNextTimeEvent(time: string, useNextDay?: boolean): Date {\n const now: Date = getAstroStartOfDay();\n const [timeHours, timeMinutes] = time.split(':');\n const nTimeHours = parseInt(timeHours, 10);\n const nTimeMinutes = parseInt(timeMinutes, 10);\n if (\n useNextDay &&\n (now.getHours() > nTimeHours || (now.getHours() === nTimeHours && now.getMinutes() > nTimeMinutes))\n ) {\n now.setDate(now.getDate() + 1);\n }\n\n now.setHours(nTimeHours);\n now.setMinutes(nTimeMinutes);\n\n return now;\n}\n\nfunction getAstroStartOfDay(): Date {\n const d = new Date();\n d.setMinutes(0);\n d.setSeconds(0);\n d.setMilliseconds(0);\n d.setTime(d.getTime() - d.getTimezoneOffset() * 60 * 1000);\n d.setUTCHours(0);\n\n return d;\n}\n\nfunction formatHoursMinutesSeconds(date: Date): string {\n const h = String(date.getHours());\n const m = String(date.getMinutes());\n const s = String(date.getSeconds());\n\n return `${h.padStart(2, '0')}:${m.padStart(2, '0')}:${s.padStart(2, '0')}`;\n}\n\n// Due to a npm bug, virtual-tsc may be hoisted to the top level node_modules but\n// typescript may still be in the adapter level (https://npm.community/t/packages-with-peerdependencies-are-incorrectly-hoisted/4794),\n// so we need to tell virtual-tsc where typescript is\nsetTypeScriptResolveOptions({\n paths: [require.resolve('typescript')],\n});\n\n// compiler instance for global JS declarations\nconst jsDeclarationServer: Server = new Server(jsDeclarationCompilerOptions, isCI ? false : undefined);\n/**\n * Stores the IDs of script objects whose change should be ignored because\n * the compiled source was just updated\n */\n\nclass JavaScript extends Adapter {\n public declare config: JavaScriptAdapterConfig;\n\n private readonly context: JavascriptContext;\n\n private errorLogFunction: {\n error: (msg: string) => void;\n warn: (msg: string) => void;\n info: (msg: string) => void;\n debug: (msg: string) => void;\n silly: (msg: string) => void;\n } = {\n error: (msg: string) => console.error(msg),\n warn: (msg: string) => console.warn(msg),\n info: (msg: string) => console.log(msg),\n debug: (msg: string) => console.debug(msg),\n silly: (msg: string) => console.debug(msg),\n };\n\n private readonly mods: MODULES;\n\n private objectsInitDone = false;\n private statesInitDone = false;\n\n private objects: Record = {};\n private states: Record = {};\n private readonly interimStateValues: Record = {};\n private readonly stateIds: string[] = [];\n private readonly subscriptions: SubscriptionResult[] = [];\n private readonly subscriptionsFile: FileSubscriptionResult[] = [];\n private readonly subscriptionsObject: SubscribeObject[] = [];\n private readonly subscribedPatterns: Record = {};\n private readonly subscribedPatternsFile: Record = {};\n private readonly adapterSubs: Record = {};\n private readonly timers: { [scriptName: string]: JavascriptTimer[] } = {};\n private readonly _enums: string[] = [];\n private readonly names: { [name: string]: string | string[] } = {}; // name: id\n private readonly scripts: Record = {};\n private readonly messageBusHandlers: Record<\n string,\n Record void }[]>\n > = {};\n private readonly logSubscriptions: Record<\n string,\n {\n sandbox: SandboxType;\n cb: (info: LogMessage) => void;\n id: number;\n severity: ioBroker.LogLevel | '*';\n }[]\n > = {};\n private readonly tempDirectories: { [scriptName: string]: string } = {}; // name: path\n private readonly folderCreationVerifiedObjects: Record = {};\n\n /** if logs are subscribed or not */\n private logSubscribed = false;\n\n private timeSettings: {\n format12: boolean;\n leadingZeros: boolean;\n } = { format12: false, leadingZeros: true };\n\n private dayScheduleTimer: NodeJS.Timeout | null = null; // schedule for astrological day\n private sunScheduleTimer: NodeJS.Timeout | null = null; // schedule for sun moment times\n private timeScheduleTimer: NodeJS.Timeout | null = null; // schedule for astrological day\n\n private activeStr = ''; // enabled state prefix\n\n private mirror: Mirror | undefined;\n\n private stopCounters: Record = {};\n\n private setStateCountCheckInterval: NodeJS.Timeout | null = null;\n\n private globalScript = '';\n /** Generated declarations for global TypeScripts */\n private globalDeclarations = '';\n // Remember which definitions the global scripts\n // have access to, because it depends on the compilation order\n private knownGlobalDeclarationsByScript: Record = {};\n private globalScriptLines = 0;\n // compiler instance for typescript\n private tsServer: Server;\n\n private readonly ignoreObjectChange: Set = new Set();\n\n private debugState: DebugState = {\n scriptName: '',\n child: null,\n promiseOnEnd: null,\n paused: false,\n started: 0,\n running: false,\n };\n\n constructor(options: Partial = {}) {\n options = {\n ...options,\n name: 'javascript', // adapter name\n useFormatDate: true,\n /**\n * If the JS-Controller catches an unhandled error, this will be called\n * so we have a chance to handle it ourselves.\n */\n error: (err: Error): boolean => {\n // Identify unhandled errors originating from callbacks in scripts\n // These are not caught by wrapping the execution code in try-catch\n if (err && typeof err.stack === 'string') {\n const scriptCodeMarkerIndex = err.stack.indexOf(SCRIPT_CODE_MARKER);\n if (scriptCodeMarkerIndex > -1) {\n // This is a script error\n let scriptName = err.stack.substring(scriptCodeMarkerIndex);\n scriptName = scriptName.substring(0, scriptName.indexOf(':'));\n this.logError(scriptName, err);\n\n // Leave the script running for now\n // signal to the JS-Controller that we handled the error ourselves\n return true;\n }\n // check if a path contains adaptername but not own node_module\n // this regex matched \"iobroker.javascript/\" if NOT followed by \"node_modules\"\n if (!err.stack.match(/iobroker\\.javascript[/\\\\](?!.*node_modules).*/g)) {\n // This is an error without any info on origin (mostly async errors like connection errors)\n // also consider it as being from a script\n this.log.error(\n 'An error happened which is most likely from one of your scripts, but the originating script could not be detected.',\n );\n this.log.error(`Error: ${err.message}`);\n this.log.error(err.stack);\n\n // signal to the JS-Controller that we handled the error ourselves\n return true;\n }\n }\n\n return false;\n },\n };\n\n super(options as AdapterOptions);\n\n this.on('objectChange', this.onObjectChange.bind(this));\n this.on('stateChange', this.onStateChange.bind(this));\n this.on('ready', this.onReady.bind(this));\n this.on('message', this.onMessage.bind(this));\n this.on('unload', this.onUnload.bind(this));\n this.on('fileChange', this.onFileChange.bind(this));\n this.on('log', this.onLog.bind(this));\n\n this.mods = {\n fs: {} as ProtectFs,\n 'fs/promises': {} as ProtectFs['promises'],\n dgram,\n crypto,\n dns,\n events,\n http,\n https,\n http2,\n net,\n os,\n path,\n util,\n child_process,\n stream,\n zlib,\n\n suncalc,\n axios,\n wake_on_lan,\n nodeSchedule,\n };\n\n // check the webstorm debug and just debug modes\n let debugMode: string | undefined;\n if (process.argv) {\n for (let a = 1; a < process.argv.length; a++) {\n if (process.argv[a].startsWith('--webstorm')) {\n webstormDebug = process.argv[a].replace(/^(.*?=\\s*)/, '');\n }\n if (process.argv[a] === '--debugScript') {\n if (!process.argv[a + 1]) {\n console.log('No script name provided');\n process.exit(300);\n } else {\n debugMode = process.argv[a + 1];\n }\n }\n }\n }\n\n this.context = {\n mods: this.mods,\n objects: this.objects,\n states: this.states,\n interimStateValues: this.interimStateValues,\n stateIds: this.stateIds,\n errorLogFunction: this.errorLogFunction,\n subscriptions: this.subscriptions,\n subscriptionsFile: this.subscriptionsFile,\n subscriptionsObject: this.subscriptionsObject,\n subscribedPatterns: this.subscribedPatterns,\n subscribedPatternsFile: this.subscribedPatternsFile,\n adapterSubs: this.adapterSubs,\n cacheObjectEnums: {},\n timers: this.timers,\n enums: this._enums,\n names: this.names,\n scripts: this.scripts,\n messageBusHandlers: this.messageBusHandlers,\n logSubscriptions: this.logSubscriptions,\n tempDirectories: this.tempDirectories,\n folderCreationVerifiedObjects: this.folderCreationVerifiedObjects,\n\n isEnums: false, // If some subscription wants enum\n channels: null,\n devices: null,\n logWithLineInfo: this.logWithLineInfo.bind(this),\n scheduler: null,\n timerId: 0,\n rulesOpened: null, // opened rules\n language: this.language || 'en',\n\n updateLogSubscriptions: this.updateLogSubscriptions.bind(this),\n convertBackStringifiedValues: this.convertBackStringifiedValues.bind(this),\n updateObjectContext: this.updateObjectContext.bind(this),\n prepareStateObject: this.prepareStateObject.bind(this),\n debugMode,\n getAbsoluteDefaultDataDir,\n adapter: this as unknown as ioBroker.Adapter,\n logError: this.logError.bind(this),\n };\n\n this.tsServer = new Server(tsCompilerOptions, this.tsLog);\n }\n\n async onObjectChange(id: string, obj?: ioBroker.Object | null): Promise {\n // Check if we should ignore this change (once!) because we just updated the compiled sources\n if (this.ignoreObjectChange.has(id)) {\n // Update the cached script object and do nothing more\n this.objects[id] = obj as ioBroker.Object;\n this.ignoreObjectChange.delete(id);\n return;\n }\n\n // When still in initializing: already remember current values,\n // but data structures are initialized elsewhere\n if (!this.objectsInitDone) {\n if (obj) {\n this.objects[id] = obj;\n }\n return;\n }\n\n if (id.startsWith('enum.')) {\n // clear cache\n this.context.cacheObjectEnums = {};\n\n // update this._enums array\n if (obj) {\n // If new\n if (!this._enums.includes(id)) {\n this._enums.push(id);\n this._enums.sort();\n }\n } else {\n const pos = this._enums.indexOf(id);\n // if deleted\n if (pos !== -1) {\n this._enums.splice(pos, 1);\n }\n }\n }\n\n if (id === 'system.config' && obj?.common?.language) {\n // set language for debug messages\n setLanguage(obj.common.language);\n this.language = obj.common.language;\n this.context.language = this.language as ioBroker.Languages;\n }\n\n // update stored time format for variables.dayTime\n if (id === `${this.namespace}.variables.dayTime` && obj?.native) {\n this.timeSettings.format12 = obj.native.format12 || false;\n this.timeSettings.leadingZeros = obj.native.leadingZeros === undefined ? true : obj.native.leadingZeros;\n }\n\n // send changes to disk mirror\n this.mirror?.onObjectChange(id, obj as ioBroker.ScriptObject | null);\n\n const formerObj = this.objects[id];\n\n this.updateObjectContext(id, obj); // Update all Meta object data\n\n // for the alias object changes on the state objects, we need to manually update the\n // state cache value, because the new value is only published on the next change\n if (obj?.type === 'state' && id.startsWith('alias.0.')) {\n // execute async for speed\n this.getForeignStateAsync(id)\n .then(state => {\n if (state) {\n this.states[id] = state;\n } else if (this.states[id] !== undefined) {\n delete this.states[id];\n }\n })\n .catch(() => {\n /* ignore */\n });\n }\n\n this.subscriptionsObject.forEach(sub => {\n // ToDo: implement comparing with id.0.* too\n if (sub.pattern === id) {\n try {\n sub.callback(id, obj);\n } catch (err: any) {\n this.log.error(`Error in callback: ${err.toString()}`);\n }\n }\n });\n\n // handle Script object updates\n if (!obj && formerObj?.type === 'script') {\n // Object Deleted just now\n if (checkIsGlobal(formerObj)) {\n // it was a global Script, and it was enabled and is now deleted => restart adapter\n if (formerObj.common.enabled) {\n this.log.info(`Active global Script ${id} deleted. Restart instance.`);\n this.restart();\n }\n } else if (formerObj.common?.engine === `system.adapter.${this.namespace}`) {\n // It was a non-global Script and deleted => stop and remove it\n await this.stopScript(id);\n\n // delete scriptEnabled.blabla variable\n const idActive = `scriptEnabled.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n await this.delStateAsync(idActive);\n await this.delObjectAsync(idActive);\n\n // delete scriptProblem.blabla variable\n const idProblem = `scriptProblem.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n await this.delStateAsync(idProblem);\n await this.delObjectAsync(idProblem);\n }\n } else if (!formerObj && obj?.type === 'script') {\n // New script that does not exist before\n if (checkIsGlobal(obj)) {\n // new global script added => restart adapter\n if (obj.common.enabled) {\n this.log.info(`Active global Script ${id} created. Restart instance.`);\n this.restart();\n }\n } else if (obj.common?.engine === `system.adapter.${this.namespace}`) {\n // new non-global script - create states for scripts\n await this.createActiveObject(id, obj.common.enabled);\n await this.createProblemObject(id);\n if (obj.common.enabled) {\n // if enabled => Start script\n await this.loadScriptById(id);\n }\n }\n } else if (obj?.type === 'script' && formerObj?.common) {\n // Script changed ...\n if (checkIsGlobal(obj)) {\n if (obj.common.enabled || formerObj.common.enabled) {\n this.log.info(`Global Script ${id} updated. Restart instance.`);\n this.restart();\n }\n } else {\n // No global script\n if (obj.common?.engine === `system.adapter.${this.namespace}`) {\n // create states for scripts\n await this.createActiveObject(id, obj.common.enabled);\n await this.createProblemObject(id);\n }\n\n if (\n (formerObj.common.enabled && !obj.common.enabled) ||\n (formerObj.common.engine === `system.adapter.${this.namespace}` &&\n obj.common.engine !== `system.adapter.${this.namespace}`)\n ) {\n // Script disabled\n if (formerObj.common.enabled && formerObj.common.engine === `system.adapter.${this.namespace}`) {\n // Remove it from executing\n await this.stopScript(id);\n }\n } else if (\n (!formerObj.common.enabled && obj.common.enabled) ||\n (formerObj.common.engine !== `system.adapter.${this.namespace}` &&\n obj.common.engine === `system.adapter.${this.namespace}`)\n ) {\n // Script enabled\n\n if (obj.common.enabled && obj.common.engine === `system.adapter.${this.namespace}`) {\n // Start script\n await this.loadScriptById(id);\n }\n } else {\n // if (obj.common.source !== formerObj.common.source) {\n // Source changed => restart the script\n this.stopCounters[id] = this.stopCounters[id] ? this.stopCounters[id] + 1 : 1;\n this.stopScript(id).then(() => {\n // only start again after stop when \"last\" object change to prevent problems on\n // multiple changes in fast frequency\n if (!--this.stopCounters[id]) {\n this.loadScriptById(id);\n }\n });\n }\n }\n }\n }\n\n onStateChange(id: string, state?: ioBroker.State | null): void {\n if (this.interimStateValues[id] !== undefined) {\n // any update invalidates the remembered interim value\n delete this.interimStateValues[id];\n }\n if (!id || id.startsWith('messagebox.') || id.startsWith('log.')) {\n return;\n }\n\n if (id === `${this.namespace}.debug.to` && state && !state.ack) {\n if (!this.context.debugMode) {\n this.debugSendToInspector(state.val);\n }\n return;\n }\n\n // When still in initializing: already remember current values,\n // but data structures are initialized elsewhere\n if (!this.statesInitDone) {\n if (state) {\n this.states[id] = state;\n }\n return;\n }\n\n const oldState: ioBroker.State | null | undefined = this.states[id];\n if (state) {\n if (oldState) {\n // enable or disable script\n if (!state.ack && id.startsWith(this.activeStr) && this.objects[id]?.native?.script) {\n this.extendForeignObject(this.objects[id].native.script, {\n common: { enabled: state.val },\n });\n }\n\n // monitor if adapter is alive and send all subscriptions once more, after adapter goes online\n if (/*oldState && */ oldState.val === false && state.val && id.endsWith('.alive')) {\n if (this.adapterSubs[id]) {\n const parts = id.split('.');\n const a = `${parts[2]}.${parts[3]}`;\n for (let t = 0; t < this.adapterSubs[id].length; t++) {\n this.log.info(`Detected coming adapter \"${a}\". Send subscribe: ${this.adapterSubs[id][t]}`);\n this.sendTo(a, 'subscribe', this.adapterSubs[id][t]);\n }\n }\n }\n } else if (/*!oldState && */ !this.stateIds.includes(id)) {\n this.stateIds.push(id);\n this.stateIds.sort();\n }\n this.states[id] = state;\n } else {\n if (oldState) {\n delete this.states[id];\n }\n state = {} as ioBroker.State;\n const pos = this.stateIds.indexOf(id);\n if (pos !== -1) {\n this.stateIds.splice(pos, 1);\n }\n }\n const _eventObj = createEventObject(\n this.context,\n id,\n this.convertBackStringifiedValues(id, state),\n this.convertBackStringifiedValues(id, oldState),\n );\n\n // if this state matches any subscriptions\n for (let i = 0, l = this.subscriptions.length; i < l; i++) {\n const sub = this.subscriptions[i];\n if (sub?.patternCompareFunctions && patternMatching(_eventObj, sub.patternCompareFunctions)) {\n try {\n sub.callback(_eventObj);\n } catch (err: any) {\n this.log.error(`Error in callback: ${err.toString()}`);\n }\n }\n }\n }\n\n onFileChange(id: string, fileName: string, size: number | null): void {\n // if this file matches any subscriptions\n for (let i = 0, l = this.subscriptionsFile.length; i < l; i++) {\n const sub = this.subscriptionsFile[i];\n if (sub && fileMatching(sub, id, fileName)) {\n try {\n sub.callback(id, fileName, size, sub.withFile);\n } catch (err: any) {\n this.log.error(`Error in callback: ${err.toString()}`);\n }\n }\n }\n }\n\n async onUnload(callback: () => void): Promise {\n await this.debugStop();\n this.stopTimeSchedules();\n if (this.setStateCountCheckInterval) {\n clearInterval(this.setStateCountCheckInterval);\n this.setStateCountCheckInterval = null;\n }\n await this.stopAllScripts();\n if (typeof callback === 'function') {\n callback();\n }\n }\n\n async onReady(): Promise {\n this.errorLogFunction = this.log;\n this.context.errorLogFunction = this.log;\n\n this.config.maxSetStatePerMinute = parseInt(this.config.maxSetStatePerMinute as unknown as string, 10) || 1000;\n this.config.maxTriggersPerScript = parseInt(this.config.maxTriggersPerScript as unknown as string, 10) || 100;\n\n if (this.supportsFeature && this.supportsFeature('PLUGINS')) {\n const sentryInstance: InstanceType = this.getPluginInstance('sentry') as InstanceType<\n typeof SentryPlugin\n >;\n if (sentryInstance) {\n const Sentry = sentryInstance.getSentryObject();\n if (Sentry) {\n const scope = Sentry.getCurrentScope();\n scope.addEventProcessor((event, _hint) => {\n if (event.exception?.values?.[0]) {\n const eventData = event.exception.values[0];\n if (\n eventData.stacktrace?.frames &&\n Array.isArray(eventData.stacktrace.frames) &&\n eventData.stacktrace.frames.length\n ) {\n // Exclude event if script Marker is included\n if (\n eventData.stacktrace.frames.find(frame =>\n frame.filename?.includes(SCRIPT_CODE_MARKER),\n )\n ) {\n return null;\n }\n //Exclude event if own directory is included but not inside own node_modules\n const ownNodeModulesDir = join(__dirname, 'node_modules');\n if (\n !eventData.stacktrace.frames.find(\n frame =>\n frame.filename &&\n frame.filename.includes(__dirname) &&\n !frame.filename.includes(ownNodeModulesDir),\n )\n ) {\n return null;\n }\n // We have exception data and did not sort it out, so report it\n return event;\n }\n }\n\n // No exception in it ... do not report\n return null;\n });\n }\n }\n }\n\n await this.main();\n }\n\n onMessage(obj: ioBroker.Message): void {\n switch (obj?.command) {\n // process messageTo commands\n case 'toScript':\n case 'jsMessageBus':\n if (\n obj.message &&\n (obj.message.instance === null ||\n obj.message.instance === undefined ||\n `javascript.${obj.message.instance}` === this.namespace ||\n obj.message.instance === this.namespace)\n ) {\n Object.keys(this.messageBusHandlers).forEach(name => {\n // script name could be script.js.xxx or only xxx\n if (\n (!obj.message.script || obj.message.script === name) &&\n this.messageBusHandlers[name][obj.message.message]\n ) {\n this.messageBusHandlers[name][obj.message.message].forEach(handler => {\n const sandbox = handler.sandbox;\n\n sandbox.verbose && sandbox.log(`onMessage: ${JSON.stringify(obj.message)}`, 'info');\n\n try {\n if (obj.callback) {\n handler.cb.call(sandbox, obj.message.data, (result: any) => {\n if (sandbox.verbose) {\n sandbox.log(`onMessage result: ${JSON.stringify(result)}`, 'info');\n }\n\n this.sendTo(obj.from, obj.command, result, obj.callback);\n });\n } else {\n handler.cb.call(sandbox, obj.message.data, (result: any) => {\n sandbox.verbose &&\n sandbox.log(`onMessage result: ${JSON.stringify(result)}`, 'info');\n });\n }\n } catch (err: unknown) {\n this.setState(\n `scriptProblem.${name.substring(SCRIPT_CODE_MARKER.length)}`,\n true,\n true,\n );\n this.logError('Error in callback', err as Error);\n }\n });\n }\n });\n }\n break;\n\n case 'loadTypings': {\n // Load typings for the editor\n const typings: Record = {};\n\n // try to load TypeScript lib files from disk\n try {\n const typescriptLibs = resolveTypescriptLibs(targetTsLib);\n Object.assign(typings, typescriptLibs);\n } catch {\n /* ok, no lib then */\n }\n\n // provide the already-loaded ioBroker typings and global script declarations\n Object.assign(typings, tsAmbient);\n\n // also provide the known global declarations for each global script\n for (const globalScriptPaths of Object.keys(this.knownGlobalDeclarationsByScript)) {\n typings[`${globalScriptPaths}.d.ts`] = this.knownGlobalDeclarationsByScript[globalScriptPaths];\n }\n\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, { typings }, obj.callback);\n }\n break;\n }\n\n case 'calcAstroAll': {\n if (obj.message) {\n const sunriseOffset =\n parseInt(\n obj.message.sunriseOffset === undefined\n ? this.config.sunriseOffset\n : obj.message.sunriseOffset,\n 10,\n ) || 0;\n const sunsetOffset =\n parseInt(\n obj.message.sunsetOffset === undefined\n ? this.config.sunsetOffset\n : obj.message.sunsetOffset,\n 10,\n ) || 0;\n const longitude =\n parseFloat(\n obj.message.longitude === undefined ? this.config.longitude : obj.message.longitude,\n ) || 0;\n const latitude =\n parseFloat(obj.message.latitude === undefined ? this.config.latitude : obj.message.latitude) ||\n 0;\n const today = getAstroStartOfDay();\n let astroEvents: GetTimesResult & { nextSunrise: Date; nextSunset: Date } = {} as GetTimesResult & {\n nextSunrise: Date;\n nextSunset: Date;\n };\n try {\n astroEvents = this.mods.suncalc.getTimes(today, latitude, longitude);\n } catch (err: unknown) {\n this.log.error(`Cannot calculate astro data: ${err as Error}`);\n }\n if (astroEvents) {\n try {\n astroEvents.nextSunrise = this.getAstroEvent(\n today,\n obj.message.sunriseEvent || this.config.sunriseEvent,\n obj.message.sunriseLimitStart || this.config.sunriseLimitStart,\n obj.message.sunriseLimitEnd || this.config.sunriseLimitEnd,\n sunriseOffset,\n false,\n latitude,\n longitude,\n true,\n );\n astroEvents.nextSunset = this.getAstroEvent(\n today,\n obj.message.sunsetEvent || this.config.sunsetEvent,\n obj.message.sunsetLimitStart || this.config.sunsetLimitStart,\n obj.message.sunsetLimitEnd || this.config.sunsetLimitEnd,\n sunsetOffset,\n true,\n latitude,\n longitude,\n true,\n );\n } catch (err: unknown) {\n this.log.error(`Cannot calculate astro data: ${err as Error}`);\n }\n }\n\n const result: Record = {};\n const keys = Object.keys(astroEvents).sort(\n (a, b) =>\n (astroEvents as unknown as Record)[a] -\n (astroEvents as unknown as Record)[b],\n );\n keys.forEach(key => {\n const validDate =\n (astroEvents as unknown as Record)[key] !== null &&\n !isNaN((astroEvents as unknown as Record)[key].getTime());\n\n result[key] = {\n isValidDate: validDate,\n serverTime: validDate\n ? formatHoursMinutesSeconds((astroEvents as unknown as Record)[key])\n : 'n/a',\n date: validDate\n ? (astroEvents as unknown as Record)[key].toISOString()\n : 'n/a',\n };\n });\n\n if (obj.callback) {\n this.sendTo(obj.from, obj.command, result, obj.callback);\n }\n }\n break;\n }\n\n case 'calcAstro': {\n if (obj.message) {\n const longitude =\n parseFloat(\n obj.message.longitude === undefined ? this.config.longitude : obj.message.longitude,\n ) || 0;\n const latitude =\n parseFloat(obj.message.latitude === undefined ? this.config.latitude : obj.message.latitude) ||\n 0;\n const today = getAstroStartOfDay();\n\n const sunriseEvent = obj.message?.sunriseEvent || this.config.sunriseEvent;\n const sunriseLimitStart = obj.message?.sunriseLimitStart || this.config.sunriseLimitStart;\n const sunriseLimitEnd = obj.message?.sunriseLimitEnd || this.config.sunriseLimitEnd;\n const sunriseOffset =\n parseInt(\n obj.message.sunriseOffset === undefined\n ? this.config.sunriseOffset\n : obj.message.sunriseOffset,\n 10,\n ) || 0;\n const nextSunrise = this.getAstroEvent(\n today,\n sunriseEvent,\n sunriseLimitStart,\n sunriseLimitEnd,\n sunriseOffset,\n false,\n latitude,\n longitude,\n true,\n );\n\n const sunsetEvent = obj.message?.sunsetEvent || this.config.sunsetEvent;\n const sunsetLimitStart = obj.message?.sunsetLimitStart || this.config.sunsetLimitStart;\n const sunsetLimitEnd = obj.message?.sunsetLimitEnd || this.config.sunsetLimitEnd;\n const sunsetOffset =\n parseInt(\n obj.message.sunsetOffset === undefined\n ? this.config.sunsetOffset\n : obj.message.sunsetOffset,\n 10,\n ) || 0;\n const nextSunset = this.getAstroEvent(\n today,\n sunsetEvent,\n sunsetLimitStart,\n sunsetLimitEnd,\n sunsetOffset,\n true,\n latitude,\n longitude,\n true,\n );\n\n const validDateSunrise = nextSunrise !== null && !isNaN(nextSunrise.getTime());\n const validDateSunset = nextSunset !== null && !isNaN(nextSunset.getTime());\n\n this.log.debug(\n `calcAstro sunrise: ${sunriseEvent} -> start ${sunriseLimitStart}, end: ${sunriseLimitEnd}, offset: ${sunriseOffset} - ${validDateSunrise ? nextSunrise.toISOString() : 'n/a'}`,\n );\n this.log.debug(\n `calcAstro sunset: ${sunsetEvent} -> start ${sunsetLimitStart}, end: ${sunsetLimitEnd}, offset: ${sunsetOffset} - ${validDateSunset ? nextSunset.toISOString() : 'n/a'}`,\n );\n\n if (obj.callback) {\n this.sendTo(\n obj.from,\n obj.command,\n {\n nextSunrise: {\n isValidDate: validDateSunrise,\n serverTime: validDateSunrise ? formatHoursMinutesSeconds(nextSunrise) : 'n/a',\n date: nextSunrise.toISOString(),\n },\n nextSunset: {\n isValidDate: validDateSunset,\n serverTime: validDateSunset ? formatHoursMinutesSeconds(nextSunset) : 'n/a',\n date: nextSunset.toISOString(),\n },\n },\n obj.callback,\n );\n }\n }\n break;\n }\n\n case 'debug': {\n if (!this.context.debugMode) {\n this.debugStart(obj.message);\n }\n break;\n }\n\n case 'debugStop': {\n if (!this.context.debugMode) {\n this.debugStop().then(() => console.log('stopped'));\n }\n break;\n }\n\n case 'rulesOn': {\n this.context.rulesOpened = obj.message;\n console.log(`Enable messaging for ${this.context.rulesOpened}`);\n break;\n }\n\n case 'rulesOff': {\n // maybe if (context.rulesOpened === obj.message)\n console.log(`Disable messaging for ${this.context.rulesOpened}`);\n this.context.rulesOpened = null;\n break;\n }\n\n case 'getIoBrokerDataDir': {\n if (obj.callback) {\n this.sendTo(\n obj.from,\n obj.command,\n {\n dataDir: getAbsoluteDefaultDataDir(),\n sep,\n },\n obj.callback,\n );\n }\n break;\n }\n }\n }\n\n onLog(msg: any): void {\n Object.keys(this.logSubscriptions).forEach((name: string): void =>\n this.logSubscriptions[name].forEach(handler => {\n if (\n typeof handler.cb === 'function' &&\n (handler.severity === '*' || handler.severity === msg.severity)\n ) {\n handler.sandbox.logHandler = handler.severity || '*';\n handler.cb.call(handler.sandbox, msg);\n handler.sandbox.logHandler = undefined;\n }\n }),\n );\n }\n\n logError(msg: string, e: Error, offs?: number): void {\n const stack = e.stack ? e.stack.toString().split('\\n') : e ? e.toString() : '';\n if (!msg.includes('\\n')) {\n msg = msg.replace(/[: ]*$/, ': ');\n }\n\n this.errorLogFunction.error(msg + this.fixLineNo(stack[0]));\n for (let i = offs || 1; i < stack.length; i++) {\n if (!stack[i]) {\n continue;\n }\n if (stack[i].match(/runInNewContext|javascript\\.js:/)) {\n break;\n }\n this.errorLogFunction.error(this.fixLineNo(stack[i]));\n }\n }\n\n logWithLineInfo(msg: string): void {\n this.errorLogFunction.warn(msg);\n\n // get current error stack\n const stack = new Error().stack?.split('\\n');\n\n if (stack) {\n for (let i = 3; i < stack.length; i++) {\n if (!stack[i]) {\n continue;\n }\n if (stack[i].match(/runInContext|runInNewContext|javascript\\.js:/)) {\n break;\n }\n this.errorLogFunction.warn(this.fixLineNo(stack[i]));\n }\n }\n }\n\n async main(): Promise {\n // Patch the font as it sometimes is wrong\n if (!this.context.debugMode) {\n if (await this.patchFont()) {\n this.log.debug('Font patched');\n }\n }\n\n this.log.debug(`config.subscribe (Do not subscribe all states on start): ${this.config.subscribe}`);\n\n // correct jsonConfig for admin\n const instObj: ioBroker.InstanceObject | null | undefined = await this.getForeignObjectAsync(\n `system.adapter.${this.namespace}`,\n );\n if (instObj?.common) {\n if (instObj.common.adminUI?.config !== 'json') {\n if (instObj.common.adminUI) {\n instObj.common.adminUI.config = 'json';\n } else {\n instObj.common.adminUI = { config: 'json' };\n }\n this.setForeignObject(instObj._id, instObj);\n }\n }\n\n if (webstormDebug) {\n this.errorLogFunction = {\n error: console.error,\n warn: console.warn,\n info: console.info,\n debug: console.log,\n silly: console.log,\n };\n this.context.errorLogFunction = this.errorLogFunction;\n }\n this.activeStr = `${this.namespace}.scriptEnabled.`;\n\n this.mods.fs = new ProtectFs(this.log, getAbsoluteDefaultDataDir());\n this.mods['fs/promises'] = this.mods.fs.promises; // to avoid require('fs/promises');\n\n // try to read TS declarations\n try {\n tsAmbient = {\n 'javascript.d.ts': readFileSync(this.mods.path.join(__dirname, 'lib/javascript.d.ts'), 'utf8'),\n };\n this.tsServer.provideAmbientDeclarations(tsAmbient);\n jsDeclarationServer.provideAmbientDeclarations(tsAmbient);\n } catch (err: unknown) {\n this.log.warn(`Could not read TypeScript ambient declarations: ${err as Error}`);\n // This should not happen, so send an error report to Sentry\n if (this.supportsFeature && this.supportsFeature('PLUGINS')) {\n const sentryInstance = this.getPluginInstance('sentry');\n if (sentryInstance) {\n const sentryObject = sentryInstance.getSentryObject();\n sentryObject?.captureException(err as Error);\n }\n }\n // Keep the adapter from crashing when the included typings cannot be read\n tsAmbient = {};\n }\n\n await this.installLibraries();\n // Load the TS declarations for Node.js and all 3rd party modules\n this.loadTypeScriptDeclarations();\n\n await this.getData();\n this.context.scheduler = new Scheduler(\n this.log,\n Date,\n this.mods.suncalc,\n this.config.latitude,\n this.config.longitude,\n );\n await this.dayTimeSchedules();\n await this.sunTimeSchedules();\n await this.timeSchedule();\n\n // Warning. It could have a side effect in compact mode, so all adapters will accept self-signed certificates\n if (this.config.allowSelfSignedCerts) {\n process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';\n }\n\n const doc = await this.getObjectViewAsync('script', 'javascript', {});\n if (doc?.rows?.length) {\n // assemble global script\n for (let g = 0; g < doc.rows.length; g++) {\n const obj = doc.rows[g].value;\n if (checkIsGlobal(obj)) {\n if (obj && obj.common) {\n const engineType = (obj.common.engineType || '').toLowerCase();\n\n if (obj.common.enabled) {\n if (engineType.startsWith('typescript')) {\n // TypeScript\n this.log.info(`${obj._id}: compiling TypeScript source...`);\n // In order to compile global TypeScript, we need to do some transformations\n // 1. For top-level-await, some statements must be wrapped in an immediately-invoked async function\n // 2. If any global script uses `import`, the declarations are no longer visible if they are not exported with `declare global`\n const transformedSource = transformScriptBeforeCompilation(obj.common.source, true);\n // The source code must be transformed in order to support top level await\n // Global scripts must not be treated as a module, otherwise their methods\n // cannot be found by the normal scripts\n // We need to hash both global declarations that are known until now\n // AND the script source, because changing either can change the compilation output\n const sourceHash: string = hashSource(\n tsSourceHashBase + this.globalDeclarations + transformedSource,\n );\n\n let compiled: string | undefined;\n let declarations: string | undefined;\n // If we already stored the compiled source code and the original source hash,\n // use the hash to check whether we can rely on the compiled source code or\n // if we need to compile it again\n if (\n typeof obj.common.compiled === 'string' &&\n typeof obj.common.sourceHash === 'string' &&\n sourceHash === obj.common.sourceHash\n ) {\n // We can reuse the stored source\n compiled = obj.common.compiled;\n declarations = obj.common.declarations;\n this.log.info(\n `${obj._id}: source code did not change, using cached compilation result...`,\n );\n } else {\n // We don't have a hashed source code, or the original source changed, compile it\n const filename = scriptIdToTSFilename(obj._id);\n let tsCompiled: CompileResult;\n try {\n tsCompiled = this.tsServer.compile(filename, transformedSource);\n } catch (err: unknown) {\n this.log.error(`${obj._id}: TypeScript compilation failed:\\n${err as Error}`);\n continue;\n }\n\n const errors = tsCompiled.diagnostics\n .map(diag => `${diag.annotatedSource}\\n`)\n .join('\\n');\n\n if (tsCompiled.success) {\n if (errors.length > 0) {\n this.log.warn(\n `${obj._id}: TypeScript compilation completed with errors:\\n${errors}`,\n );\n } else {\n this.log.info(`${obj._id}: TypeScript compilation successful`);\n }\n compiled = tsCompiled.result;\n // Global scripts that have been transformed to support `import` need to have their declarations transformed aswell\n declarations = transformGlobalDeclarations(tsCompiled.declarations || '');\n\n const newCommon: {\n compiled: string | undefined;\n declarations?: string;\n sourceHash: string;\n } = {\n sourceHash,\n compiled,\n };\n if (declarations) {\n newCommon.declarations = declarations;\n }\n\n // Store the compiled source and the original source hash, so we don't need to do the work again next time\n this.ignoreObjectChange.add(obj._id); // ignore the next change and don't restart scripts\n this.extendForeignObject(obj._id, {\n common: newCommon,\n });\n } else {\n this.log.error(`${obj._id}: TypeScript compilation failed:\\n${errors}`);\n continue;\n }\n }\n this.globalScript += `${compiled}\\n`;\n // if declarations were generated, remember them\n if (declarations != null) {\n this.provideDeclarationsForGlobalScript(obj._id, declarations);\n }\n } else {\n // javascript\n const sourceCode = obj.common.source;\n this.globalScript += `${sourceCode}\\n`;\n\n // try to compile the declarations so TypeScripts can use\n // functions defined in global JavaScripts\n const filename = scriptIdToTSFilename(obj._id);\n let tsCompiled: CompileResult;\n try {\n tsCompiled = jsDeclarationServer.compile(filename, sourceCode);\n } catch (err: unknown) {\n this.log.warn(\n `${obj._id}: Error while generating type declarations, skipping:\\n${err as Error}`,\n );\n continue;\n }\n // if declarations were generated, remember them\n if (tsCompiled.success && tsCompiled.declarations != null) {\n this.provideDeclarationsForGlobalScript(obj._id, tsCompiled.declarations);\n }\n }\n }\n }\n }\n }\n }\n\n this.globalScript = this.globalScript.replace(/\\r\\n/g, '\\n');\n this.globalScriptLines = this.globalScript.split(/\\n/g).length - 1;\n\n if (doc?.rows?.length) {\n // load all scripts\n for (let i = 0; i < doc.rows.length; i++) {\n if (!checkIsGlobal(doc.rows[i].value)) {\n this.loadScript(doc.rows[i].value);\n }\n }\n }\n\n if (this.config.mirrorPath) {\n this.config.mirrorInstance = parseInt(this.config.mirrorInstance as unknown as string, 10) || 0;\n if (this.instance === this.config.mirrorInstance) {\n const ioBDataDir = getAbsoluteDefaultDataDir() + sep;\n this.config.mirrorPath = normalize(this.config.mirrorPath);\n let mirrorForbidden = false;\n for (let dir of forbiddenMirrorLocations) {\n dir = join(ioBDataDir, dir) + sep;\n if (dir.includes(this.config.mirrorPath) || this.config.mirrorPath.startsWith(dir)) {\n this.log.error(`The Mirror directory is not allowed to be a central ioBroker directory!`);\n this.log.error(`Directory ${this.config.mirrorPath} is not allowed to mirror files!`);\n mirrorForbidden = true;\n break;\n }\n }\n if (!mirrorForbidden) {\n this.mirror = new Mirror({\n adapter: this,\n log: this.log,\n diskRoot: this.config.mirrorPath,\n });\n }\n }\n }\n\n // CHeck setState counter per minute and stop script if too high\n this.setStateCountCheckInterval = setInterval(() => {\n Object.keys(this.scripts).forEach(id => {\n if (!this.scripts[id]) {\n return;\n }\n const currentSetStatePerMinuteCounter = this.scripts[id].setStatePerMinuteCounter;\n this.scripts[id].setStatePerMinuteCounter = 0;\n if (currentSetStatePerMinuteCounter > this.config.maxSetStatePerMinute) {\n this.scripts[id].setStatePerMinuteProblemCounter++;\n this.log.debug(\n `Script ${id} has reached the maximum of ${this.config.maxSetStatePerMinute} setState calls per minute in ${this.scripts[id].setStatePerMinuteProblemCounter} consecutive minutes`,\n );\n // Allow \"too high counters\" for 1 minute for script starts or such and only\n // stop the script when lasts longer\n if (this.scripts[id].setStatePerMinuteProblemCounter > 1) {\n this.log.error(\n `Script ${id} is calling setState more than ${this.config.maxSetStatePerMinute} times per minute! Stopping Script now! Please check your script!`,\n );\n this.stopScript(id);\n }\n } else if (this.scripts[id].setStatePerMinuteProblemCounter > 0) {\n this.scripts[id].setStatePerMinuteProblemCounter--;\n this.log.debug(\n `Script ${id} has NOT reached the maximum of ${this.config.maxSetStatePerMinute} setState calls per minute. Decrease problem counter to ${this.scripts[id].setStatePerMinuteProblemCounter}`,\n );\n }\n });\n }, 60000);\n }\n\n private loadTypeScriptDeclarations(): void {\n // try to load the typings on disk for all 3rd party modules\n const packages = [\n 'node', // this provides auto-completion for most builtins\n '@iobroker/types', // this provides auto-completion for most builtins\n ];\n // Also include user-selected libraries (but only those that are also installed)\n if (typeof this.config?.libraries === 'string' && typeof this.config.libraryTypings === 'string') {\n const installedLibs = this.config.libraries\n .split(/[,;\\s]+/)\n .map(s => s.trim().split('@')[0])\n .filter(s => !!s);\n\n const wantsTypings = this.config.libraryTypings\n .split(/[,;\\s]+/)\n .map(s => s.trim())\n .filter(s => !!s);\n // Add all installed libraries the user has requested typings for to the list of packages\n for (const lib of installedLibs) {\n if (wantsTypings.includes(lib) && !packages.includes(lib)) {\n packages.push(lib);\n }\n }\n // Some packages have submodules (e.g., rxjs/operators) that are not exposed through the main entry point\n // If typings are requested for them, also add them if the base module is installed\n for (const lib of wantsTypings) {\n // Extract the package name and check if we need to add it\n if (!lib.includes('/')) {\n continue;\n }\n const pkgName = lib.substr(0, lib.indexOf('/'));\n\n if (installedLibs.includes(pkgName) && !packages.includes(lib)) {\n packages.push(lib);\n }\n }\n }\n for (const pkg of packages) {\n let pkgTypings = resolveTypings(\n pkg,\n this.getAdapterScopedPackageIdentifier ? this.getAdapterScopedPackageIdentifier(pkg) : pkg,\n // node needs ambient typings, so we don't wrap it in declare module\n pkg !== 'node',\n );\n if (!pkgTypings) {\n // Create the empty dummy declarations so users don't get the \"not found\" error\n // for installed packages\n pkgTypings = {\n [`node_modules/@types/${pkg}/index.d.ts`]: `declare module \"${pkg}\";`,\n };\n }\n this.log.debug(`Loaded TypeScript definitions for ${pkg}: ${JSON.stringify(Object.keys(pkgTypings))}`);\n // remember the declarations for the editor\n Object.assign(tsAmbient, pkgTypings);\n // and give the language servers access to them\n this.tsServer.provideAmbientDeclarations(pkgTypings);\n jsDeclarationServer.provideAmbientDeclarations(pkgTypings);\n }\n }\n\n updateObjectContext(id: string, obj: ioBroker.Object | null | undefined): void {\n if (obj) {\n // add state to state ID's list\n if (obj.type === 'state') {\n if (!this.stateIds.includes(id)) {\n this.stateIds.push(id);\n this.stateIds.sort();\n }\n if (this.context.devices && this.context.channels) {\n const parts = id.split('.');\n parts.pop();\n const chn = parts.join('.');\n this.context.channels[chn] = this.context.channels[chn] || [];\n this.context.channels[chn].push(id);\n\n parts.pop();\n const dev = parts.join('.');\n this.context.devices[dev] = this.context.devices[dev] || [];\n this.context.devices[dev].push(id);\n }\n }\n } else {\n // delete object from state ID's list\n const pos = this.stateIds.indexOf(id);\n if (pos !== -1) {\n this.stateIds.splice(pos, 1);\n }\n if (this.context.devices && this.context.channels) {\n const parts = id.split('.');\n parts.pop();\n const chn = parts.join('.');\n if (this.context.channels[chn]) {\n const posChn = this.context.channels[chn].indexOf(id);\n posChn !== -1 && this.context.channels[chn].splice(posChn, 1);\n }\n\n parts.pop();\n const dev = parts.join('.');\n if (this.context.devices[dev]) {\n const posDev = this.context.devices[dev].indexOf(id);\n posDev !== -1 && this.context.devices[dev].splice(posDev, 1);\n }\n }\n\n delete this.folderCreationVerifiedObjects[id];\n }\n\n if (!obj && this.objects[id]) {\n // objects was deleted\n this.removeFromNames(id);\n delete this.objects[id];\n } else if (obj && !this.objects[id]) {\n // object was added\n this.objects[id] = obj;\n this.addToNames(obj);\n } else if (obj && this.objects[id].common) {\n // Object just changed\n this.objects[id] = obj;\n\n const n = this.getName(id);\n let nn = this.objects[id].common ? this.objects[id].common.name : '';\n\n if (nn && typeof nn === 'object') {\n nn = nn[getLanguage()] || nn.en;\n }\n\n if (n !== nn) {\n if (n) {\n this.removeFromNames(id);\n }\n if (nn) {\n this.addToNames(obj);\n }\n }\n }\n }\n\n async stopAllScripts(): Promise {\n const scripts = Object.keys(this.scripts);\n const promises: Promise[] = [];\n for (let i = 0; i < scripts.length; i++) {\n promises.push(this.stopScript(scripts[i]));\n }\n return Promise.all(promises).then(() => {});\n }\n\n convertBackStringifiedValues(\n id: string,\n state: ioBroker.State | null | undefined,\n ): ioBroker.State | null | undefined {\n if (\n state &&\n typeof state.val === 'string' &&\n this.objects[id]?.common &&\n (this.objects[id].common.type === 'array' || this.objects[id].common.type === 'object')\n ) {\n try {\n state.val = JSON.parse(state.val);\n } catch (err: any) {\n if (id.startsWith('javascript.') || id.startsWith('0_userdata.0')) {\n this.log.info(\n `Could not parse value for id ${id} into ${this.objects[id].common.type}: ${err.toString()}`,\n );\n } else {\n this.log.debug(\n `Could not parse value for id ${id} into ${this.objects[id].common.type}: ${err.toString()}`,\n );\n }\n }\n }\n return state;\n }\n\n prepareStateObjectSimple(id: string, state: ioBroker.StateValue, isAck: boolean): ioBroker.State {\n let oState: ioBroker.State;\n\n if (typeof isAck === 'boolean') {\n // otherwise, assume that the given state is the value to be set\n oState = { val: state, ack: !!isAck } as ioBroker.State;\n } else {\n oState = { val: state } as ioBroker.State;\n }\n\n return this.prepareStateObject(id, oState);\n }\n\n prepareStateObject(id: string, state: ioBroker.SettableState | null): ioBroker.State {\n let oState: ioBroker.State;\n\n if (state && typeof state === 'object') {\n oState = state as ioBroker.State;\n } else {\n oState = { val: null } as ioBroker.State;\n }\n\n if (this.config.subscribe) {\n return oState;\n }\n // set other values to have a full state object\n // mirrors logic from statesInRedis\n if (oState.ts === undefined) {\n oState.ts = Date.now();\n }\n\n if (oState.q === undefined) {\n oState.q = 0;\n }\n\n oState.from =\n typeof oState.from === 'string' && oState.from !== '' ? oState.from : `system.adapter.${this.namespace}`;\n\n if (oState.lc === undefined) {\n const formerStateValue = this.interimStateValues[id] || this.states[id];\n if (!formerStateValue) {\n oState.lc = oState.ts;\n } else {\n // isDeepStrictEqual works on objects and primitive values\n const hasChanged = !isDeepStrictEqual(formerStateValue.val, oState.val);\n if (!formerStateValue.lc || hasChanged) {\n oState.lc = oState.ts;\n } else {\n oState.lc = formerStateValue.lc;\n }\n }\n }\n\n return oState;\n }\n\n async getData(): Promise {\n await this.subscribeForeignObjectsAsync('*');\n\n if (!this.config.subscribe) {\n await this.subscribeForeignStatesAsync('*');\n } else {\n await this.subscribeStatesAsync('debug.to');\n await this.subscribeStatesAsync('scriptEnabled.*');\n }\n\n this.log.info('requesting all states');\n\n const statesPromise = this.getForeignStatesAsync('*')\n .then(res => {\n if (!res) {\n this.log.error(`Could not initialize states: no result`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n return;\n }\n if (!this.config.subscribe) {\n this.states = Object.assign(res, this.states);\n this.context.states = this.states;\n\n this.addGetProperty(this.states);\n }\n\n // remember all IDs\n for (const id in res) {\n if (Object.prototype.hasOwnProperty.call(res, id)) {\n this.stateIds.push(id);\n }\n }\n this.statesInitDone = true;\n this.log.info('received all states');\n })\n .catch((err: any) => {\n this.log.error(`Could not initialize states: ${err?.message || 'no result'}`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n });\n\n this.log.info('requesting all objects');\n\n const objectsPromise = this.getObjectListAsync({ include_docs: true })\n .then(res => {\n if (!res?.rows) {\n this.log.error(`Could not initialize objects: no result`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n return;\n }\n this.objects = {};\n this.context.objects = this.objects;\n for (let i = 0; i < res.rows.length; i++) {\n if (!res.rows[i].doc) {\n this.log.debug(`Got empty object for index ${i} (${res.rows[i].id})`);\n continue;\n }\n if (this.objects[res.rows[i].doc._id] === undefined) {\n // If was already there ignore\n this.objects[res.rows[i].doc._id] = res.rows[i].doc;\n }\n this.objects[res.rows[i].doc._id].type === 'enum' && this._enums.push(res.rows[i].doc._id);\n\n // Collect all names\n this.addToNames(this.objects[res.rows[i].doc._id]);\n }\n this.addGetProperty(this.objects);\n\n const systemConfig = this.objects['system.config'];\n\n // set language for debug messages\n if (systemConfig?.common?.language) {\n setLanguage(systemConfig.common.language);\n this.language = systemConfig.common.language;\n this.context.language = this.language as ioBroker.Languages;\n } else if (this.language) {\n setLanguage(this.language);\n this.context.language = this.language;\n }\n\n // try to use system coordinates\n if (this.config.useSystemGPS) {\n if (systemConfig?.common?.latitude || systemConfig?.common?.longitude) {\n this.config.latitude = systemConfig.common.latitude;\n this.config.longitude = systemConfig.common.longitude;\n } else if (this.latitude && this.longitude) {\n this.config.latitude = this.latitude;\n this.config.longitude = this.longitude;\n }\n }\n this.config.latitude = parseFloat(this.config.latitude as unknown as string);\n this.config.longitude = parseFloat(this.config.longitude as unknown as string);\n\n if (isNaN(this.config.latitude)) {\n this.log.warn(`Configured latitude is not a number - check (instance/system) configuration`);\n } else if (this.config.latitude < -90 || this.config.latitude > 90) {\n this.log.warn(\n `Configured latitude \"${this.config.latitude}\" is invalid - check (instance/system) configuration`,\n );\n }\n\n if (isNaN(this.config.longitude)) {\n this.log.warn(`Configured longitude is not a number - check (instance/system) configuration`);\n } else if (this.config.longitude < -180 || this.config.longitude > 180) {\n this.log.warn(\n `Configured longitude \"${this.config.longitude}\" is invalid - check (instance/system) configuration`,\n );\n }\n\n this.config.sunriseEvent = this.config.sunriseEvent || 'nightEnd';\n this.config.sunriseOffset = this.config.sunriseOffset || 0;\n this.config.sunriseLimitStart = this.config.sunriseLimitStart || '06:00';\n this.config.sunriseLimitEnd = this.config.sunriseLimitEnd || '12:00';\n\n this.config.sunsetEvent = this.config.sunsetEvent || 'dusk';\n this.config.sunsetOffset = this.config.sunsetOffset || 0;\n this.config.sunsetLimitStart = this.config.sunsetLimitStart || '18:00';\n this.config.sunsetLimitEnd = this.config.sunsetLimitEnd || '23:00';\n\n this.objectsInitDone = true;\n this.log.info('received all objects');\n })\n .catch((err: any) => {\n this.log.error(`Could not initialize objects: ${err?.message || 'no result'}`);\n this.terminate(EXIT_CODES.START_IMMEDIATELY_AFTER_STOP);\n });\n\n return Promise.all([statesPromise, objectsPromise]).then(() => {});\n }\n\n async createActiveObject(id: string, enabled: boolean): Promise {\n const idActive = `${this.namespace}.scriptEnabled.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n\n if (!this.objects[idActive]) {\n this.objects[idActive] = {\n _id: idActive,\n common: {\n name: `scriptEnabled.${id.substring(SCRIPT_CODE_MARKER.length)}`,\n desc: 'controls script activity',\n type: 'boolean',\n write: true,\n read: true,\n role: 'switch.active',\n },\n native: {\n script: id,\n },\n type: 'state',\n };\n try {\n this.setForeignObjectAsync(idActive, this.objects[idActive]);\n const intermediateStateValue = this.prepareStateObjectSimple(idActive, !!enabled, true);\n await this.setForeignStateAsync(idActive, !!enabled, true);\n if (enabled && !this.config.subscribe) {\n this.interimStateValues[idActive] = intermediateStateValue;\n }\n } catch {\n // ignore\n }\n } else {\n const state = await this.getForeignStateAsync(idActive);\n if (state && state.val !== enabled) {\n const intermediateStateValue = this.prepareStateObjectSimple(idActive, !!enabled, true);\n await this.setForeignStateAsync(idActive, !!enabled, true);\n if (enabled && !this.config.subscribe) {\n this.interimStateValues[id] = intermediateStateValue;\n }\n }\n }\n }\n\n async createProblemObject(id: string): Promise {\n const idProblem = `${this.namespace}.scriptProblem.${id.substring(SCRIPT_CODE_MARKER.length)}`;\n\n if (!this.objects[idProblem]) {\n this.objects[idProblem] = {\n _id: idProblem,\n common: {\n name: `scriptProblem.${id.substring(SCRIPT_CODE_MARKER.length)}`,\n desc: 'Script has a problem',\n type: 'boolean',\n expert: true,\n write: false,\n read: true,\n role: 'indicator.error',\n },\n native: {\n script: id,\n },\n type: 'state',\n };\n try {\n await this.setForeignObjectAsync(idProblem, this.objects[idProblem]);\n await this.setForeignStateAsync(idProblem, false, true);\n } catch {\n // ignore\n }\n } else {\n const state = await this.getForeignStateAsync(idProblem);\n if (state && state.val !== false) {\n await this.setForeignStateAsync(idProblem, false, true);\n }\n }\n }\n\n addToNames(obj: ioBroker.Object): void {\n const id = obj._id;\n\n if (obj.common?.name) {\n let name = obj.common.name;\n if (name && typeof name === 'object') {\n name = name[getLanguage()] || name.en;\n }\n if (!name || typeof name !== 'string') {\n // TODO, take name in current language\n return;\n }\n\n if (!this.names[name]) {\n this.names[name] = id;\n } else {\n // convert to array\n if (!Array.isArray(this.names[name])) {\n this.names[name] = [this.names[name] as string];\n }\n\n (this.names[name] as string[]).push(id);\n }\n }\n }\n\n removeFromNames(id: string): void {\n const n = this.getName(id);\n\n if (n) {\n if (Array.isArray(this.names[n])) {\n const pos = this.names[n].indexOf(id);\n if (pos > -1) {\n this.names[n].splice(pos, 1);\n\n if (this.names[n].length === 1) {\n this.names[n] = this.names[n][0];\n }\n }\n } else {\n delete this.names[n];\n }\n }\n }\n\n getName(id: string): string | null {\n for (const n in this.names) {\n if (this.names[n] && Array.isArray(this.names[n])) {\n if (this.names[n].includes(id)) {\n return n;\n }\n } else if (this.names[n] === id) {\n return n;\n }\n }\n\n return null;\n }\n\n async installNpm(npmLib: string): Promise {\n return new Promise((resolve, reject) => {\n const path = __dirname;\n\n // Also, set the working directory (cwd) of the process instead of using --prefix\n // because that has ugly bugs on Windows\n const cmd = `npm install ${npmLib} --omit=dev`;\n this.log.info(`Installing ${npmLib} into ${__dirname} - cmd: ${cmd}`);\n\n // System call used for update of js-controller itself,\n // because during the installation the npm packet will be deleted too, but some files must be loaded even during the installation process.\n const child = this.mods.child_process.exec(cmd, {\n windowsHide: true,\n cwd: path,\n });\n\n child.stdout?.on('data', buf => this.log.info(buf.toString('utf8')));\n\n child.stderr?.on('data', buf => this.log.error(buf.toString('utf8')));\n\n child.on('err', err => {\n this.log.error(`Cannot install ${npmLib}: ${err}`);\n reject(new Error(`Cannot install ${npmLib}: ${err}`));\n });\n child.on('error', err => {\n this.log.error(`Cannot install ${npmLib}: ${err}`);\n reject(new Error(`Cannot install ${npmLib}: ${err}`));\n });\n\n child.on('exit', (code: number /* , signal */) => {\n if (code) {\n this.log.error(`Cannot install ${npmLib}: ${code}`);\n reject(new Error(`Cannot install ${npmLib}: ${code}`));\n }\n // command succeeded\n resolve(code);\n });\n });\n }\n\n async installLibraries(): Promise {\n if (typeof this.config?.libraries !== 'string') {\n this.config.libraries = '';\n }\n\n const libraries: string[] = this.config.libraries\n .split(/[,;\\s]+/)\n .map(d => d.trim())\n .filter(d => d);\n\n this.log.debug(`Custom libraries in config: \"${this.config.libraries}\": ${JSON.stringify(libraries)}`);\n\n let installedNodeModules: string[] = [];\n const keepModules: string[] = [];\n\n // js-controller >= 6.x\n if (typeof this.listInstalledNodeModules === 'function') {\n installedNodeModules = await this.listInstalledNodeModules();\n\n this.log.debug(`Found installed libraries: ${JSON.stringify(installedNodeModules)}`);\n }\n\n for (const lib of libraries) {\n let depName = lib;\n let version = 'latest';\n\n if (depName.includes('@') && depName.lastIndexOf('@') > 0) {\n const parts = depName.split('@');\n version = parts.pop() ?? 'latest';\n depName = parts.join('@');\n }\n\n /** The real module name, because the dependency can be an url too */\n let moduleName = depName;\n\n if (URL.canParse(depName)) {\n moduleName = await requestModuleNameByUrl(depName);\n\n this.log.debug(`Found custom library in config: \"${moduleName}@${version}\" (from ${depName})`);\n } else {\n this.log.debug(`Found custom library in config: \"${moduleName}@${version}\"`);\n }\n\n keepModules.push(moduleName);\n\n // js-controller >= 6.x\n if (typeof this.installNodeModule === 'function') {\n try {\n const result = await this.installNodeModule(depName, { version });\n if (result.success) {\n this.log.debug(`Installed custom library: \"${moduleName}@${version}\"`);\n\n const importedModule: any = await this.importNodeModule(moduleName);\n (this.mods as Record)[moduleName] = importedModule.default ?? importedModule;\n } else {\n this.log.warn(`Cannot install custom npm package \"${moduleName}@${version}\"`);\n }\n } catch (err: unknown) {\n this.log.warn(`Cannot install custom npm package \"${moduleName}@${version}\": ${err as Error}`);\n }\n } else if (!existsSync(`${__dirname}/node_modules/${depName}/package.json`)) {\n // js-controller < 6.x\n this.log.info(`Installing custom library (legacy mode): \"${lib}\"`);\n\n try {\n await this.installNpm(lib);\n this.log.info(`Installed custom npm package (legacy mode): \"${lib}\"`);\n } catch (err: any) {\n this.log.warn(`Cannot install custom npm package \"${lib}\" (legacy mode): ${err.toString()}`);\n }\n }\n }\n\n // js-controller >= 6.x\n if (typeof this.uninstallNodeModule === 'function') {\n for (const installedNodeModule of installedNodeModules) {\n if (!keepModules.includes(installedNodeModule)) {\n try {\n await this.uninstallNodeModule(installedNodeModule);\n\n this.log.info(`Removed custom npm package: \"${installedNodeModule}\"`);\n } catch (err: any) {\n this.log.warn(`Cannot remove custom npm package ${installedNodeModule}: ${err.toString()}`);\n }\n }\n }\n }\n }\n\n createVM(source: string, name: string, wrapAsync: boolean): false | JsScript {\n if (this.context.debugMode && name !== this.context.debugMode) {\n return false;\n }\n\n if (!this.context.debugMode) {\n const logSubscriptionsText =\n \"\\n;\\nlog(`registered ${__engine.__subscriptions} subscription${__engine.__subscriptions === 1 ? '' : 's'},\" +\n \" ${__engine.__schedules} schedule${__engine.__schedules === 1 ? '' : 's'},\" +\n \" ${__engine.__subscriptionsMessage} message${__engine.__subscriptionsMessage === 1 ? '' : 's'},\" +\n \" ${__engine.__subscriptionsLog} log${__engine.__subscriptionsLog === 1 ? '' : 's'}\" +\n \" and ${__engine.__subscriptionsFile} file subscription${__engine.__subscriptionsFile === 1 ? '' : 's'}`);\\n\";\n\n if (wrapAsync) {\n source = `(async () => {\\n${source}\\n${logSubscriptionsText}\\n})();`;\n } else {\n source = `${source}\\n${logSubscriptionsText}`;\n }\n } else {\n if (wrapAsync) {\n source = `(async () => {debugger;\\n${source}\\n})();`;\n } else {\n source = `debugger;${source}`;\n }\n }\n\n try {\n const options: ScriptOptions = {\n filename: name,\n // displayErrors: true,\n // lineOffset: this.globalScriptLines\n };\n return {\n script: new Script(source, options),\n } as JsScript;\n } catch (err: unknown) {\n this.logError(`${name} compile failed:\\r\\nat `, err as Error);\n return false;\n }\n }\n\n execute(script: JsScript, name: string, engineType: ScriptType, verbose: boolean, debug: boolean): void {\n script.intervals = [];\n script.timeouts = [];\n script.schedules = [];\n script.wizards = [];\n script.name = name;\n script.engineType = engineType;\n script._id = Math.floor(Math.random() * 0xffffffff);\n script.subscribes = {};\n script.subscribesFile = {};\n script.setStatePerMinuteCounter = 0;\n script.setStatePerMinuteProblemCounter = 0;\n this.setState(`scriptProblem.${name.substring(SCRIPT_CODE_MARKER.length)}`, {\n val: false,\n ack: true,\n expire: 1000,\n });\n\n const sandbox = sandBox(script, name, verbose, debug, this.context);\n\n try {\n script.script.runInNewContext(sandbox, {\n filename: name,\n displayErrors: true,\n // lineOffset: this.globalScriptLines\n });\n } catch (err: unknown) {\n this.setState(`scriptProblem.${name.substring(SCRIPT_CODE_MARKER.length)}`, {\n val: true,\n ack: true,\n c: 'execute',\n });\n this.logError(name, err as Error);\n }\n }\n\n unsubscribe(id: string | RegExp | string[]): void {\n if (!id) {\n this.log.warn('unsubscribe: empty name');\n return;\n }\n\n if (Array.isArray(id)) {\n id.forEach(sub => unsubscribe(sub));\n return;\n }\n\n if (id.constructor && id.constructor.name === 'RegExp') {\n // adapter.log.warn('unsubscribe: todo - process regexp');\n return;\n }\n\n if (typeof id !== 'string') {\n this.log.error(`unsubscribe: invalid type of id - ${typeof id}`);\n return;\n }\n const parts = id.split('.');\n const _adapter = `system.adapter.${parts[0]}.${parts[1]}`;\n if (this.objects[_adapter]?.common?.subscribable) {\n const a = `${parts[0]}.${parts[1]}`;\n const alive = `system.adapter.${a}.alive`;\n if (this.adapterSubs[alive]) {\n const pos = this.adapterSubs[alive].indexOf(id);\n if (pos !== -1) {\n this.adapterSubs[alive].splice(pos, 1);\n }\n if (!this.adapterSubs[alive].length) {\n delete this.adapterSubs[alive];\n }\n }\n this.sendTo(a, 'unsubscribe', id);\n }\n }\n\n // Analyze if logs are still required or not\n updateLogSubscriptions(): void {\n let found = false;\n // go through all scripts and check if some script still requires logs\n Object.keys(this.logSubscriptions).forEach(scriptName => {\n if (!this.logSubscriptions?.[scriptName] || !this.logSubscriptions[scriptName].length) {\n delete this.logSubscriptions[scriptName];\n } else {\n found = true;\n }\n });\n\n if (this.requireLog) {\n if (found && !this.logSubscribed) {\n this.logSubscribed = true;\n this.requireLog(this.logSubscribed);\n this.log.info(`Subscribed to log messages (found logSubscriptions)`);\n } else if (!found && this.logSubscribed) {\n this.logSubscribed = false;\n this.requireLog(this.logSubscribed);\n this.log.info(`Unsubscribed from log messages (not found logSubscriptions)`);\n }\n }\n }\n\n async stopScript(name: string): Promise {\n this.log.info(`Stopping script ${name}`);\n\n await this.setState(`scriptEnabled.${name.substring(SCRIPT_CODE_MARKER.length)}`, false, true);\n\n if (this.messageBusHandlers[name]) {\n delete this.messageBusHandlers[name];\n }\n\n if (this.tempDirectories[name]) {\n try {\n this.mods.fs.rmSync(this.tempDirectories[name], { recursive: true });\n\n this.log.debug(`Removed temp directory of ${name}: ${this.tempDirectories[name]}`);\n } catch {\n this.log.warn(`Unable to remove temp directory of ${name}: ${this.tempDirectories[name]}`);\n }\n\n delete this.tempDirectories[name];\n }\n\n if (this.logSubscriptions[name]) {\n delete this.logSubscriptions[name];\n this.updateLogSubscriptions();\n }\n\n if (this.scripts[name]) {\n // Remove from subscriptions\n this.context.isEnums = false;\n if (this.config.subscribe) {\n // check all subscribed IDs\n Object.keys(this.scripts[name].subscribes).forEach(id => {\n if (this.subscribedPatterns[id]) {\n this.subscribedPatterns[id] -= this.scripts[name].subscribes[id];\n if (this.subscribedPatterns[id] <= 0) {\n this.unsubscribeForeignStates(id);\n delete this.subscribedPatterns[id];\n if (this.states[id]) {\n delete this.states[id];\n }\n }\n }\n });\n }\n\n for (let i = this.subscriptions.length - 1; i >= 0; i--) {\n if (this.subscriptions[i].name === name) {\n const sub = this.subscriptions.splice(i, 1)[0];\n if (sub?.pattern.id) {\n this.unsubscribe(sub.pattern.id);\n }\n } else {\n if (\n (!this.context.isEnums && this.subscriptions[i].pattern.enumName) ||\n this.subscriptions[i].pattern.enumId\n ) {\n this.context.isEnums = true;\n }\n }\n }\n\n // check all subscribed files\n Object.keys(this.scripts[name].subscribesFile).forEach(key => {\n if (this.subscribedPatternsFile[key]) {\n this.subscribedPatternsFile[key] -= this.scripts[name].subscribesFile[key];\n if (this.subscribedPatternsFile[key] <= 0) {\n const [id, file] = key.split('$%$');\n this.unsubscribeForeignFiles(id, file);\n delete this.subscribedPatternsFile[key];\n }\n }\n });\n for (let i = this.subscriptionsFile.length - 1; i >= 0; i--) {\n if (this.subscriptionsFile[i].name === name) {\n this.subscriptionsFile.splice(i, 1);\n }\n }\n\n for (let i = this.subscriptionsObject.length - 1; i >= 0; i--) {\n if (this.subscriptionsObject[i].name === name) {\n const sub = this.subscriptionsObject.splice(i, 1)[0];\n if (sub) {\n this.unsubscribeForeignObjects(sub.pattern);\n }\n }\n }\n\n // Stop all timeouts\n for (let i = 0; i < this.scripts[name].timeouts.length; i++) {\n clearTimeout(this.scripts[name].timeouts[i]);\n }\n // Stop all intervals\n for (let i = 0; i < this.scripts[name].intervals.length; i++) {\n clearInterval(this.scripts[name].intervals[i]);\n }\n // Stop all scheduled jobs\n for (let i = 0; i < this.scripts[name].schedules.length; i++) {\n if (this.scripts[name].schedules[i]) {\n const _name = this.scripts[name].schedules[i].name;\n if (!this.mods.nodeSchedule.cancelJob(this.scripts[name].schedules[i])) {\n this.log.error(`Error by canceling scheduled job \"${_name}\"`);\n }\n }\n }\n\n // Stop all time wizards jobs\n if (this.context.scheduler) {\n for (let i = 0; i < this.scripts[name].wizards.length; i++) {\n if (this.scripts[name].wizards[i]) {\n this.context.scheduler.remove(this.scripts[name].wizards[i]);\n }\n }\n }\n\n // if callback for on stop\n if (typeof this.scripts[name].onStopCb === 'function') {\n this.scripts[name].onStopTimeout =\n parseInt(this.scripts[name].onStopTimeout as unknown as string, 10) || 1000;\n\n await new Promise(resolve => {\n let timeout: NodeJS.Timeout | null = setTimeout(() => {\n if (timeout) {\n timeout = null;\n resolve(true);\n }\n }, this.scripts[name].onStopTimeout);\n\n try {\n this.scripts[name].onStopCb(() => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n resolve(true);\n }\n });\n } catch (err: unknown) {\n this.log.error(`error in onStop callback: ${err as Error}`);\n }\n });\n }\n\n delete this.scripts[name];\n return true;\n }\n return false;\n }\n\n async prepareScript(obj: ioBroker.ScriptObject): Promise {\n if (obj?.common?.enabled && this.debugState.scriptName === obj._id) {\n const id = obj._id;\n await this.debugStop();\n this.log.info(`Debugging of ${id} was stopped, because started in normal mode`);\n return this.prepareScript(obj);\n }\n\n if (\n obj?.common?.source &&\n (obj.common.enabled || this.context.debugMode === obj._id) &&\n obj.common.engine === `system.adapter.${this.namespace}`\n ) {\n const name = obj._id;\n\n const nameId = name.substring(SCRIPT_CODE_MARKER.length);\n if (!nameId.length || nameId.endsWith('.')) {\n this.log.error(`Script name ${name} is invalid!`);\n return false;\n }\n const idActive = `scriptEnabled.${nameId}`;\n if (!this.config.subscribe) {\n this.interimStateValues[idActive] = this.prepareStateObjectSimple(\n `${this.namespace}.${idActive}`,\n true,\n true,\n );\n }\n await this.setState(idActive, true, true);\n obj.common.engineType = obj.common.engineType || '';\n\n if (\n (obj.common.engineType as ScriptType).toLowerCase().startsWith('javascript') ||\n (obj.common.engineType as ScriptType) === 'Blockly' ||\n (obj.common.engineType as ScriptType) === 'Rules'\n ) {\n // Javascript\n this.log.info(`Start JavaScript ${name} (${obj.common.engineType})`);\n\n let sourceFn = name;\n if (webstormDebug) {\n const fn = name.replace(/^script.js./, '').replace(/\\./g, '/');\n sourceFn = this.mods.path.join(webstormDebug, `${fn}.js`);\n }\n const createdScript = this.createVM(`${this.globalScript}\\n${obj.common.source}`, sourceFn, true);\n if (!createdScript) {\n return false;\n }\n this.scripts[name] = createdScript;\n this.execute(\n this.scripts[name],\n sourceFn,\n obj.common.engineType as ScriptType,\n obj.common.verbose,\n obj.common.debug,\n );\n return true;\n }\n\n if (obj.common.engineType.toLowerCase().startsWith('typescript')) {\n // TypeScript\n this.log.info(`Compiling TypeScript source ${name}`);\n // The source code must be transformed in order to support top level await\n // and to force TypeScript to compile the code as a module\n const transformedSource = transformScriptBeforeCompilation(obj.common.source, false);\n // We need to hash both global declarations that are known until now\n // AND the script source, because changing either can change the compilation output\n const sourceHash = hashSource(tsSourceHashBase + this.globalDeclarations + transformedSource);\n\n let compiled: string;\n // If we already stored the compiled source code and the original source hash,\n // use the hash to check whether we can rely on the compiled source code or\n // if we need to compile it again\n if (\n typeof obj.common.compiled === 'string' &&\n typeof obj.common.sourceHash === 'string' &&\n sourceHash === obj.common.sourceHash\n ) {\n // We can reuse the stored source\n compiled = obj.common.compiled;\n this.log.info(`${name}: source code did not change, using cached compilation result...`);\n } else {\n // We don't have a hashed source code, or the original source changed, compile it\n const filename = scriptIdToTSFilename(name);\n let tsCompiled: CompileResult;\n try {\n tsCompiled = this.tsServer.compile(filename, transformedSource);\n } catch (err: unknown) {\n this.log.error(`${obj._id}: TypeScript compilation failed:\\n${err as Error}`);\n return false;\n }\n\n const errors = tsCompiled.diagnostics.map(diag => `${diag.annotatedSource}\\n`).join('\\n');\n\n if (tsCompiled.success) {\n if (errors.length > 0) {\n this.log.warn(`${name}: TypeScript compilation had errors:\\n${errors}`);\n } else {\n this.log.info(`${name}: TypeScript compilation successful`);\n }\n compiled = tsCompiled.result || '';\n\n // Store the compiled source and the original source hash, so we don't need to do the work again next time\n this.ignoreObjectChange.add(name); // ignore the next change and don't restart scripts\n await this.extendForeignObjectAsync(name, {\n common: {\n sourceHash,\n compiled,\n },\n });\n } else {\n this.log.error(`${name}: TypeScript compilation failed:\\n${errors}`);\n return false;\n }\n }\n const createdScript: JsScript | false = this.createVM(`${this.globalScript}\\n${compiled}`, name, false);\n if (!createdScript) {\n return false;\n }\n this.scripts[name] = createdScript;\n this.execute(\n this.scripts[name],\n name,\n obj.common.engineType as ScriptType,\n obj.common.verbose,\n obj.common.debug,\n );\n return true;\n }\n\n this.log.warn(`Unknown engine type for \"${name}\": ${obj.common.engineType}`);\n return false;\n }\n\n let _name: string;\n if (obj?._id) {\n _name = obj._id;\n const scriptIdName = _name.substring(SCRIPT_CODE_MARKER.length);\n\n if (!scriptIdName.length || scriptIdName.endsWith('.')) {\n this.log.error(`Script name ${_name} is invalid!`);\n return false;\n }\n await this.setState(`scriptEnabled.${scriptIdName}`, false, true);\n }\n if (!obj) {\n this.log.error('Invalid script');\n }\n return false;\n }\n\n async loadScriptById(id: string): Promise {\n let obj: ioBroker.ScriptObject | null | undefined;\n try {\n obj = (await this.getForeignObjectAsync(id)) as ioBroker.ScriptObject | null | undefined;\n } catch (err: any) {\n this.log.error(`Invalid script \"${id}\": ${err}`);\n }\n if (!obj) {\n return false;\n }\n return this.loadScript(obj);\n }\n\n async loadScript(nameOrObject: ioBroker.ScriptObject): Promise {\n // create states for scripts\n await this.createActiveObject(nameOrObject._id, nameOrObject?.common?.enabled);\n await this.createProblemObject(nameOrObject._id);\n return this.prepareScript(nameOrObject);\n }\n\n getAstroEvent(\n date: Date,\n astroEvent: AstroEventName,\n start: string,\n end: string,\n offsetMinutes: number | string,\n isDayEnd: boolean,\n latitude: number,\n longitude: number,\n useNextDay?: boolean,\n ): Date {\n let ts: Date = this.mods.suncalc.getTimes(date, latitude, longitude)[astroEvent];\n\n if (!ts || ts.getTime().toString() === 'NaN') {\n ts = isDayEnd ? getNextTimeEvent(end, useNextDay) : getNextTimeEvent(start, useNextDay);\n }\n ts.setMilliseconds(0);\n ts.setMinutes(ts.getMinutes() + (parseInt(offsetMinutes as unknown as string, 10) || 0));\n\n const [timeHoursStart, timeMinutesStart] = start.split(':');\n const nTimeHoursStart = parseInt(timeHoursStart, 10);\n const nTimeMinutesStart = parseInt(timeMinutesStart, 10) || 0;\n\n if (\n ts.getHours() < nTimeHoursStart ||\n (ts.getHours() === nTimeHoursStart && ts.getMinutes() < nTimeMinutesStart)\n ) {\n ts = getNextTimeEvent(start, useNextDay);\n ts.setSeconds(0);\n }\n\n const [timeHoursEnd, timeMinutesEnd] = end.split(':');\n const nTimeHoursEnd = parseInt(timeHoursEnd, 10);\n const nTimeMinutesEnd = parseInt(timeMinutesEnd, 10) || 0;\n\n if (ts.getHours() > nTimeHoursEnd || (ts.getHours() === nTimeHoursEnd && ts.getMinutes() > nTimeMinutesEnd)) {\n ts = getNextTimeEvent(end, useNextDay);\n ts.setSeconds(0);\n }\n\n // if event in the past\n if (date > ts && useNextDay) {\n // take the next day\n ts.setDate(ts.getDate() + 1);\n }\n return ts;\n }\n\n async timeSchedule(): Promise {\n const now = new Date();\n let hours = now.getHours();\n const minutes = now.getMinutes();\n if (this.timeSettings.format12) {\n if (hours > 12) {\n hours -= 12;\n }\n }\n let sHours: string;\n if (this.timeSettings.leadingZeros) {\n sHours = hours.toString().padStart(2, '0');\n } else {\n sHours = hours.toString();\n }\n\n await this.setState('variables.dayTime', {\n val: `${sHours}:${minutes.toString().padStart(2, '0')}`,\n ack: true,\n });\n\n now.setMinutes(now.getMinutes() + 1);\n now.setSeconds(0);\n now.setMilliseconds(0);\n const interval = now.getTime() - Date.now();\n this.timeScheduleTimer = setTimeout(() => this.timeSchedule(), interval);\n }\n\n async dayTimeSchedules(): Promise {\n // get astrological event\n if (\n this.config.latitude === undefined ||\n this.config.longitude === undefined ||\n (this.config.latitude as unknown as string) === '' ||\n (this.config.longitude as unknown as string) === '' ||\n this.config.latitude === null ||\n this.config.longitude === null\n ) {\n this.log.error('Longitude or latitude does not set. Cannot use astro.');\n return;\n }\n\n // Calculate the next event today\n const todayDate = getAstroStartOfDay();\n const nowDate = new Date();\n\n const todaySunrise = this.getAstroEvent(\n todayDate,\n this.config.sunriseEvent,\n this.config.sunriseLimitStart,\n this.config.sunriseLimitEnd,\n this.config.sunriseOffset,\n false,\n this.config.latitude,\n this.config.longitude,\n );\n const todaySunset = this.getAstroEvent(\n todayDate,\n this.config.sunsetEvent,\n this.config.sunsetLimitStart,\n this.config.sunsetLimitEnd,\n this.config.sunsetOffset,\n true,\n this.config.latitude,\n this.config.longitude,\n );\n\n // Sunrise\n let sunriseTimeout = todaySunrise.getTime() - nowDate.getTime();\n if (sunriseTimeout < 0 || sunriseTimeout > 3600000) {\n sunriseTimeout = 3600000;\n }\n\n // Sunset\n let sunsetTimeout = todaySunset.getTime() - nowDate.getTime();\n if (sunsetTimeout < 0 || sunsetTimeout > 3600000) {\n sunsetTimeout = 3600000;\n }\n\n const isDayTime: ioBroker.State | null | undefined = await this.getStateAsync('variables.isDayTime');\n let isDay: boolean;\n if (sunriseTimeout < 5000) {\n isDay = true;\n } else if (sunsetTimeout < 5000) {\n isDay = false;\n } else {\n // check if in between\n isDay = nowDate.getTime() > todaySunrise.getTime() - 60000 && nowDate <= todaySunset;\n }\n\n const valDayTime = isDayTime ? !!isDayTime.val : false;\n if (valDayTime !== isDay || isDayTime === null) {\n await this.setState('variables.isDayTime', isDay, true);\n }\n\n const dayLightSaving: ioBroker.State | null | undefined =\n await this.getStateAsync('variables.isDaylightSaving');\n const isDayLightSaving = dstOffsetAtDate(nowDate) !== 0;\n const val = dayLightSaving ? !!dayLightSaving.val : false;\n\n if (val !== isDayLightSaving || dayLightSaving === null) {\n await this.setState('variables.isDaylightSaving', isDayLightSaving, true);\n }\n\n let nextTimeout = sunriseTimeout;\n if (sunriseTimeout > sunsetTimeout) {\n nextTimeout = sunsetTimeout;\n }\n nextTimeout = nextTimeout - 3000;\n if (nextTimeout < 3000) {\n nextTimeout = 3000;\n }\n\n this.dayScheduleTimer = setTimeout(() => this.dayTimeSchedules(), nextTimeout);\n }\n\n stopTimeSchedules(): void {\n if (this.dayScheduleTimer) {\n clearTimeout(this.dayScheduleTimer);\n this.dayScheduleTimer = null;\n }\n if (this.sunScheduleTimer) {\n clearTimeout(this.sunScheduleTimer);\n this.sunScheduleTimer = null;\n }\n if (this.timeScheduleTimer) {\n clearTimeout(this.timeScheduleTimer);\n this.timeScheduleTimer = null;\n }\n }\n\n async patchFont(): Promise {\n let stat: Stats | undefined;\n let dbFile: Buffer | undefined;\n try {\n stat = statSync(`${__dirname}/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf`);\n const _dbFile = await this.readFileAsync(\n 'javascript.admin',\n `vs/base/browser/ui/codicons/codicon/codicon.ttf`,\n );\n if (_dbFile?.file) {\n dbFile = _dbFile.file as Buffer;\n }\n } catch {\n // ignore\n }\n\n if (stat?.size !== 73452 || dbFile?.byteLength !== 73452) {\n try {\n const buffer = Buffer.from(\n JSON.parse(readFileSync(`${__dirname}/admin/vsFont/codicon.json`).toString()),\n 'base64',\n );\n\n const jszip = await import('jszip');\n const zip = await jszip.loadAsync(buffer);\n let data: ArrayBuffer | undefined;\n if (zip) {\n data = await zip.file('codicon.ttf')?.async('arraybuffer');\n if (data?.byteLength !== 73452) {\n this.log.error(`Cannot patch font: invalid font file!`);\n return false;\n }\n } else {\n this.log.error(`Cannot patch font: invalid font file!`);\n return false;\n }\n writeFileSync(`${__dirname}/admin/vs/base/browser/ui/codicons/codicon/codicon.ttf`, Buffer.from(data));\n // upload this file\n await this.writeFileAsync(\n 'javascript.admin',\n 'vs/base/browser/ui/codicons/codicon/codicon.ttf',\n Buffer.from(data),\n );\n return true;\n } catch (err: unknown) {\n this.log.error(`Cannot patch font: ${err as Error}`);\n return false;\n }\n }\n return false;\n }\n\n async sunTimeSchedules(): Promise {\n if (this.config.createAstroStates) {\n if (!isNaN(this.config.longitude) && !isNaN(this.config.longitude)) {\n const calcDate = getAstroStartOfDay();\n\n const times = this.mods.suncalc.getTimes(calcDate, this.config.latitude, this.config.longitude);\n\n this.log.debug(`[sunTimeSchedules] Times: ${JSON.stringify(times)}`);\n\n for (const t in times) {\n try {\n const objId = `variables.astro.${t}`;\n\n await this.setObjectNotExistsAsync(objId, {\n type: 'state',\n common: {\n name: `Astro ${t}`,\n type: 'string',\n role: 'value',\n read: true,\n write: false,\n },\n native: {},\n });\n\n if (times[t] !== null && !isNaN(times[t].getTime())) {\n const timeFormatted = formatHoursMinutesSeconds(times[t]);\n await this.setState(objId, {\n val: timeFormatted,\n c: times[t].toISOString(),\n ack: true,\n });\n } else {\n await this.setState(objId, { val: null, c: 'n/a', ack: true, q: 0x01 });\n }\n } catch (err: unknown) {\n this.log.error(\n `[sunTimeSchedules] Unable to set state for astro time \"${t}\" (${times[t].getTime()}): ${err as Error}`,\n );\n }\n }\n\n const todayDate = new Date();\n todayDate.setHours(0);\n todayDate.setMinutes(0);\n todayDate.setSeconds(1);\n todayDate.setMilliseconds(0);\n todayDate.setDate(todayDate.getDate() + 1);\n\n this.log.debug(`[sunTimeSchedules] Next: ${todayDate.toISOString()}`);\n this.sunScheduleTimer = setTimeout(() => this.sunTimeSchedules(), todayDate.getTime() - Date.now());\n }\n } else {\n // remove astro states if disabled\n this.delObject('variables.astro', { recursive: true });\n }\n }\n\n /**\n * Redirects the virtual-tsc log output to the ioBroker log\n */\n tsLog = (message: string, severity?: ioBroker.LogLevel): void => {\n // shift the severities around, we don't care about the small details\n if (!severity || severity === 'info') {\n severity = 'debug';\n } else if (severity === 'debug') {\n // Don't spam build logs on Travis\n if (isCI) {\n return;\n }\n severity = 'silly';\n }\n\n if (this?.log) {\n this.log[severity](message);\n } else {\n console.log(`[${severity.toUpperCase()}] ${message}`);\n }\n };\n\n addGetProperty(object: Record): void {\n try {\n Object.defineProperty(object, 'get', {\n value: function (id: string): any {\n return this[id] || this[`${this.namespace}.${id}`];\n },\n enumerable: false,\n });\n } catch {\n console.error('Cannot install get property');\n }\n }\n\n /**\n * @param scriptID - The current script the declarations were generated from\n * @param declarations\n */\n provideDeclarationsForGlobalScript(scriptID: string, declarations: string): void {\n // Remember which declarations this global script had access to,\n // we need this so the editor doesn't show a duplicate identifier error\n if (this.globalDeclarations != null && this.globalDeclarations !== '') {\n this.knownGlobalDeclarationsByScript[scriptID] = this.globalDeclarations;\n }\n // and concatenate the global declarations for the next scripts\n this.globalDeclarations += `${declarations}\\n`;\n // remember all previously generated global declarations,\n // so global scripts can reference each other\n const globalDeclarationPath = 'global.d.ts';\n tsAmbient[globalDeclarationPath] = this.globalDeclarations;\n // make sure the next script compilation has access to the updated declarations\n this.tsServer.provideAmbientDeclarations({\n [globalDeclarationPath]: this.globalDeclarations,\n });\n jsDeclarationServer.provideAmbientDeclarations({\n [globalDeclarationPath]: this.globalDeclarations,\n });\n }\n\n fixLineNo(line: string): string {\n if (line.includes('javascript.js:')) {\n return line;\n }\n if (!/script[s]?\\.js[.\\\\/]/.test(line)) {\n return line;\n }\n if (/:([\\d]+):/.test(line)) {\n line = line.replace(\n /:([\\d]+):/,\n ($0, $1) => `:${$1 > this.globalScriptLines + 1 ? $1 - this.globalScriptLines - 1 : $1}:`,\n ); // one line for 'async function ()'\n } else {\n line = line.replace(\n /:([\\d]+)$/,\n ($0, $1) => `:${$1 > this.globalScriptLines + 1 ? $1 - this.globalScriptLines - 1 : $1}`,\n ); // one line for 'async function ()'\n }\n return line;\n }\n\n debugStop(): Promise {\n if (this.debugState.child) {\n this.debugSendToInspector({ cmd: 'end' });\n this.debugState.endTimeout = setTimeout(() => {\n this.debugState.endTimeout = null;\n this.debugState.child?.kill('SIGTERM');\n }, 500);\n this.debugState.promiseOnEnd = this.debugState.promiseOnEnd || Promise.resolve(0);\n } else {\n this.debugState.promiseOnEnd = Promise.resolve(0);\n }\n\n return this.debugState.promiseOnEnd.then(() => {\n this.debugState.child = null;\n this.debugState.running = false;\n this.debugState.scriptName = '';\n if (this.debugState.endTimeout) {\n clearTimeout(this.debugState.endTimeout);\n this.debugState.endTimeout = null;\n }\n });\n }\n\n async debugDisableScript(id: string | undefined): Promise {\n if (id) {\n const obj = this.objects[id];\n if (obj?.common?.enabled) {\n await this.extendForeignObjectAsync(obj._id, { common: { enabled: false } });\n }\n }\n }\n\n debugSendToInspector(message: any): void {\n if (this.debugState.child) {\n try {\n this.log.info(`send to debugger: ${message}`);\n this.debugState.child.send(message);\n } catch {\n this.debugStop().then(() =>\n this.log.info(\n `Debugging of \"${this.debugState.scriptName}\" was stopped, because started in normal mode`,\n ),\n );\n }\n } else {\n this.log.error(`Cannot send command to terminated inspector`);\n this.setState(\n 'debug.from',\n JSON.stringify({ cmd: 'error', error: `Cannot send command to terminated inspector`, id: 1 }),\n true,\n );\n }\n }\n\n debugStart(data: { breakOnStart?: boolean; scriptName?: string; adapter?: string }): void {\n if (Date.now() - this.debugState.started < 1000) {\n console.log('Start ignored');\n return;\n }\n\n this.debugState.started = Date.now();\n // stop the script if it's running\n this.debugDisableScript(data.scriptName)\n .then(() => this.debugStop())\n .then(() => {\n if (data.adapter) {\n this.debugState.adapterInstance = data.adapter;\n this.debugState.scriptName = '';\n } else {\n this.debugState.adapterInstance = '';\n this.debugState.scriptName = data.scriptName as string;\n }\n\n this.debugState.breakOnStart = data.breakOnStart;\n\n this.debugState.promiseOnEnd = new Promise(resolve => {\n const options: ForkOptions = {\n stdio: ['ignore', 'inherit', 'inherit', 'ipc'],\n //stdio: ['pipe', 'pipe', 'pipe', 'ipc']\n };\n const args: string[] = [];\n if (this.debugState.adapterInstance) {\n args.push('--breakOnStart');\n }\n\n this.debugState.child = fork(`${__dirname}/lib/inspect.ts`, args, options);\n\n /*debugState.child.stdout.setEncoding('utf8');\n debugState.child.stderr.setEncoding('utf8');\n debugState.child.stdout.on('data', childPrint);\n debugState.child.stderr.on('data', childPrint);*/\n\n this.debugState.child?.on(\n 'message',\n (\n message:\n | string\n | {\n cmd: 'ready' | 'watched' | 'paused' | 'resumed' | 'log' | 'readyToDebug';\n severity?: string;\n text?: string;\n scriptId?: string;\n script?: string;\n },\n ) => {\n let oMessage: {\n cmd: 'ready' | 'watched' | 'paused' | 'resumed' | 'log' | 'readyToDebug';\n severity?: string;\n text?: string;\n scriptId?: string;\n script?: string;\n };\n if (typeof message === 'string') {\n try {\n oMessage = JSON.parse(message);\n } catch {\n return this.log.error(`Cannot parse message from inspector: ${message}`);\n }\n } else {\n oMessage = message;\n }\n\n if (oMessage.cmd !== 'ready') {\n this.setState('debug.from', JSON.stringify(oMessage), true);\n }\n\n switch (oMessage.cmd) {\n case 'ready': {\n this.debugSendToInspector({\n cmd: 'start',\n scriptName: this.debugState.scriptName,\n adapterInstance: this.debugState.adapterInstance,\n instance: this.instance,\n });\n break;\n }\n\n case 'watched': {\n //console.log(`WATCHED: ${JSON.stringify(oMessage)}`);\n break;\n }\n\n case 'paused': {\n this.debugState.paused = true;\n console.log(`host: PAUSED`);\n break;\n }\n\n case 'resumed': {\n this.debugState.paused = false;\n //console.log(`STARTED`);\n break;\n }\n\n case 'log': {\n console.log(`[${oMessage.severity}] ${oMessage.text}`);\n break;\n }\n\n case 'readyToDebug': {\n console.log(\n `host: readyToDebug (set breakpoints): [${oMessage.scriptId}] ${oMessage.script}`,\n );\n break;\n }\n }\n },\n );\n this.debugState.child?.on('error', error => {\n this.log.error(`Cannot start inspector: ${error}`);\n this.setState('debug.from', JSON.stringify({ cmd: 'error', error }), true);\n });\n\n this.debugState.child?.on('exit', (code: number): void => {\n if (code) {\n this.setState(\n 'debug.from',\n JSON.stringify({ cmd: 'error', error: `invalid response code: ${code}` }),\n true,\n );\n }\n this.setState('debug.from', JSON.stringify({ cmd: 'debugStopped', code }), true);\n this.debugState.child = null;\n resolve(code);\n });\n });\n });\n }\n}\n\nfunction patternMatching(\n event: EventObj,\n patternFunctions: PatternEventCompareFunction[] & { logic?: 'and' | 'or' },\n): boolean {\n let matched = false;\n for (let i = 0, len = patternFunctions.length; i < len; i++) {\n if (patternFunctions[i](event)) {\n if (patternFunctions.logic === 'or') {\n return true;\n }\n matched = true;\n } else if (patternFunctions.logic === 'and') {\n return false;\n }\n }\n return matched;\n}\n\n// If started as allInOne mode => return function to create instance\nif (require.main !== module) {\n // Export the constructor in compact mode\n module.exports = (options: Partial | undefined) => new JavaScript(options);\n} else {\n // otherwise start the instance directly\n (() => new JavaScript())();\n}\n"]} \ No newline at end of file diff --git a/src-editor/src/App.tsx b/src-editor/src/App.tsx index 181960ea4..d20215df2 100644 --- a/src-editor/src/App.tsx +++ b/src-editor/src/App.tsx @@ -749,7 +749,7 @@ class App extends GenericApp { onEnableDisable(id: string, enabled: boolean): void { if (this.scripts[id] && this.scripts[id].type === 'script') { - const common = this.scripts[id].common; + const common: ioBroker.ScriptCommon = this.scripts[id].common as ioBroker.ScriptCommon; common.enabled = enabled; common.expert = true; this.updateScript(id, id, common).catch(err => err !== 'canceled' && this.showJsError(err)); diff --git a/src-editor/src/Components/BlocklyEditor.tsx b/src-editor/src/Components/BlocklyEditor.tsx index b7a37b365..6d246c2b9 100644 --- a/src-editor/src/Components/BlocklyEditor.tsx +++ b/src-editor/src/Components/BlocklyEditor.tsx @@ -439,10 +439,10 @@ class BlocklyEditor extends React.Component item.id === 'TriggerState') && + !!this.props.userRules?.triggers?.find(item => item.id === 'TriggerState') && !this.props.userRules?.triggers?.find(item => item.id !== 'TriggerState') ); } @@ -38,7 +38,9 @@ class ActionOperateStates extends GenericBlock {I18n.t('Set:')}{' '} - + {renderValue(debugMessage.data.val)} diff --git a/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetState.tsx b/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetState.tsx index 6e057b9da..de328d3e0 100644 --- a/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetState.tsx +++ b/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetState.tsx @@ -27,7 +27,7 @@ class ActionSetState extends GenericBlock { isAllTriggersOnState(): boolean { return ( - this.props.userRules?.triggers?.find(item => item.id === 'TriggerState') && + !!this.props.userRules?.triggers?.find(item => item.id === 'TriggerState') && !this.props.userRules?.triggers?.find(item => item.id !== 'TriggerState') ); } diff --git a/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetStateDelayed.tsx b/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetStateDelayed.tsx index dc66695a6..d3d05c732 100644 --- a/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetStateDelayed.tsx +++ b/src-editor/src/Components/RulesEditor/components/Blocks/ActionSetStateDelayed.tsx @@ -20,7 +20,7 @@ class ActionSetStateDelayed extends GenericBlock item.id === 'TriggerState') && + !!this.props.userRules?.triggers?.find(item => item.id === 'TriggerState') && !this.props.userRules?.triggers?.find(item => item.id !== 'TriggerState') ); } @@ -60,7 +60,9 @@ class ActionSetStateDelayed extends GenericBlock {I18n.t('Set:')}{' '} - + {renderValue(debugMessage.data.val)} diff --git a/src-editor/src/Components/RulesEditor/components/Blocks/ConditionState.tsx b/src-editor/src/Components/RulesEditor/components/Blocks/ConditionState.tsx index 01f1e613f..42116ad66 100644 --- a/src-editor/src/Components/RulesEditor/components/Blocks/ConditionState.tsx +++ b/src-editor/src/Components/RulesEditor/components/Blocks/ConditionState.tsx @@ -9,6 +9,7 @@ import { GenericBlock, type GenericBlockProps, type GenericBlockState } from '.. import HysteresisImage from '../../../assets/hysteresis.png'; import type { RuleBlockConfigActionActionState, + RuleBlockConfigTriggerState, RuleBlockDescription, RuleContext, RuleInputAny, @@ -97,7 +98,7 @@ class ConditionState extends GenericBlock' ? '!=' : config.tagCard; if (config.useTrigger) { debugValue = 'obj.state.val'; - if (context?.trigger?.oidType === 'string') { + if ((context?.trigger as RuleBlockConfigTriggerState)?.oidType === 'string') { value = (value as string).replace(/"/g, '\\"'); result = `subCondVar${config._id} ${compare} "${value}"`; } else { @@ -127,7 +128,7 @@ class ConditionState extends GenericBlock ({ value: val, title: oidStates[val] })); + options = Object.keys(oidStates) + .map(val => { + if (oidStates) { + return { value: val, title: oidStates[val] }; + } + return null; + }) + .filter(i => i) as { value: string | boolean; title: string }[]; } } else if (oidType === 'boolean') { tagCardArray = [ @@ -291,7 +299,10 @@ class ConditionState extends GenericBlock ({ value: val, title: oidStates[val] })); + options = Object.keys(oidStates).map(val => ({ + value: val, + title: oidStates ? oidStates[val] : val.toString(), + })); } } diff --git a/src-editor/src/Components/RulesEditor/components/Blocks/TriggerSchedule.tsx b/src-editor/src/Components/RulesEditor/components/Blocks/TriggerSchedule.tsx index a14d64a8f..581d6d403 100644 --- a/src-editor/src/Components/RulesEditor/components/Blocks/TriggerSchedule.tsx +++ b/src-editor/src/Components/RulesEditor/components/Blocks/TriggerSchedule.tsx @@ -6,7 +6,7 @@ import { ComplexCron, Schedule, I18n } from '@iobroker/adapter-react-v5'; import convertCronToText from '@iobroker/adapter-react-v5/build/Components/SimpleCron/cronText'; import { GenericBlock, type GenericBlockProps, type GenericBlockState } from '../GenericBlock'; -import Compile from '../../helpers/Compile'; +import { STANDARD_FUNCTION_STATE, STANDARD_FUNCTION_STATE_ONCHANGE } from '../../helpers/Compile'; import CustomInput from '../CustomInput'; import CustomButton from '../CustomButton'; import CustomModal from '../CustomModal'; @@ -63,7 +63,7 @@ class TriggerScheduleBlock extends GenericBlock this.setState({ openDialog: true })} /> - { - onChange(textCron, attr, () => { - onChange(convertCronToText(textCron, I18n.getLanguage()), 'addText'); - this.setState({ openDialog: false }); - }); - }} - onClose={() => this.setState({ openDialog: false })} - > - )[attr] ? (settings as Record)[attr] : '' - } - onChange={el => (textCron = el)} - language={I18n.getLanguage()} - /> - + {this.state.openDialog ? ( + { + onChange(textCron, attr, () => { + onChange(convertCronToText(textCron, I18n.getLanguage()), 'addText'); + this.setState({ openDialog: false }); + }); + }} + onClose={() => this.setState({ openDialog: false })} + > + )[attr] ? (settings as Record)[attr] : '' + } + onChange={el => (textCron = el)} + language={I18n.getLanguage()} + /> + + ) : null} {this.renderNameText( { nameRender: 'renderNameText', @@ -383,30 +384,31 @@ class TriggerScheduleBlock extends GenericBlock this.setState({ openDialog: true })} /> - - this.setState({ openDialog: false }, () => - onChange({ - [`${attr}Text`]: wizardText, - [attr]: wizard, - }), - ) - } - onClose={() => this.setState({ openDialog: false })} - > - { - wizardText = description || ''; - const wizardObj: ScheduleConfig = JSON.parse(schedule) as ScheduleConfig; - wizardObj.valid = wizardObj.valid || {}; - wizardObj.valid.from = wizardObj.valid.from || Schedule.now2string(); - wizard = JSON.stringify(wizardObj); - }} - /> - + {this.state.openDialog ? ( + + this.setState({ openDialog: false }, () => + onChange({ + [`${attr}Text`]: wizardText, + [attr]: wizard, + }), + ) + } + onClose={() => this.setState({ openDialog: false })} + > + { + wizardText = description || ''; + const wizardObj: ScheduleConfig = JSON.parse(schedule) as ScheduleConfig; + wizardObj.valid = wizardObj.valid || {}; + wizardObj.valid.from = wizardObj.valid.from || Schedule.now2string(); + wizard = JSON.stringify(wizardObj); + }} + /> + + ) : null} ); } diff --git a/src-editor/src/Components/RulesEditor/components/Blocks/TriggerScriptSave.tsx b/src-editor/src/Components/RulesEditor/components/Blocks/TriggerScriptSave.tsx index d7df07396..559d9aa3b 100644 --- a/src-editor/src/Components/RulesEditor/components/Blocks/TriggerScriptSave.tsx +++ b/src-editor/src/Components/RulesEditor/components/Blocks/TriggerScriptSave.tsx @@ -1,6 +1,6 @@ import { I18n } from '@iobroker/adapter-react-v5'; import { GenericBlock, type GenericBlockProps } from '../GenericBlock'; -import Compile from '../../helpers/Compile'; +import { NO_FUNCTION } from '../../helpers/Compile'; import type { RuleBlockConfigTriggerScriptSave, RuleBlockDescription, @@ -14,10 +14,7 @@ class TriggerScriptSave extends GenericBlock { } static compile(config: RuleBlockConfigTriggerScriptSave, _context: RuleContext): string { - return Compile.NO_FUNCTION.replace( - '"__%%DEBUG_TRIGGER%%__"', - `_sendToFrontEnd(${config._id}, {trigger: true})`, - ); + return NO_FUNCTION.replace('"__%%DEBUG_TRIGGER%%__"', `_sendToFrontEnd(${config._id}, {trigger: true})`); } // eslint-disable-next-line class-methods-use-this diff --git a/src-editor/src/Components/RulesEditor/components/Blocks/TriggerState.tsx b/src-editor/src/Components/RulesEditor/components/Blocks/TriggerState.tsx index 3b5df243e..a0b4b7e2a 100644 --- a/src-editor/src/Components/RulesEditor/components/Blocks/TriggerState.tsx +++ b/src-editor/src/Components/RulesEditor/components/Blocks/TriggerState.tsx @@ -19,7 +19,7 @@ import { MdCancel as IconCancel, MdCheck as IconCheck } from 'react-icons/md'; import { I18n } from '@iobroker/adapter-react-v5'; import { GenericBlock, type GenericBlockProps, type GenericBlockState } from '../GenericBlock'; -import Compile from '../../helpers/Compile'; +import { STANDARD_FUNCTION_STATE, STANDARD_FUNCTION_STATE_ONCHANGE } from '../../helpers/Compile'; import { renderValue } from '../../helpers/utils'; import type { RuleBlockConfigTriggerState, RuleBlockDescription, RuleContext, RuleTagCardTitle } from '../../types'; @@ -63,7 +63,7 @@ class TriggerState extends GenericBlock - - this.setState({ openSimulate: false })} - aria-labelledby="simulate-dialog-slide-title" - aria-describedby="simulate-dialog-slide-description" - > - {I18n.t('Trigger with value')} - - {this.state.settings.oidType === 'boolean' ? ( - e.keyCode === 13 && this.onWriteValue()} - value={!!this.state.simulateValue} - onChange={e => this.setState({ simulateValue: e.target.checked })} - /> - } - label={I18n.t('Value')} - /> - ) : ( - e.keyCode === 13 && this.onWriteValue()} - value={this.state.simulateValue} - onChange={e => this.setState({ simulateValue: e.target.value })} - /> - )} -
+ renderWriteState(): React.JSX.Element[] { + return [ + , + this.setState({ openSimulate: false })} + aria-labelledby="simulate-dialog-slide-title" + aria-describedby="simulate-dialog-slide-description" + > + {I18n.t('Trigger with value')} + + {this.state.settings.oidType === 'boolean' ? ( this.setState({ simulateAck: e.target.checked })} - color="primary" + e.key === 'Enter' && this.onWriteValue()} + value={!!this.state.simulateValue} + onChange={e => this.setState({ simulateValue: e.target.checked })} /> } - label={I18n.t('Ack')} + label={I18n.t('Value')} /> - - - - - - - - ); + ) : ( + e.key === 'Enter' && this.onWriteValue()} + value={ + !this.state.simulateValue && this.state.simulateValue !== 0 + ? '' + : this.state.simulateValue + } + onChange={e => this.setState({ simulateValue: e.target.value })} + /> + )} +
+ this.setState({ simulateAck: e.target.checked })} + color="primary" + /> + } + label={I18n.t('Ack')} + /> +
+ + + + +
, + ]; } onTagChange(_tagCard: RuleTagCardTitle): void { diff --git a/src-editor/src/Components/RulesEditor/components/ContextWrapper/index.tsx b/src-editor/src/Components/RulesEditor/components/ContextWrapper/index.tsx index be228dae1..04906d1ab 100644 --- a/src-editor/src/Components/RulesEditor/components/ContextWrapper/index.tsx +++ b/src-editor/src/Components/RulesEditor/components/ContextWrapper/index.tsx @@ -26,8 +26,8 @@ interface RuleContext { socket: AdminConnection | null; onUpdate: boolean; setOnUpdate: (value: boolean) => void; - onDebugMessage: DebugMessage | null; - setOnDebugMessage: (message: DebugMessage | null) => void; + onDebugMessage: DebugMessage[]; + setOnDebugMessage: (message: DebugMessage[]) => void; enableSimulation: boolean; setEnableSimulation: (enableSimulation: boolean) => void; } @@ -39,8 +39,8 @@ export const ContextWrapperCreate = createContext({ onUpdate: false, setOnUpdate: (_onUpdate: boolean): void => {}, - setOnDebugMessage: (_message: DebugMessage | null): void => {}, - onDebugMessage: null, + setOnDebugMessage: (_message: DebugMessage[]): void => {}, + onDebugMessage: [], enableSimulation: false, setEnableSimulation: (_enableSimulation: boolean): void => {}, @@ -50,7 +50,7 @@ const getOrLoadRemote = ( remote: string, shareScope: string, remoteFallbackUrl: string | undefined = undefined, -): Promise<{ get: (module: string) => () => Promise<{ default: Record> }> }> => +): Promise<{ get: (module: string) => () => Promise<{ default: typeof GenericBlock }> }> => new Promise((resolve, reject) => { // check if remote exists on window if (!(window as any)[remote]) { @@ -115,8 +115,8 @@ function loadComponent( sharedScope: string, module: string, url: string, -): () => Promise<{ default: Record> }> { - return async (): Promise<{ default: Record> }> => { +): () => Promise<{ default: typeof GenericBlock }> { + return async (): Promise<{ default: typeof GenericBlock }> => { await getOrLoadRemote(remote, sharedScope, url); const container = (window as any)[remote]; const factory = await container.get(module); @@ -127,7 +127,7 @@ function loadComponent( export const ContextWrapper = ({ children, socket }: { socket: AdminConnection; children: any }): React.JSX.Element => { const [blocks, setBlocks] = useState<(typeof GenericBlock)[] | null>(null); const [onUpdate, setOnUpdate] = useState(false); - const [onDebugMessage, setOnDebugMessage] = useState(null); + const [onDebugMessage, setOnDebugMessage] = useState([]); const [enableSimulation, setEnableSimulation] = useState(false); useEffect(() => { @@ -175,8 +175,8 @@ export const ContextWrapper = ({ children, socket }: { socket: AdminConnection; // @ts-expect-error javascriptRules in js-controller if (obj.common.javascriptRules.i18n === true) { // load i18n from files - const pos = url.lastIndexOf('/'); - let i18nURL; + const pos: number = url.lastIndexOf('/'); + let i18nURL: string; if (pos !== -1) { i18nURL = url.substring(0, pos); } else { @@ -222,7 +222,7 @@ export const ContextWrapper = ({ children, socket }: { socket: AdminConnection; ).default; if (Component) { - adapterDynamicBlocksArray.push(Component.default); + adapterDynamicBlocksArray.push(Component); alreadyCreated.push(obj.common.name); ADAPTERS[obj.common.name] = null; } diff --git a/src-editor/src/Components/RulesEditor/components/CurrentItem/index.tsx b/src-editor/src/Components/RulesEditor/components/CurrentItem/index.tsx index 1258d0171..51687cdac 100644 --- a/src-editor/src/Components/RulesEditor/components/CurrentItem/index.tsx +++ b/src-editor/src/Components/RulesEditor/components/CurrentItem/index.tsx @@ -1,4 +1,4 @@ -import React, { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react'; +import React, { memo, useCallback, useContext, useMemo, useState } from 'react'; import type { AdminConnection, IobTheme, ThemeName, ThemeType } from '@iobroker/adapter-react-v5'; import cls from './style.module.scss'; @@ -36,10 +36,6 @@ const CurrentItem = memo((props: CurrentItemProps) => { const { blocks, socket, onUpdate, setOnUpdate, onDebugMessage, enableSimulation } = useContext(ContextWrapperCreate); - useEffect(() => { - console.log(`New message !! ${JSON.stringify(onDebugMessage)}`); - }, [onDebugMessage]); - const findElementBlocks = useCallback( (id: string) => blocks?.find(el => { diff --git a/src-editor/src/Components/RulesEditor/components/CustomModal/index.tsx b/src-editor/src/Components/RulesEditor/components/CustomModal/index.tsx index 3ead2b800..a9238d8f4 100644 --- a/src-editor/src/Components/RulesEditor/components/CustomModal/index.tsx +++ b/src-editor/src/Components/RulesEditor/components/CustomModal/index.tsx @@ -7,7 +7,6 @@ import cls from './style.module.scss'; import CustomInput from '../CustomInput'; interface CustomModalProps { - open: boolean; onClose: () => void; children?: React.JSX.Element[] | React.JSX.Element | null; titleButtonApply?: string; @@ -19,7 +18,6 @@ interface CustomModalProps { } const CustomModal = ({ - open, onClose, children, titleButtonApply, @@ -30,10 +28,11 @@ const CustomModal = ({ defaultValue, }: CustomModalProps): React.JSX.Element => { const [value, setValue] = useState(defaultValue || ''); + const [originalValue] = useState(defaultValue || ''); return (