iobroker.javascript 9.3.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- package/admin/assets/AiChatPanel-p0KAg6Cs.js +237 -0
- package/admin/assets/AiDatapointProvider-DzFpUKkT.js +2 -0
- package/admin/assets/AiDiffView-BPTLnNx1.js +1 -0
- package/admin/assets/AiInlineProvider-CaHd2G2Q.js +5 -0
- package/admin/assets/AiScriptAnalyzer--BHML2rN.js +9 -0
- package/admin/assets/BlocklyEditor-CAjVMhYT.js +81 -0
- package/admin/assets/ContextWrapper-BVc8wTK_.css +1 -0
- package/admin/assets/ContextWrapper-D9CrnNKs.js +127 -0
- package/admin/assets/Debugger-SjROokFI.js +15 -0
- package/admin/assets/Error-DDfrxAt2.js +1 -0
- package/admin/assets/Import-DpTg1Jow.js +1 -0
- package/admin/assets/RulesEditor-BSRFWpEm.css +1 -0
- package/admin/assets/RulesEditor-D0hgrcBc.js +1 -0
- package/admin/assets/ScriptEditor-BGIuoNei.js +2 -0
- package/admin/assets/ScriptEditorVanillaMonaco-DyMQtoTQ.js +3 -0
- package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-DWJotR1B.js +1 -0
- package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CxICLr5Z.js +1243 -0
- package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BBAXJaqI.js +9 -0
- package/admin/assets/aiCodeLensProvider-hyAmut0e.js +4 -0
- package/admin/assets/aiPromptBuilder-Bs27qOHT.js +7 -0
- package/admin/assets/applyCodeEdit-D3nb7erO.js +1 -0
- package/admin/assets/blocklyDarkTheme-DEiAX5DT.js +1 -0
- package/admin/assets/cronHoverProvider-pKJkSevo.js +2 -0
- package/admin/assets/dist-uw5orDgd.js +4 -0
- package/admin/assets/{docs-compact-CKNGiYh2.js → docs-compact-D7rpMc7r.js} +2 -2
- package/admin/assets/hostInit-BFg5u9hY.js +1 -0
- package/admin/assets/index-B1gICjdq.js +192 -0
- package/admin/assets/index-BHhhebRG.css +1 -0
- package/admin/assets/inlineChatWidget-ZaisTOLh.js +2 -0
- package/admin/assets/inlineDiffController-hTwHHqcc.js +16 -0
- package/admin/assets/mf-entry-bootstrap-0-d6052b31.js +36 -0
- package/admin/assets/mjs-DWqivHEk.js +90 -0
- package/admin/assets/rolldown-runtime-C0FnF6B9.js +1 -0
- package/admin/assets/stateHoverProvider-C7DawIs-.js +9 -0
- package/admin/assets/virtualExposes-Ed0lGq7k.js +1 -0
- package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-BYs71IQF.js +1 -0
- package/admin/assets/virtual_mf-exposes___mfe_internal__iobroker_javascript__remoteEntry_js-DnnXQRkG.js +1 -0
- package/admin/assets/vite-preload-helper-B7qeedMF.js +1 -0
- package/admin/custom/assets/Components-BrDyDHXh.js +1 -0
- package/admin/custom/assets/Components-DftM8alF.css +1 -0
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-CyYJM2-v.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-BdzCssLn.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-CGb5Cofy.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BVCIAgbo.js +1243 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-BkB0anQX.js +1494 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__leaflet__loadShare__.js-h-rCw3iz.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BotqDuw-.js +9 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-Cb5TR7FB.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__leaflet__prebuild__-DARUoA03.js +1 -0
- package/admin/custom/assets/hostInit-DJx2uXXy.js +1 -0
- package/admin/custom/assets/index-uEKAoVT7.js +1 -0
- package/admin/custom/assets/lib-Yj8cfN0A.js +3 -0
- package/admin/custom/assets/mf-entry-bootstrap-0-77793feb.js +36 -0
- package/admin/custom/assets/rolldown-runtime-BcKkbAw3.js +1 -0
- package/admin/custom/assets/setYear-DJ9FbdkO.js +1 -0
- package/admin/custom/assets/virtualExposes-CxDjLoYu.js +1 -0
- package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-BU-ugy_7.js +1 -0
- package/admin/custom/assets/virtual_mf-exposes-ssr___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-BEfZbrf7.js +2 -0
- package/admin/custom/assets/virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-CTeZ0Jpm.js +2 -0
- package/admin/custom/assets/vite-preload-helper-B7qeedMF.js +1 -0
- package/admin/custom/customComponents.js +1 -1
- package/admin/jsonConfig.json +1 -1
- package/admin/mf-manifest.json +1 -1
- package/admin/mf-stats.json +1 -0
- package/admin/remoteEntry.js +1 -1
- package/admin/tab.html +12 -17
- package/build/lib/debugger.js +1 -1
- package/build/lib/debugger.js.map +1 -1
- package/build/lib/eventObj.js.map +1 -1
- package/build/lib/inspect.js.map +1 -1
- package/build/lib/javascript.d.ts +18 -19
- package/build/lib/nodeModulesManagement.js +3 -1
- package/build/lib/nodeModulesManagement.js.map +1 -1
- package/build/lib/protectFs.js.map +1 -1
- package/build/lib/sandbox.js +104 -43
- package/build/lib/sandbox.js.map +1 -1
- package/build/lib/scheduler.js.map +1 -1
- package/build/lib/tools.js +1 -1
- package/build/lib/tools.js.map +1 -1
- package/build/lib/typescriptSettings.js +16 -10
- package/build/lib/typescriptSettings.js.map +1 -1
- package/build/lib/typescriptTools.js +2 -2
- package/build/lib/typescriptTools.js.map +1 -1
- package/build/main.js +41 -29
- package/build/main.js.map +1 -1
- package/build/src/lib/aiProviderResolver.js +107 -0
- package/build/src/lib/aiProviderResolver.js.map +1 -0
- package/build/src/lib/anthropicAdapter.js +175 -0
- package/build/src/lib/anthropicAdapter.js.map +1 -0
- package/build/src/lib/consts.js +346 -0
- package/build/src/lib/consts.js.map +1 -0
- package/build/src/lib/convert.js +121 -0
- package/build/src/lib/convert.js.map +1 -0
- package/build/src/lib/crypto.js +32 -0
- package/build/src/lib/crypto.js.map +1 -0
- package/build/src/lib/debug.js +163 -0
- package/build/src/lib/debug.js.map +1 -0
- package/build/src/lib/debugger.js +1135 -0
- package/build/src/lib/debugger.js.map +1 -0
- package/build/src/lib/eventObj.js +194 -0
- package/build/src/lib/eventObj.js.map +1 -0
- package/build/src/lib/inspect.js +728 -0
- package/build/src/lib/inspect.js.map +1 -0
- package/build/src/lib/mirror.js +634 -0
- package/build/src/lib/mirror.js.map +1 -0
- package/build/src/lib/nodeModulesManagement.js +26 -0
- package/build/src/lib/nodeModulesManagement.js.map +1 -0
- package/build/src/lib/patternCompareFunctions.js +293 -0
- package/build/src/lib/patternCompareFunctions.js.map +1 -0
- package/build/src/lib/protectFs.js +554 -0
- package/build/src/lib/protectFs.js.map +1 -0
- package/build/src/lib/sandbox.js +4897 -0
- package/build/src/lib/sandbox.js.map +1 -0
- package/build/src/lib/scheduler.js +555 -0
- package/build/src/lib/scheduler.js.map +1 -0
- package/build/src/lib/tools.js +188 -0
- package/build/src/lib/tools.js.map +1 -0
- package/build/src/lib/typescriptSettings.js +39 -0
- package/build/src/lib/typescriptSettings.js.map +1 -0
- package/build/src/lib/typescriptTools.js +435 -0
- package/build/src/lib/typescriptTools.js.map +1 -0
- package/build/src/lib/utils.js +66 -0
- package/build/src/lib/utils.js.map +1 -0
- package/build/src/lib/words.js +76 -0
- package/build/src/lib/words.js.map +1 -0
- package/build/src/main.js +3414 -0
- package/build/src/main.js.map +1 -0
- package/build/types.d.ts +6 -14
- package/io-package.json +28 -28
- package/package.json +16 -17
- package/admin/assets/AiChatPanel-BvND3KNP.js +0 -317
- package/admin/assets/AiDatapointProvider-B0i3I5Fm.js +0 -2
- package/admin/assets/AiDiffView-RPozjjHf.js +0 -1
- package/admin/assets/AiInlineProvider-DkgjVSFQ.js +0 -7
- package/admin/assets/Save-CkuNSiWL.js +0 -1
- package/admin/assets/ScriptEditor-1BwI9a_X.js +0 -2
- package/admin/assets/ScriptEditorVanillaMonaco-BPK75VNu.js +0 -3
- package/admin/assets/applyCodeEdit-BdRnbz2g.js +0 -1
- package/admin/assets/createSvgIcon-DYs_tNrE.js +0 -8
- package/admin/assets/cronHoverProvider-Bg0Vz-1E.js +0 -2
- package/admin/assets/hostInit-LzITLWDa.js +0 -1
- package/admin/assets/index-45IwpC7_.js +0 -1
- package/admin/assets/index-BCK6q-N6.css +0 -1
- package/admin/assets/index-BTsjunTt.css +0 -1
- package/admin/assets/index-Be9Zg6aF.js +0 -990
- package/admin/assets/index-BkyLyaYT.js +0 -8
- package/admin/assets/index-CVZSzCXy.js +0 -1
- package/admin/assets/index-CxRhXAwi.js +0 -1267
- package/admin/assets/index-DUMiVB6k.js +0 -16
- package/admin/assets/index-Dsh1HfIY.js +0 -1
- package/admin/assets/index-dN73sbyQ.js +0 -193
- package/admin/assets/index-fS-54-pB.js +0 -1
- package/admin/assets/index-wHNMOf-c.js +0 -5
- package/admin/assets/inheritsLoose-CIXm_zPk.js +0 -29
- package/admin/assets/inlineChatWidget-Cu6rb4Ar.js +0 -2
- package/admin/assets/inlineDiffController-DBLpPOe2.js +0 -16
- package/admin/assets/iobroker_javascript__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-DkBjPSMw.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-CV1_X-Lf.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs-DeVAS-oa.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-RQRRZMX5.js +0 -1
- package/admin/assets/localSharedImportMap-Cs4ibnCv.js +0 -1
- package/admin/assets/preload-helper-BDBacUwf.js +0 -1
- package/admin/assets/stateHoverProvider-dvzAyUDH.js +0 -9
- package/admin/assets/useTheme-DuTJsNQ-.js +0 -1
- package/admin/assets/virtualExposes-BPsCufin.js +0 -1
- package/admin/assets/virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-Dus28I2g.js +0 -8
- package/admin/custom/assets/Components-BOms95_F.css +0 -1
- package/admin/custom/assets/Components-CGiJE5Zh.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_emotion_mf_1_react__loadShare__.mjs-sg07E3QA.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_emotion_mf_1_styled__loadShare__.mjs-CwjI4A-J.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-B7D2xOvV.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.mjs-ClsgYnEX.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__.mjs-B551AMx-.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-KsT5vKjV.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.mjs-DgHZUNxn.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__leaflet__loadShare__.mjs-BYONkEgA.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__.mjs-BW9Qbxx5.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__.mjs_commonjs-proxy-2W2BYT2K.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__.mjs-CL--xmjC.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-D8zcZsJo.js +0 -1
- package/admin/custom/assets/DefaultPropsProvider-CfKHPa-G.js +0 -1
- package/admin/custom/assets/TextField-CxPfV5Sr.js +0 -139
- package/admin/custom/assets/ThemeProvider-DSTCckLJ.js +0 -29
- package/admin/custom/assets/blue-CagzI6CQ.js +0 -1
- package/admin/custom/assets/createSvgIcon-b2B2NI3g.js +0 -1
- package/admin/custom/assets/createTheme-MsdB8zt7.js +0 -8
- package/admin/custom/assets/defaultTheme-CmVP-QNF.js +0 -1
- package/admin/custom/assets/emotion-cache.browser.esm-BgJfNZJN.js +0 -1
- package/admin/custom/assets/emotion-react.browser.esm-chZAeh_-.js +0 -1
- package/admin/custom/assets/emotion-serialize.esm-BUa21YfQ.js +0 -1
- package/admin/custom/assets/emotion-styled.browser.esm-Yi13plpH.js +0 -1
- package/admin/custom/assets/emotion-use-insertion-effect-with-fallbacks.browser.esm-CEPeBbh9.js +0 -1
- package/admin/custom/assets/extends-CF3RwP-h.js +0 -1
- package/admin/custom/assets/hostInit-iUL-wyj1.js +0 -1
- package/admin/custom/assets/index-17vbGv00.js +0 -1
- package/admin/custom/assets/index-B5DqCD_a.js +0 -1
- package/admin/custom/assets/index-BVOepGI5.js +0 -1
- package/admin/custom/assets/index-Bvwv5H7k.js +0 -1
- package/admin/custom/assets/index-C8_qJ4Y6.js +0 -1523
- package/admin/custom/assets/index-CzRngQHl.js +0 -31
- package/admin/custom/assets/index-DLNtxshy.js +0 -1
- package/admin/custom/assets/index-DSGXVHGh.js +0 -964
- package/admin/custom/assets/index-DV76KW3-.js +0 -7
- package/admin/custom/assets/index-D_5kZmfw.js +0 -1
- package/admin/custom/assets/index-DlQbqHom.js +0 -8
- package/admin/custom/assets/index-DpJ18x6R.js +0 -1
- package/admin/custom/assets/index-FTmk0JJx.js +0 -55
- package/admin/custom/assets/isSameWeek-DDsSIa_t.js +0 -1
- package/admin/custom/assets/jsx-runtime-BplTyRFk.js +0 -1
- package/admin/custom/assets/leaflet-src-B472P7Y1.js +0 -1
- package/admin/custom/assets/localSharedImportMap-C-8wOKN2.js +0 -1
- package/admin/custom/assets/preload-helper-BDBacUwf.js +0 -1
- package/admin/custom/assets/useTheme-BV4xOYIL.js +0 -1
- package/admin/custom/assets/useTheme-ldICnlmf.js +0 -1
- package/admin/custom/assets/virtualExposes-D402kVGY.js +0 -2
- package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-CO2hfDx_.js +0 -8
package/build/lib/sandbox.js
CHANGED
|
@@ -33,18 +33,19 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FORBIDDEN_CHARS = void 0;
|
|
37
|
+
exports.isValidPattern = isValidPattern;
|
|
38
|
+
exports.pattern2RegEx = pattern2RegEx;
|
|
36
39
|
exports.isExactId = isExactId;
|
|
37
40
|
exports.removeFromDispatchIndex = removeFromDispatchIndex;
|
|
38
41
|
exports.sandBox = sandBox;
|
|
39
42
|
const jsonataMod = __importStar(require("jsonata"));
|
|
40
|
-
const adapter_core_1 = require("@iobroker/adapter-core");
|
|
41
43
|
const tools_1 = require("./tools");
|
|
42
44
|
const constsMod = __importStar(require("./consts"));
|
|
43
45
|
const wordsMod = __importStar(require("./words"));
|
|
44
46
|
const eventObjMod = __importStar(require("./eventObj"));
|
|
45
47
|
const patternCompareFunctions_1 = require("./patternCompareFunctions");
|
|
46
48
|
const SCRIPT_CODE_MARKER = 'script.js.';
|
|
47
|
-
const pattern2RegEx = adapter_core_1.commonTools.pattern2RegEx;
|
|
48
49
|
// Pre-compiled RegExp constants for formatTimeDiff – avoids recompiling on every call
|
|
49
50
|
const FTD_TEST_D = /(?<!\\)[DTД]/;
|
|
50
51
|
const FTD_REPL_DD = /(?<!\\)(?:DD|TT|ДД)/g;
|
|
@@ -70,6 +71,35 @@ const _SELECTOR_REGEXP_CACHE_MAX = 1000;
|
|
|
70
71
|
const _selectorRegExpCache = new Map();
|
|
71
72
|
/** Monotonically increasing handler-ID counter – avoids Date.now()+random collisions */
|
|
72
73
|
let _handlerIdCounter = 1;
|
|
74
|
+
/** All characters that may not appear in an object ID. */
|
|
75
|
+
exports.FORBIDDEN_CHARS = /[^._\-/ :!#$%&()+=@^{}|~\p{Ll}\p{Lu}\p{Nd}]+/gu;
|
|
76
|
+
/**
|
|
77
|
+
* Checks if a pattern is valid
|
|
78
|
+
*
|
|
79
|
+
* @param pattern The pattern to check for validity
|
|
80
|
+
*/
|
|
81
|
+
function isValidPattern(pattern) {
|
|
82
|
+
pattern = pattern.replace(/\*/g, '');
|
|
83
|
+
return !exports.FORBIDDEN_CHARS.test(pattern);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Converts ioB pattern into regex.
|
|
87
|
+
*
|
|
88
|
+
* This funtion was copied from js-controller, as for the tests it is required, that function must be defined here.
|
|
89
|
+
* Else the adapter-core tries to find js-controller and it is not installed.
|
|
90
|
+
*
|
|
91
|
+
* @param pattern - Regex string to use it in new RegExp(pattern)
|
|
92
|
+
*/
|
|
93
|
+
function pattern2RegEx(pattern) {
|
|
94
|
+
pattern = (pattern || '').toString();
|
|
95
|
+
if (!isValidPattern(pattern)) {
|
|
96
|
+
throw new Error(`The pattern "${pattern}" is not a valid ID pattern`);
|
|
97
|
+
}
|
|
98
|
+
const startsWithWildcard = pattern[0] === '*';
|
|
99
|
+
const endsWithWildcard = pattern[pattern.length - 1] === '*';
|
|
100
|
+
pattern = pattern.replace(/[-/\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*');
|
|
101
|
+
return (startsWithWildcard ? '' : '^') + pattern + (endsWithWildcard ? '' : '$');
|
|
102
|
+
}
|
|
73
103
|
/** Returns true when patId is a plain exact state-ID (no wildcards, no RegExp notation). */
|
|
74
104
|
function isExactId(patId) {
|
|
75
105
|
return (!!patId && typeof patId === 'string' && !patId.includes('*') && !patId.includes('?') && !patId.startsWith('/'));
|
|
@@ -100,7 +130,7 @@ function removeFromDispatchIndex(ctx, sub) {
|
|
|
100
130
|
}
|
|
101
131
|
}
|
|
102
132
|
}
|
|
103
|
-
function sandBox(script, name, verbose, debug, context) {
|
|
133
|
+
function sandBox(script, name, verbose, debug, context, logCollector) {
|
|
104
134
|
const consts = constsMod;
|
|
105
135
|
const words = wordsMod;
|
|
106
136
|
const eventObj = eventObjMod;
|
|
@@ -435,7 +465,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
435
465
|
actualCommonType = getCommonTypeOf(stateNotNull.val);
|
|
436
466
|
}
|
|
437
467
|
}
|
|
438
|
-
else if (stateNotNull !==
|
|
468
|
+
else if (stateNotNull !== undefined) {
|
|
439
469
|
actualCommonType = getCommonTypeOf(stateNotNull);
|
|
440
470
|
}
|
|
441
471
|
// If this is not the expected one, issue a warning
|
|
@@ -489,9 +519,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
489
519
|
}
|
|
490
520
|
let stateAsObject;
|
|
491
521
|
// modify state here, to make it available in callback
|
|
492
|
-
if (stateNotNull === null ||
|
|
493
|
-
typeof stateNotNull !== 'object' ||
|
|
494
|
-
stateNotNull.val === undefined) {
|
|
522
|
+
if (stateNotNull === null || typeof stateNotNull !== 'object' || stateNotNull.val === undefined) {
|
|
495
523
|
stateAsObject = context.prepareStateObject(id, {
|
|
496
524
|
val: stateNotNull,
|
|
497
525
|
ack: isAck === true || isAck === 'true',
|
|
@@ -1126,7 +1154,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1126
1154
|
return result;
|
|
1127
1155
|
},
|
|
1128
1156
|
log: function (msg, severity) {
|
|
1129
|
-
severity
|
|
1157
|
+
severity ||= 'info';
|
|
1130
1158
|
// disable log in log handler (prevent endless loops)
|
|
1131
1159
|
if (sandbox.logHandler && (sandbox.logHandler === severity || sandbox.logHandler === '*')) {
|
|
1132
1160
|
return;
|
|
@@ -1138,7 +1166,10 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1138
1166
|
if (msg && typeof msg !== 'string') {
|
|
1139
1167
|
msg = mods.util.format(msg);
|
|
1140
1168
|
}
|
|
1141
|
-
if (
|
|
1169
|
+
if (logCollector) {
|
|
1170
|
+
logCollector(severity, msg);
|
|
1171
|
+
}
|
|
1172
|
+
else if (debugMode) {
|
|
1142
1173
|
console.log(`${severity}$$${name}$$${msg}`, Date.now());
|
|
1143
1174
|
}
|
|
1144
1175
|
else {
|
|
@@ -1159,8 +1190,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1159
1190
|
context.logSubscriptions[sandbox.scriptName].push(handler);
|
|
1160
1191
|
context.updateLogSubscriptions();
|
|
1161
1192
|
sandbox.__engine.__subscriptionsLog += 1;
|
|
1162
|
-
sandbox.verbose
|
|
1193
|
+
if (sandbox.verbose) {
|
|
1163
1194
|
sandbox.log(`onLog(severity=${severity}, id=${handler.id}) - logSubscriptions=${sandbox.__engine.__subscriptionsLog}`, 'info');
|
|
1195
|
+
}
|
|
1164
1196
|
if (sandbox.__engine.__subscriptionsLog %
|
|
1165
1197
|
adapter.config.maxTriggersPerScript ===
|
|
1166
1198
|
0) {
|
|
@@ -1171,14 +1203,16 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1171
1203
|
onLogUnregister: function (idOrCallbackOrSeverity) {
|
|
1172
1204
|
let found = false;
|
|
1173
1205
|
if (context.logSubscriptions?.[sandbox.scriptName]) {
|
|
1174
|
-
sandbox.verbose
|
|
1206
|
+
if (sandbox.verbose) {
|
|
1175
1207
|
sandbox.log(`onLogUnregister(idOrCallbackOrSeverity=${JSON.stringify(idOrCallbackOrSeverity)}) - logSubscriptions=${sandbox.__engine.__subscriptionsLog}`, 'info');
|
|
1208
|
+
}
|
|
1176
1209
|
for (let i = 0; i < context.logSubscriptions[sandbox.scriptName].length; i++) {
|
|
1177
1210
|
if (context.logSubscriptions[sandbox.scriptName][i].cb === idOrCallbackOrSeverity ||
|
|
1178
1211
|
context.logSubscriptions[sandbox.scriptName][i].id === idOrCallbackOrSeverity ||
|
|
1179
1212
|
context.logSubscriptions[sandbox.scriptName][i].severity === idOrCallbackOrSeverity) {
|
|
1180
|
-
sandbox.verbose
|
|
1213
|
+
if (sandbox.verbose) {
|
|
1181
1214
|
sandbox.log(`onLogUnregister(idOrCallbackOrSeverity=${JSON.stringify(idOrCallbackOrSeverity)}, removing id=${context.logSubscriptions[sandbox.scriptName][i].id})`, 'info');
|
|
1215
|
+
}
|
|
1182
1216
|
context.logSubscriptions[sandbox.scriptName].splice(i, 1);
|
|
1183
1217
|
i--;
|
|
1184
1218
|
sandbox.__engine.__subscriptionsLog--;
|
|
@@ -1188,9 +1222,8 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1188
1222
|
break;
|
|
1189
1223
|
}
|
|
1190
1224
|
}
|
|
1191
|
-
else {
|
|
1192
|
-
sandbox.
|
|
1193
|
-
sandbox.log(`onLogUnregister(idOrCallbackOrSeverity=${JSON.stringify(idOrCallbackOrSeverity)}) NOT = ${JSON.stringify(context.logSubscriptions[sandbox.scriptName][i])}`, 'info');
|
|
1225
|
+
else if (sandbox.verbose) {
|
|
1226
|
+
sandbox.log(`onLogUnregister(idOrCallbackOrSeverity=${JSON.stringify(idOrCallbackOrSeverity)}) NOT = ${JSON.stringify(context.logSubscriptions[sandbox.scriptName][i])}`, 'info');
|
|
1194
1227
|
}
|
|
1195
1228
|
}
|
|
1196
1229
|
}
|
|
@@ -1382,8 +1415,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1382
1415
|
// create temp directory
|
|
1383
1416
|
tempDirPath = fs.mkdtempSync(path.join(os.tmpdir(), `${sandbox.scriptName.substring(SCRIPT_CODE_MARKER.length)}-`));
|
|
1384
1417
|
context.tempDirectories[sandbox.scriptName] = tempDirPath;
|
|
1385
|
-
sandbox.verbose
|
|
1418
|
+
if (sandbox.verbose) {
|
|
1386
1419
|
sandbox.log(`createTempFile(fileName=${fileName}, tempDirPath=${tempDirPath}) created temp directory in ${os.tmpdir()}`, 'info');
|
|
1420
|
+
}
|
|
1387
1421
|
}
|
|
1388
1422
|
const filePath = path.join(tempDirPath, fileName);
|
|
1389
1423
|
// is sub dir?
|
|
@@ -1396,8 +1430,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1396
1430
|
return undefined;
|
|
1397
1431
|
}
|
|
1398
1432
|
fs.writeFileSync(filePath, data);
|
|
1399
|
-
sandbox.verbose
|
|
1433
|
+
if (sandbox.verbose) {
|
|
1400
1434
|
sandbox.log(`createTempFile(fileName=${fileName}, fileDir=${fileDir}, filePath=${filePath})`, 'info');
|
|
1435
|
+
}
|
|
1401
1436
|
return filePath;
|
|
1402
1437
|
},
|
|
1403
1438
|
subscribe: function (pattern,
|
|
@@ -1658,8 +1693,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1658
1693
|
}
|
|
1659
1694
|
}
|
|
1660
1695
|
}
|
|
1661
|
-
sandbox.verbose
|
|
1696
|
+
if (sandbox.verbose) {
|
|
1662
1697
|
sandbox.log(`onEnumMembers(id=${enumId}, members=${JSON.stringify(Object.keys(subscriptions))})`, 'info');
|
|
1698
|
+
}
|
|
1663
1699
|
};
|
|
1664
1700
|
init();
|
|
1665
1701
|
sandbox.subscribeObject(enumId, obj => obj && init());
|
|
@@ -1689,8 +1725,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1689
1725
|
return fileNamePattern.map(filePattern => sandbox.onFile(id, filePattern, withFileOrCallback, callback));
|
|
1690
1726
|
}
|
|
1691
1727
|
sandbox.__engine.__subscriptionsFile += 1;
|
|
1692
|
-
sandbox.verbose
|
|
1728
|
+
if (sandbox.verbose) {
|
|
1693
1729
|
sandbox.log(`onFile(id=${id}, fileNamePattern=${fileNamePattern}) - fileSubscriptions=${sandbox.__engine.__subscriptionsFile}`, 'info');
|
|
1730
|
+
}
|
|
1694
1731
|
if (sandbox.__engine.__subscriptionsFile %
|
|
1695
1732
|
adapter.config.maxTriggersPerScript ===
|
|
1696
1733
|
0) {
|
|
@@ -1712,8 +1749,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1712
1749
|
fileRegEx,
|
|
1713
1750
|
callback: (id, fileName, size, withFile) => {
|
|
1714
1751
|
try {
|
|
1715
|
-
sandbox.verbose
|
|
1752
|
+
if (sandbox.verbose) {
|
|
1716
1753
|
sandbox.log(`onFile changed(id=${id}, fileName=${fileName}, size=${size})`, 'info');
|
|
1754
|
+
}
|
|
1717
1755
|
if (withFile && (size || 0) > 0) {
|
|
1718
1756
|
adapter
|
|
1719
1757
|
.readFileAsync(id, fileName)
|
|
@@ -1746,8 +1784,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1746
1784
|
sandbox.log('offFile: your js-controller does not support yet file unsubscribes. Please update to js-controller@4.1.x or newer', 'warn');
|
|
1747
1785
|
return false;
|
|
1748
1786
|
}
|
|
1749
|
-
sandbox.verbose
|
|
1787
|
+
if (sandbox.verbose) {
|
|
1750
1788
|
sandbox.log(`offFile(idOrObject=${JSON.stringify(idOrObject)}, fileNamePattern=${JSON.stringify(fileNamePattern)}) - fileSubscriptions=${sandbox.__engine.__subscriptionsFile}`, 'info');
|
|
1789
|
+
}
|
|
1751
1790
|
if (idOrObject && typeof idOrObject === 'object') {
|
|
1752
1791
|
if (Array.isArray(idOrObject)) {
|
|
1753
1792
|
const result = [];
|
|
@@ -1759,8 +1798,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1759
1798
|
for (let i = context.subscriptionsFile.length - 1; i >= 0; i--) {
|
|
1760
1799
|
if (context.subscriptionsFile[i] === idOrObject) {
|
|
1761
1800
|
unsubscribeFile(script, context.subscriptionsFile[i].id, context.subscriptionsFile[i].fileNamePattern);
|
|
1762
|
-
sandbox.verbose
|
|
1801
|
+
if (sandbox.verbose) {
|
|
1763
1802
|
sandbox.log(`offFile(type=object, fileNamePattern=${JSON.stringify(fileNamePattern)}, removing id=${context.subscriptionsFile[i].id})`, 'info');
|
|
1803
|
+
}
|
|
1764
1804
|
context.subscriptionsFile.splice(i, 1);
|
|
1765
1805
|
sandbox.__engine.__subscriptionsFile--;
|
|
1766
1806
|
return true;
|
|
@@ -1781,8 +1821,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1781
1821
|
context.subscriptionsFile[i].fileNamePattern === fileNamePattern) {
|
|
1782
1822
|
deleted++;
|
|
1783
1823
|
unsubscribeFile(script, context.subscriptionsFile[i].id, context.subscriptionsFile[i].fileNamePattern);
|
|
1784
|
-
sandbox.verbose
|
|
1824
|
+
if (sandbox.verbose) {
|
|
1785
1825
|
sandbox.log(`offFile(type=string, fileNamePattern=${fileNamePattern}, removing id=${context.subscriptionsFile[i].id})`, 'info');
|
|
1826
|
+
}
|
|
1786
1827
|
context.subscriptionsFile.splice(i, 1);
|
|
1787
1828
|
sandbox.__engine.__subscriptionsFile--;
|
|
1788
1829
|
}
|
|
@@ -1815,8 +1856,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1815
1856
|
}
|
|
1816
1857
|
if ((typeof pattern === 'string' && pattern[0] === '{') ||
|
|
1817
1858
|
(typeof pattern === 'object' && pattern.period)) {
|
|
1818
|
-
sandbox.verbose
|
|
1859
|
+
if (sandbox.verbose) {
|
|
1819
1860
|
sandbox.log(`schedule(wizard=${typeof pattern === 'object' ? JSON.stringify(pattern) : pattern})`, 'info');
|
|
1861
|
+
}
|
|
1820
1862
|
if (!context.scheduler) {
|
|
1821
1863
|
sandbox.log(`Cannot schedule "${typeof pattern === 'object' ? JSON.stringify(pattern) : pattern}" because scheduler is not available`, 'error');
|
|
1822
1864
|
return null;
|
|
@@ -1888,8 +1930,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1888
1930
|
if (sandbox.__engine.__schedules % adapterConfig.maxTriggersPerScript === 0) {
|
|
1889
1931
|
sandbox.log(`More than ${sandbox.__engine.__schedules} schedules registered. Check your script!`, 'warn');
|
|
1890
1932
|
}
|
|
1891
|
-
sandbox.verbose
|
|
1933
|
+
if (sandbox.verbose) {
|
|
1892
1934
|
sandbox.log(`schedule(astro=${astroPattern.astro}, offset=${astroPattern.shift}) is tomorrow, waiting until ${date.toISOString()}`, 'info');
|
|
1935
|
+
}
|
|
1893
1936
|
// Calculate new schedule in the next day
|
|
1894
1937
|
sandbox.setTimeout(() => {
|
|
1895
1938
|
if (sandbox.__engine.__schedules > 0) {
|
|
@@ -1918,8 +1961,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1918
1961
|
sandbox.schedule(astroPattern, callback);
|
|
1919
1962
|
}, 2000);
|
|
1920
1963
|
}, ts.getTime() - Date.now());
|
|
1921
|
-
sandbox.verbose
|
|
1964
|
+
if (sandbox.verbose) {
|
|
1922
1965
|
sandbox.log(`schedule(astro=${astroPattern.astro}, offset=${astroPattern.shift}) is today, waiting until ${ts.toISOString()}`, 'info');
|
|
1966
|
+
}
|
|
1923
1967
|
}
|
|
1924
1968
|
else {
|
|
1925
1969
|
// fix a problem with sunday and 7
|
|
@@ -1998,8 +2042,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1998
2042
|
if (isValid) {
|
|
1999
2043
|
const cronExp = `${s ?? '0'} ${m ?? '0'} ${h ?? '0'} * * *`;
|
|
2000
2044
|
if (cronExp !== currentExp) {
|
|
2001
|
-
sandbox.verbose
|
|
2045
|
+
if (sandbox.verbose) {
|
|
2002
2046
|
sandbox.log(`scheduleById(id=${id}): Init with expression ${cronExp} from ${time}`, 'info');
|
|
2047
|
+
}
|
|
2003
2048
|
currentExp = cronExp;
|
|
2004
2049
|
if (scheduleId) {
|
|
2005
2050
|
sandbox.clearSchedule(scheduleId);
|
|
@@ -2039,8 +2084,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2039
2084
|
}
|
|
2040
2085
|
sandbox.on(triggerDef, obj => {
|
|
2041
2086
|
if (obj?.state?.val) {
|
|
2042
|
-
sandbox.verbose
|
|
2087
|
+
if (sandbox.verbose) {
|
|
2043
2088
|
sandbox.log(`scheduleById(id=${id}): Update with value ${obj.state.val}`, 'info');
|
|
2089
|
+
}
|
|
2044
2090
|
init(obj.state.val.toString());
|
|
2045
2091
|
}
|
|
2046
2092
|
});
|
|
@@ -2190,12 +2236,14 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2190
2236
|
if (!objects[id] && objects[`${adapter.namespace}.${id}`]) {
|
|
2191
2237
|
id = `${adapter.namespace}.${id}`;
|
|
2192
2238
|
}
|
|
2193
|
-
sandbox.verbose
|
|
2239
|
+
if (sandbox.verbose) {
|
|
2194
2240
|
sandbox.log(`setStateDelayed(id=${id}, state=${JSON.stringify(state)}, isAck=${isAck}, delay=${delay}, clearRunning=${clearRunning})`, 'info');
|
|
2241
|
+
}
|
|
2195
2242
|
if (clearRunning) {
|
|
2196
2243
|
if (timers[id]) {
|
|
2197
|
-
sandbox.verbose
|
|
2244
|
+
if (sandbox.verbose) {
|
|
2198
2245
|
sandbox.log(`setStateDelayed: clear ${timers[id].length} running timers`, 'info');
|
|
2246
|
+
}
|
|
2199
2247
|
// collect affected scriptNames before deleting
|
|
2200
2248
|
const affectedScripts = new Set(timers[id].map(e => e.scriptName));
|
|
2201
2249
|
for (let i = 0; i < timers[id].length; i++) {
|
|
@@ -2442,16 +2490,18 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2442
2490
|
}
|
|
2443
2491
|
else {
|
|
2444
2492
|
if (states[id]) {
|
|
2445
|
-
sandbox.verbose
|
|
2493
|
+
if (sandbox.verbose) {
|
|
2446
2494
|
sandbox.log(`getState(id=${id}, timerId=${JSON.stringify(timers[id])}) => ${JSON.stringify(states[id])}`, 'info');
|
|
2495
|
+
}
|
|
2447
2496
|
if (context.interimStateValues[id] !== undefined) {
|
|
2448
2497
|
return context.convertBackStringifiedValues(id, context.interimStateValues[id]);
|
|
2449
2498
|
}
|
|
2450
2499
|
return context.convertBackStringifiedValues(id, states[id]);
|
|
2451
2500
|
}
|
|
2452
2501
|
else if (states[`${adapter.namespace}.${id}`]) {
|
|
2453
|
-
sandbox.verbose
|
|
2502
|
+
if (sandbox.verbose) {
|
|
2454
2503
|
sandbox.log(`getState(id=${id}, timerId=${JSON.stringify(timers[id])}) => ${JSON.stringify(states[`${adapter.namespace}.${id}`])}`, 'info');
|
|
2504
|
+
}
|
|
2455
2505
|
if (context.interimStateValues[`${adapter.namespace}.${id}`] !== undefined) {
|
|
2456
2506
|
return context.convertBackStringifiedValues(id, context.interimStateValues[`${adapter.namespace}.${id}`]);
|
|
2457
2507
|
}
|
|
@@ -2509,8 +2559,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2509
2559
|
}
|
|
2510
2560
|
},
|
|
2511
2561
|
getIdByName: function (name, alwaysArray) {
|
|
2512
|
-
sandbox.verbose
|
|
2562
|
+
if (sandbox.verbose) {
|
|
2513
2563
|
sandbox.log(`getIdByName(name=${name}, alwaysArray=${alwaysArray}) => ${JSON.stringify(context.names[name])}`, 'info');
|
|
2564
|
+
}
|
|
2514
2565
|
if (Object.prototype.hasOwnProperty.call(context.names, name)) {
|
|
2515
2566
|
if (alwaysArray) {
|
|
2516
2567
|
return !Array.isArray(context.names[name]) ? [context.names[name]] : context.names[name];
|
|
@@ -2553,15 +2604,17 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2553
2604
|
sandbox.log(`Object "${id}" can't be copied: ${JSON.stringify(err)}`, 'error');
|
|
2554
2605
|
return cb(null, null);
|
|
2555
2606
|
}
|
|
2556
|
-
sandbox.verbose
|
|
2607
|
+
if (sandbox.verbose) {
|
|
2557
2608
|
sandbox.log(`getObject(id=${id}, enumName=${enumName}) => ${JSON.stringify(result)}`, 'info');
|
|
2609
|
+
}
|
|
2558
2610
|
cb(err, result);
|
|
2559
2611
|
});
|
|
2560
2612
|
}
|
|
2561
2613
|
else {
|
|
2562
2614
|
if (!objects[id]) {
|
|
2563
|
-
sandbox.verbose
|
|
2615
|
+
if (sandbox.verbose) {
|
|
2564
2616
|
sandbox.log(`getObject(id=${id}, enumName=${enumName}) => does not exist`, 'info');
|
|
2617
|
+
}
|
|
2565
2618
|
sandbox.log(`Object "${id}" does not exist`, 'warn');
|
|
2566
2619
|
return null;
|
|
2567
2620
|
}
|
|
@@ -2579,8 +2632,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2579
2632
|
}
|
|
2580
2633
|
}
|
|
2581
2634
|
}
|
|
2582
|
-
sandbox.verbose
|
|
2635
|
+
if (sandbox.verbose) {
|
|
2583
2636
|
sandbox.log(`getObject(id=${id}, enumName=${enumName}) => ${JSON.stringify(obj)}`, 'info');
|
|
2637
|
+
}
|
|
2584
2638
|
return obj;
|
|
2585
2639
|
}
|
|
2586
2640
|
let result;
|
|
@@ -2596,8 +2650,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2596
2650
|
sandbox.log(`Object "${id}" can't be copied: ${JSON.stringify(err)}`, 'error');
|
|
2597
2651
|
return null;
|
|
2598
2652
|
}
|
|
2599
|
-
sandbox.verbose
|
|
2653
|
+
if (sandbox.verbose) {
|
|
2600
2654
|
sandbox.log(`getObject(id=${id}, enumName=${enumName}) => ${JSON.stringify(result)}`, 'info');
|
|
2655
|
+
}
|
|
2601
2656
|
return result;
|
|
2602
2657
|
}
|
|
2603
2658
|
},
|
|
@@ -3303,8 +3358,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3303
3358
|
}
|
|
3304
3359
|
// If specific instance
|
|
3305
3360
|
if (_adapter.match(/\.[0-9]+$/)) {
|
|
3306
|
-
sandbox.verbose
|
|
3361
|
+
if (sandbox.verbose) {
|
|
3307
3362
|
sandbox.log(`sendTo(instance=${_adapter}, cmd=${cmd}, msg=${JSON.stringify(msg)}, hasCallback=${typeof callback === 'function'})`, 'info');
|
|
3363
|
+
}
|
|
3308
3364
|
adapter.sendTo(_adapter, cmd, msg, cbFunc, options);
|
|
3309
3365
|
}
|
|
3310
3366
|
else {
|
|
@@ -3312,8 +3368,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3312
3368
|
const cached = context.sendToInstanceCache.get(_adapter);
|
|
3313
3369
|
if (cached) {
|
|
3314
3370
|
cached.forEach(instance => {
|
|
3315
|
-
sandbox.verbose
|
|
3371
|
+
if (sandbox.verbose) {
|
|
3316
3372
|
sandbox.log(`sendTo(instance=${instance}, cmd=${cmd}, msg=${JSON.stringify(msg)}, hasCallback=${typeof callback === 'function'}) [cached]`, 'info');
|
|
3373
|
+
}
|
|
3317
3374
|
adapter.sendTo(instance, cmd, msg, cbFunc, options);
|
|
3318
3375
|
});
|
|
3319
3376
|
}
|
|
@@ -3335,8 +3392,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3335
3392
|
}
|
|
3336
3393
|
context.sendToInstanceCache.set(_adapter, instances);
|
|
3337
3394
|
instances.forEach(instance => {
|
|
3338
|
-
sandbox.verbose
|
|
3395
|
+
if (sandbox.verbose) {
|
|
3339
3396
|
sandbox.log(`sendTo(instance=${instance}, cmd=${cmd}, msg=${JSON.stringify(msg)}, hasCallback=${typeof callback === 'function'})`, 'info');
|
|
3397
|
+
}
|
|
3340
3398
|
adapter.sendTo(instance, cmd, msg, cbFunc, options);
|
|
3341
3399
|
});
|
|
3342
3400
|
});
|
|
@@ -3370,8 +3428,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3370
3428
|
}
|
|
3371
3429
|
}
|
|
3372
3430
|
else {
|
|
3373
|
-
sandbox.verbose
|
|
3431
|
+
if (sandbox.verbose) {
|
|
3374
3432
|
sandbox.log(`sendToHost(adapter=${host}, cmd=${cmd}, msg=${JSON.stringify(msg)})`, 'info');
|
|
3433
|
+
}
|
|
3375
3434
|
adapter.sendToHost(host, cmd, msg, callback);
|
|
3376
3435
|
}
|
|
3377
3436
|
},
|
|
@@ -3838,8 +3897,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3838
3897
|
text = text
|
|
3839
3898
|
.replace(FTD_REPL_SS, seconds.toString().padStart(2, '0'))
|
|
3840
3899
|
.replace(FTD_REPL_S, seconds.toString());
|
|
3841
|
-
sandbox.verbose
|
|
3900
|
+
if (sandbox.verbose) {
|
|
3842
3901
|
sandbox.log(`formatTimeDiff(format=${format}, text=${text}, seconds=${seconds})`, 'debug');
|
|
3902
|
+
}
|
|
3843
3903
|
}
|
|
3844
3904
|
for (const [pattern, replacement] of FTD_UNESCAPE) {
|
|
3845
3905
|
text = text.replace(pattern, replacement);
|
|
@@ -3983,8 +4043,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3983
4043
|
}
|
|
3984
4044
|
}
|
|
3985
4045
|
else {
|
|
3986
|
-
sandbox.verbose
|
|
4046
|
+
if (sandbox.verbose) {
|
|
3987
4047
|
sandbox.log(`rename(adapter=${_adapter}, oldName=${oldName}, newName=${newName})`, 'info');
|
|
4048
|
+
}
|
|
3988
4049
|
if (callback) {
|
|
3989
4050
|
adapter.rename(_adapter, oldName, newName, callback);
|
|
3990
4051
|
}
|