iobroker.autodoc 0.9.35

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +126 -0
  3. package/admin/autodoc.png +0 -0
  4. package/admin/i18n/de.json +244 -0
  5. package/admin/i18n/en.json +241 -0
  6. package/admin/i18n/es.json +229 -0
  7. package/admin/i18n/fr.json +235 -0
  8. package/admin/i18n/it.json +229 -0
  9. package/admin/i18n/nl.json +229 -0
  10. package/admin/i18n/pl.json +229 -0
  11. package/admin/i18n/pt.json +229 -0
  12. package/admin/i18n/ru.json +229 -0
  13. package/admin/i18n/uk.json +229 -0
  14. package/admin/i18n/zh-cn.json +229 -0
  15. package/admin/jsonConfig.json +1490 -0
  16. package/io-package.json +253 -0
  17. package/lib/adapter-config.d.ts +19 -0
  18. package/lib/aiEnhancer.js +2114 -0
  19. package/lib/autoHostTopologyMermaid.js +195 -0
  20. package/lib/dependencyAnalyzer.js +83 -0
  21. package/lib/diagnosisSnapshot.js +32 -0
  22. package/lib/discovery.js +953 -0
  23. package/lib/docTemplateConfig.js +422 -0
  24. package/lib/documentModel.js +640 -0
  25. package/lib/forumCard.js +70 -0
  26. package/lib/guestHelpContent.js +93 -0
  27. package/lib/guestScriptPrivacy.js +14 -0
  28. package/lib/hostDisplay.js +19 -0
  29. package/lib/htmlRenderer.js +4108 -0
  30. package/lib/htmlThemePresets.js +79 -0
  31. package/lib/htmlToPdf.js +99 -0
  32. package/lib/i18n.js +1309 -0
  33. package/lib/markdownRenderer.js +2025 -0
  34. package/lib/mermaidAutodocPalette.js +165 -0
  35. package/lib/mermaidServerSvg.js +252 -0
  36. package/lib/notifier.js +124 -0
  37. package/lib/quickStartGuide.js +180 -0
  38. package/lib/roleMapper.js +90 -0
  39. package/lib/scriptGroups.js +78 -0
  40. package/lib/versionTracker.js +312 -0
  41. package/main.js +1368 -0
  42. package/package.json +88 -0
@@ -0,0 +1,93 @@
1
+ const { hasFamilyDiagnosisSnapshot } = require('./diagnosisSnapshot');
2
+
3
+ const PROFILE_USER = 'user';
4
+ const PROFILE_ONBOARDING = 'onboarding';
5
+
6
+ /**
7
+ * Whether any “public bookmark” line would appear in the **Help & emergencies** block for this export profile.
8
+ * (Same rules as {@link HtmlRenderer#_renderTroubleshootPublicLinksHtml}: no self-link; guest page has no family link.)
9
+ *
10
+ * @param {object|null|undefined} pl `manualContext.troubleshootPublicLinks`
11
+ * @param {string|null|undefined} exportProfile `user` | `onboarding` | `null` (admin / unspecified)
12
+ * @returns {boolean} true if that profile’s HTML would list at least one bookmark URL
13
+ */
14
+ function publicLinksRelevantForProfile(pl, exportProfile) {
15
+ if (!pl) {
16
+ return false;
17
+ }
18
+ const t = v => v && String(v).trim();
19
+ if (exportProfile === PROFILE_ONBOARDING) {
20
+ return false;
21
+ }
22
+ if (exportProfile === PROFILE_USER) {
23
+ return !!t(pl.onboarding);
24
+ }
25
+ return !!(t(pl.user) || t(pl.onboarding) || t(pl.admin));
26
+ }
27
+
28
+ /**
29
+ * Whether the User-profile HTML «manual information» chapter renders body content (mirrors nav visibility and
30
+ * {@link HtmlRenderer#renderUserChapterBodyKey} for `manual` / `mermaid`).
31
+ *
32
+ * @param {object|null|undefined} docModel Document model (`manualContext`, `userHiddenChapters`, etc.)
33
+ * @returns {boolean} true if the User-profile «manual information» chapter would render non-empty body HTML
34
+ */
35
+ function userManualHtmlChapterWillRender(docModel) {
36
+ const dm = docModel;
37
+ if (!dm || !dm.manualContext) {
38
+ return false;
39
+ }
40
+ const mc = dm.manualContext;
41
+ const trim = v => v && String(v).trim();
42
+ const hidden = key => Array.isArray(dm.userHiddenChapters) && dm.userHiddenChapters.includes(key);
43
+ const hasCore = !hidden('manual') && !!(trim(mc.description) || trim(mc.contact) || trim(mc.notes));
44
+ const hasMermaid = !hidden('mermaid') && mc.mermaidDiagram && String(mc.mermaidDiagram).trim();
45
+ const hasMermaidAuto =
46
+ !hidden('mermaidAuto') && mc.autoHostTopologyMermaid && String(mc.autoHostTopologyMermaid).trim();
47
+ return !!(hasCore || hasMermaid || hasMermaidAuto);
48
+ }
49
+
50
+ /**
51
+ * Guest / family "Help & emergencies" chapter — content presence (Phase 5.x.1 hybrid block).
52
+ *
53
+ * @param {object} [manualContext] From document model `manualContext` (includes optional `troubleshootPublicLinks`).
54
+ * @param {object} [docModel] When set, includes optional diagnosis snapshot checklists (concrete scan findings only).
55
+ * @param {string|null|undefined} [exportProfile] When set, `troubleshootPublicLinks` is evaluated for that profile only
56
+ * (onboarding: URLs alone do not keep the chapter if nothing else is filled).
57
+ * @returns {boolean} True if User/Onboarding guest-help chapter should render and appear in nav.
58
+ */
59
+ function guestHelpChapterHasContent(manualContext, docModel, exportProfile) {
60
+ const mc = manualContext;
61
+ if (docModel && hasFamilyDiagnosisSnapshot(docModel)) {
62
+ return true;
63
+ }
64
+ if (!mc) {
65
+ return false;
66
+ }
67
+ const t = v => v && String(v).trim();
68
+ if (t(mc.guestHelpNote)) {
69
+ return true;
70
+ }
71
+ if (
72
+ t(mc.troubleshootWifiHint) ||
73
+ t(mc.troubleshootPowerHint) ||
74
+ t(mc.troubleshootWaterHint) ||
75
+ t(mc.troubleshootExtraHint)
76
+ ) {
77
+ return true;
78
+ }
79
+ if (publicLinksRelevantForProfile(mc.troubleshootPublicLinks, exportProfile)) {
80
+ if (exportProfile === PROFILE_USER && docModel && userManualHtmlChapterWillRender(docModel)) {
81
+ // User HTML: public bookmark list is rendered under «Manuelle Informationen» instead of this chapter.
82
+ } else {
83
+ return true;
84
+ }
85
+ }
86
+ return false;
87
+ }
88
+
89
+ module.exports = {
90
+ guestHelpChapterHasContent,
91
+ publicLinksRelevantForProfile,
92
+ userManualHtmlChapterWillRender,
93
+ };
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Onboarding = guest view: whether to list internal JavaScript script file names
5
+ * (default: **false** = privacy & less arbitrary “top N” lists).
6
+ *
7
+ * @param {object} config Adapter instance config (`native` merged).
8
+ * @returns {boolean} True when guest exports should list script file names (legacy).
9
+ */
10
+ function onboardingGuestShowsScriptNames(config) {
11
+ return !!(config && config.onboardingGuestShowScriptNames === true);
12
+ }
13
+
14
+ module.exports = { onboardingGuestShowsScriptNames };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Format host OS info from ioBroker `system.host` / discovery (host.native.os).
3
+ *
4
+ * @param {{ osType?: string, osRelease?: string, osArch?: string }} host Host record (`native.os` fields).
5
+ * @returns {string} Human-readable one-liner, or empty string if unknown
6
+ */
7
+ function formatOperatingSystemLine(host) {
8
+ if (!host || typeof host !== 'object') {
9
+ return '';
10
+ }
11
+ const parts = [host.osType, host.osRelease, host.osArch]
12
+ .map(p => (p == null ? '' : String(p).trim()))
13
+ .filter(Boolean);
14
+ return parts.length ? parts.join(' — ') : '';
15
+ }
16
+
17
+ module.exports = {
18
+ formatOperatingSystemLine,
19
+ };