@iobroker/js-controller-adapter 7.2.3 → 8.0.0-alpha.2-20260923-99da17fcc

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 (108) hide show
  1. package/build/cjs/index.d.ts +0 -1
  2. package/build/cjs/index.js +5 -8
  3. package/build/cjs/index.js.map +2 -2
  4. package/build/cjs/lib/_Types.d.ts +394 -63
  5. package/build/cjs/lib/adapter/adapter.d.ts +1896 -177
  6. package/build/cjs/lib/adapter/adapter.js +788 -1035
  7. package/build/cjs/lib/adapter/adapter.js.map +2 -2
  8. package/build/cjs/lib/adapter/asyncAdapter.d.ts +167 -0
  9. package/build/cjs/lib/adapter/asyncAdapter.js +252 -0
  10. package/build/cjs/lib/adapter/asyncAdapter.js.map +7 -0
  11. package/build/cjs/lib/adapter/context.d.ts +34 -0
  12. package/build/cjs/lib/adapter/context.js +17 -0
  13. package/build/cjs/lib/adapter/context.js.map +7 -0
  14. package/build/cjs/lib/adapter/defaultObjs.d.ts +5 -0
  15. package/build/cjs/lib/adapter/defaultObjs.js +2 -0
  16. package/build/cjs/lib/adapter/defaultObjs.js.map +2 -2
  17. package/build/cjs/lib/adapter/log.d.ts +25 -0
  18. package/build/cjs/lib/adapter/log.js +29 -0
  19. package/build/cjs/lib/adapter/log.js.map +2 -2
  20. package/build/cjs/lib/adapter/managers/AdapterContextBase.d.ts +49 -0
  21. package/build/cjs/lib/adapter/managers/AdapterContextBase.js +98 -0
  22. package/build/cjs/lib/adapter/managers/AdapterContextBase.js.map +7 -0
  23. package/build/cjs/lib/adapter/managers/AliasManager.d.ts +103 -0
  24. package/build/cjs/lib/adapter/managers/AliasManager.js +293 -0
  25. package/build/cjs/lib/adapter/managers/AliasManager.js.map +7 -0
  26. package/build/cjs/lib/adapter/managers/CertificateManager.d.ts +50 -0
  27. package/build/cjs/lib/adapter/managers/CertificateManager.js +174 -0
  28. package/build/cjs/lib/adapter/managers/CertificateManager.js.map +7 -0
  29. package/build/cjs/lib/adapter/managers/MessagingManager.d.ts +58 -0
  30. package/build/cjs/lib/adapter/managers/MessagingManager.js +289 -0
  31. package/build/cjs/lib/adapter/managers/MessagingManager.js.map +7 -0
  32. package/build/cjs/lib/adapter/managers/ResourceManager.d.ts +69 -0
  33. package/build/cjs/lib/adapter/managers/ResourceManager.js +170 -0
  34. package/build/cjs/lib/adapter/managers/ResourceManager.js.map +7 -0
  35. package/build/cjs/lib/adapter/managers/SubscriptionManager.d.ts +107 -0
  36. package/build/cjs/lib/adapter/managers/SubscriptionManager.js +349 -0
  37. package/build/cjs/lib/adapter/managers/SubscriptionManager.js.map +7 -0
  38. package/build/cjs/lib/adapter/userInterfaceMessagingController.d.ts +10 -0
  39. package/build/cjs/lib/adapter/userInterfaceMessagingController.js +9 -2
  40. package/build/cjs/lib/adapter/userInterfaceMessagingController.js.map +2 -2
  41. package/build/cjs/lib/adapter/utils.js +15 -1
  42. package/build/cjs/lib/adapter/utils.js.map +2 -2
  43. package/build/cjs/lib/adapter/validator.d.ts +10 -5
  44. package/build/cjs/lib/adapter/validator.js +6 -5
  45. package/build/cjs/lib/adapter/validator.js.map +2 -2
  46. package/build/esm/index.d.ts +0 -1
  47. package/build/esm/index.d.ts.map +1 -1
  48. package/build/esm/index.js +0 -1
  49. package/build/esm/index.js.map +1 -1
  50. package/build/esm/lib/_Types.d.ts +394 -63
  51. package/build/esm/lib/_Types.d.ts.map +1 -1
  52. package/build/esm/lib/adapter/adapter.d.ts +1896 -177
  53. package/build/esm/lib/adapter/adapter.d.ts.map +1 -1
  54. package/build/esm/lib/adapter/adapter.js +900 -1215
  55. package/build/esm/lib/adapter/adapter.js.map +1 -1
  56. package/build/esm/lib/adapter/asyncAdapter.d.ts +167 -0
  57. package/build/esm/lib/adapter/asyncAdapter.d.ts.map +1 -0
  58. package/build/esm/lib/adapter/asyncAdapter.js +225 -0
  59. package/build/esm/lib/adapter/asyncAdapter.js.map +1 -0
  60. package/build/esm/lib/adapter/context.d.ts +34 -0
  61. package/build/esm/lib/adapter/context.d.ts.map +1 -0
  62. package/build/esm/lib/adapter/context.js +2 -0
  63. package/build/esm/lib/adapter/context.js.map +1 -0
  64. package/build/esm/lib/adapter/defaultObjs.d.ts +5 -0
  65. package/build/esm/lib/adapter/defaultObjs.d.ts.map +1 -1
  66. package/build/esm/lib/adapter/defaultObjs.js +5 -0
  67. package/build/esm/lib/adapter/defaultObjs.js.map +1 -1
  68. package/build/esm/lib/adapter/log.d.ts +25 -0
  69. package/build/esm/lib/adapter/log.d.ts.map +1 -1
  70. package/build/esm/lib/adapter/log.js +25 -0
  71. package/build/esm/lib/adapter/log.js.map +1 -1
  72. package/build/esm/lib/adapter/managers/AdapterContextBase.d.ts +49 -0
  73. package/build/esm/lib/adapter/managers/AdapterContextBase.d.ts.map +1 -0
  74. package/build/esm/lib/adapter/managers/AdapterContextBase.js +77 -0
  75. package/build/esm/lib/adapter/managers/AdapterContextBase.js.map +1 -0
  76. package/build/esm/lib/adapter/managers/AliasManager.d.ts +103 -0
  77. package/build/esm/lib/adapter/managers/AliasManager.d.ts.map +1 -0
  78. package/build/esm/lib/adapter/managers/AliasManager.js +269 -0
  79. package/build/esm/lib/adapter/managers/AliasManager.js.map +1 -0
  80. package/build/esm/lib/adapter/managers/CertificateManager.d.ts +50 -0
  81. package/build/esm/lib/adapter/managers/CertificateManager.d.ts.map +1 -0
  82. package/build/esm/lib/adapter/managers/CertificateManager.js +142 -0
  83. package/build/esm/lib/adapter/managers/CertificateManager.js.map +1 -0
  84. package/build/esm/lib/adapter/managers/MessagingManager.d.ts +58 -0
  85. package/build/esm/lib/adapter/managers/MessagingManager.d.ts.map +1 -0
  86. package/build/esm/lib/adapter/managers/MessagingManager.js +267 -0
  87. package/build/esm/lib/adapter/managers/MessagingManager.js.map +1 -0
  88. package/build/esm/lib/adapter/managers/ResourceManager.d.ts +69 -0
  89. package/build/esm/lib/adapter/managers/ResourceManager.d.ts.map +1 -0
  90. package/build/esm/lib/adapter/managers/ResourceManager.js +151 -0
  91. package/build/esm/lib/adapter/managers/ResourceManager.js.map +1 -0
  92. package/build/esm/lib/adapter/managers/SubscriptionManager.d.ts +107 -0
  93. package/build/esm/lib/adapter/managers/SubscriptionManager.d.ts.map +1 -0
  94. package/build/esm/lib/adapter/managers/SubscriptionManager.js +374 -0
  95. package/build/esm/lib/adapter/managers/SubscriptionManager.js.map +1 -0
  96. package/build/esm/lib/adapter/userInterfaceMessagingController.d.ts +10 -0
  97. package/build/esm/lib/adapter/userInterfaceMessagingController.d.ts.map +1 -1
  98. package/build/esm/lib/adapter/userInterfaceMessagingController.js +8 -2
  99. package/build/esm/lib/adapter/userInterfaceMessagingController.js.map +1 -1
  100. package/build/esm/lib/adapter/utils.d.ts.map +1 -1
  101. package/build/esm/lib/adapter/utils.js +1 -1
  102. package/build/esm/lib/adapter/utils.js.map +1 -1
  103. package/build/esm/lib/adapter/validator.d.ts +10 -5
  104. package/build/esm/lib/adapter/validator.d.ts.map +1 -1
  105. package/build/esm/lib/adapter/validator.js +8 -5
  106. package/build/esm/lib/adapter/validator.js.map +1 -1
  107. package/build/tsconfig.build.tsbuildinfo +1 -1
  108. package/package.json +25 -20
@@ -0,0 +1,167 @@
1
+ import type { AllPropsUnknown, InternalGetCertificatesResult, NotificationOptions, SendToOptions, SendToUserInterfaceClientOptions } from '../../lib/_Types.js';
2
+ import type { AdapterContext } from '../../lib/adapter/context.js';
3
+ /**
4
+ * Clean async-only facade for the adapter's outbound messaging. Owns the {@link MessagingManager}
5
+ * and exposes promise-based methods without the legacy `*Async` postfix.
6
+ */
7
+ export declare class AsyncAdapter {
8
+ #private;
9
+ /**
10
+ * @param ctx Shared adapter context providing live runtime state
11
+ */
12
+ constructor(ctx: AdapterContext);
13
+ /**
14
+ * Sends a message to another adapter instance and, unless `options.expectReply` is `false`,
15
+ * resolves with the reply when it arrives (or rejects with `Error('Timeout exceeded')` on timeout).
16
+ *
17
+ * Broadcast targets (instance name without a trailing `.<number>`) resolve void regardless.
18
+ *
19
+ * @param instanceName name of the instance to send the message to
20
+ * @param command command name
21
+ * @param message message payload
22
+ * @param options send options; set `expectReply: false` for fire-and-forget, or pass a legacy
23
+ * `callback` info header (mutually exclusive with `expectReply`)
24
+ */
25
+ sendTo(instanceName: string, command: string, message: any, options?: SendToOptions & {
26
+ expectReply?: boolean;
27
+ callback?: ioBroker.MessageCallbackInfo;
28
+ }): Promise<any>;
29
+ /**
30
+ * @internal
31
+ * @param instanceName name of the instance to send the message to
32
+ * @param command command name
33
+ * @param message message payload
34
+ * @param options send options
35
+ */
36
+ sendTo(instanceName: unknown, command: unknown, message?: unknown, options?: unknown): Promise<any>;
37
+ /**
38
+ * Sends a message to a host, or broadcasts to all hosts when `hostName` is `null`.
39
+ * For a specific host, resolves with the reply unless `options.expectReply` is `false`.
40
+ * Broadcasts resolve void.
41
+ *
42
+ * @param hostName name of the host, or `null` to broadcast to all hosts
43
+ * @param command command name
44
+ * @param message message payload
45
+ * @param options send options; set `expectReply: false` for fire-and-forget
46
+ */
47
+ sendToHost(hostName: string | null, command: string, message: any, options?: SendToOptions & {
48
+ expectReply?: boolean;
49
+ callback?: ioBroker.MessageCallbackInfo;
50
+ }): Promise<any>;
51
+ /**
52
+ * @internal
53
+ * @param hostName name of the host, or `null` to broadcast to all hosts
54
+ * @param command command name
55
+ * @param message message payload
56
+ * @param options send options
57
+ */
58
+ sendToHost(hostName: unknown, command: unknown, message?: unknown, options?: unknown): Promise<any>;
59
+ /**
60
+ * Sends a message to a single UI client, or broadcasts to all connected UI clients when `clientId` is omitted.
61
+ *
62
+ * @param options clientId and data options
63
+ */
64
+ sendToUI(options: AllPropsUnknown<SendToUserInterfaceClientOptions>): Promise<void>;
65
+ /**
66
+ * Sends an addNotification command to the host of this adapter instance.
67
+ *
68
+ * @param scope notification scope
69
+ * @param category notification category, or `null` to match by scope regex
70
+ * @param message notification message
71
+ * @param options additional notification options
72
+ */
73
+ registerNotification<Scope extends keyof ioBroker.NotificationScopes>(scope: Scope, category: ioBroker.NotificationScopes[Scope] | null, message: string, options?: NotificationOptions): Promise<void>;
74
+ /**
75
+ * @internal
76
+ * @param scope notification scope
77
+ * @param category notification category
78
+ * @param message notification message
79
+ * @param options additional notification options
80
+ */
81
+ registerNotification(scope: unknown, category: unknown, message: unknown, options?: unknown): Promise<void>;
82
+ /**
83
+ * Loads SSL certificates by name, falling back to the instance config defaults. File-backed
84
+ * certificate values are resolved to their content and their paths returned for watching.
85
+ *
86
+ * @param publicName public certificate name (defaults to `config.certPublic`)
87
+ * @param privateName private key name (defaults to `config.certPrivate`)
88
+ * @param chainedName chained certificate name (defaults to `config.certChained`)
89
+ */
90
+ getCertificates(publicName?: string, privateName?: string, chainedName?: string): Promise<InternalGetCertificatesResult>;
91
+ /**
92
+ * @internal
93
+ * @param publicName public certificate name
94
+ * @param privateName private key name
95
+ * @param chainedName chained certificate name
96
+ */
97
+ getCertificates(publicName?: unknown, privateName?: unknown, chainedName?: unknown): Promise<InternalGetCertificatesResult>;
98
+ /**
99
+ * Tells whether a new version of the `system.certificates` object changes one of the certificates
100
+ * handed out by the last {@link getCertificates} call. Returns false if certificates were never
101
+ * requested, so unrelated certificate edits do not concern this adapter.
102
+ *
103
+ * @param obj the new `system.certificates` object, or null/undefined if it was deleted
104
+ */
105
+ hasRelevantCertificateChange(obj: ioBroker.OtherObject | null | undefined): boolean;
106
+ /**
107
+ * Forgets the certificates handed out by the last {@link getCertificates} call, so
108
+ * {@link hasRelevantCertificateChange} no longer reports changes to them. Used when the adapter
109
+ * stops watching its certificates.
110
+ */
111
+ stopWatchingCertificates(): void;
112
+ /**
113
+ * Registers an exclusive resource (serial port, TCP/UDP port, USB device, ...) as used by this
114
+ * instance. The registration is forwarded to the host, which stores it under
115
+ * `system.host.<hostname>.usedResources.<type>`.
116
+ *
117
+ * @param type the kind of resource, e.g. "serialPort" or "tcpPort"
118
+ * @param data payload describing the resource
119
+ * @throws {Error} when the host refuses the registration or does not answer
120
+ */
121
+ registerUsedResource<T extends ioBroker.UsedResourceType>(type: T, data: ioBroker.UsedResourceData<T>): Promise<void>;
122
+ /**
123
+ * Asks the host whether another instance currently holds a resource, without registering it.
124
+ *
125
+ * @param type the kind of resource, e.g. "serialPort" or "tcpPort"
126
+ * @param data description of the resource that is about to be used
127
+ * @returns the entries of other instances that currently hold it
128
+ * @throws {Error} when the host refuses the request or does not answer
129
+ */
130
+ checkUsedResource<T extends ioBroker.UsedResourceType>(type: T, data?: Partial<ioBroker.UsedResourceData<T>>): Promise<ioBroker.RegisteredResource[]>;
131
+ /**
132
+ * Frees all exclusive resources this instance registered, across all types.
133
+ *
134
+ * @throws {Error} when the host refuses the command or does not answer
135
+ */
136
+ clearUsedResources(): Promise<void>;
137
+ /**
138
+ * Frees previously registered exclusive resources of this instance. `data` is a filter: every field it
139
+ * names must match. If it is omitted, all registered resources of the given `type` are freed.
140
+ *
141
+ * @param type the kind of resource, e.g. "serialPort" or "tcpPort"
142
+ * @param data fields identifying the resources to free; if omitted, all resources of `type` are freed
143
+ * @throws {Error} when the host refuses the command or does not answer
144
+ */
145
+ freeUsedResource<T extends ioBroker.UsedResourceType>(type: T, data?: Partial<ioBroker.UsedResourceData<T>>): Promise<void>;
146
+ /**
147
+ * Reads the exclusive resources of the given type registered on this instance's host, across all
148
+ * instances of that host.
149
+ *
150
+ * @param type resource type to read, e.g. "serialPort"
151
+ */
152
+ getHostUsedResources<T extends ioBroker.UsedResourceType>(type: T): Promise<ioBroker.RegisteredResource<T>[]>;
153
+ /** Reads the exclusive resources of every type registered on this instance's host. */
154
+ getHostUsedResources(): Promise<ioBroker.RegisteredResource[]>;
155
+ /**
156
+ * Resolves a pending reply promise for an acked messagebox message.
157
+ * Returns true if a pending entry was found and consumed.
158
+ *
159
+ * @param obj incoming message object from the messagebox
160
+ */
161
+ resolveReply(obj: ioBroker.Message): boolean;
162
+ /**
163
+ * Rejects all pending reply promises and clears their timers (used on stop).
164
+ */
165
+ clearPending(): void;
166
+ }
167
+ //# sourceMappingURL=asyncAdapter.d.ts.map
@@ -0,0 +1,252 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var asyncAdapter_exports = {};
21
+ __export(asyncAdapter_exports, {
22
+ AsyncAdapter: () => AsyncAdapter
23
+ });
24
+ module.exports = __toCommonJS(asyncAdapter_exports);
25
+ var import_CertificateManager = require("../../lib/adapter/managers/CertificateManager.js");
26
+ var import_MessagingManager = require("../../lib/adapter/managers/MessagingManager.js");
27
+ var import_ResourceManager = require("../../lib/adapter/managers/ResourceManager.js");
28
+ var import_validator = require("../../lib/adapter/validator.js");
29
+ class AsyncAdapter {
30
+ static {
31
+ __name(this, "AsyncAdapter");
32
+ }
33
+ #ctx;
34
+ #messagingInstance;
35
+ #certificatesInstance;
36
+ #resourcesInstance;
37
+ /**
38
+ * @param ctx Shared adapter context providing live runtime state
39
+ */
40
+ constructor(ctx) {
41
+ this.#ctx = ctx;
42
+ }
43
+ /** Lazily-constructed outbound messaging manager. */
44
+ get #messaging() {
45
+ return this.#messagingInstance ??= new import_MessagingManager.MessagingManager(this.#ctx);
46
+ }
47
+ /** Lazily-constructed certificate manager. */
48
+ get #certificates() {
49
+ return this.#certificatesInstance ??= new import_CertificateManager.CertificateManager(this.#ctx);
50
+ }
51
+ /** Lazily-constructed exclusive-resource manager. */
52
+ get #resources() {
53
+ return this.#resourcesInstance ??= new import_ResourceManager.ResourceManager(this.#ctx, () => this.#messaging);
54
+ }
55
+ /**
56
+ * @param instanceName name of the instance to send the message to
57
+ * @param command command name
58
+ * @param message message payload
59
+ * @param options send options
60
+ */
61
+ async sendTo(instanceName, command, message, options) {
62
+ import_validator.Validator.assertString(instanceName, "instanceName");
63
+ import_validator.Validator.assertString(command, "command");
64
+ if (options !== void 0) {
65
+ import_validator.Validator.assertObject(options, "options");
66
+ }
67
+ const { expectReply, callback, ...sendOptions } = options ?? {};
68
+ return this.#messaging.sendTo({
69
+ instanceName,
70
+ command,
71
+ message,
72
+ callback,
73
+ options: Object.keys(sendOptions).length ? sendOptions : void 0,
74
+ expectReply: callback ? false : expectReply ?? true
75
+ });
76
+ }
77
+ /**
78
+ * @param hostName name of the host, or `null` to broadcast to all hosts
79
+ * @param command command name
80
+ * @param message message payload
81
+ * @param options send options
82
+ */
83
+ async sendToHost(hostName, command, message, options) {
84
+ if (hostName !== null) {
85
+ import_validator.Validator.assertString(hostName, "hostName");
86
+ }
87
+ import_validator.Validator.assertString(command, "command");
88
+ if (options !== void 0) {
89
+ import_validator.Validator.assertObject(options, "options");
90
+ }
91
+ const { expectReply, callback, ...sendOptions } = options ?? {};
92
+ return this.#messaging.sendToHost({
93
+ hostName,
94
+ command,
95
+ message,
96
+ callback,
97
+ options: Object.keys(sendOptions).length ? sendOptions : void 0,
98
+ // broadcast (null host) yields many responses → never wait for a reply
99
+ expectReply: hostName !== null && !callback && (expectReply ?? true)
100
+ });
101
+ }
102
+ /**
103
+ * Sends a message to a single UI client, or broadcasts to all connected UI clients when `clientId` is omitted.
104
+ *
105
+ * @param options clientId and data options
106
+ */
107
+ sendToUI(options) {
108
+ const { clientId, data } = options;
109
+ if (clientId !== void 0) {
110
+ import_validator.Validator.assertString(clientId, "clientId");
111
+ }
112
+ return this.#messaging.sendToUI({ clientId, data });
113
+ }
114
+ /**
115
+ * @param scope notification scope
116
+ * @param category notification category
117
+ * @param message notification message
118
+ * @param options additional notification options
119
+ */
120
+ async registerNotification(scope, category, message, options) {
121
+ import_validator.Validator.assertString(scope, "scope");
122
+ if (category !== null) {
123
+ import_validator.Validator.assertString(category, "category");
124
+ }
125
+ import_validator.Validator.assertString(message, "message");
126
+ if (options !== void 0) {
127
+ import_validator.Validator.assertObject(options, "options");
128
+ }
129
+ return this.#messaging.registerNotification(scope, category, message, options);
130
+ }
131
+ /**
132
+ * @param publicName public certificate name
133
+ * @param privateName private key name
134
+ * @param chainedName chained certificate name
135
+ */
136
+ async getCertificates(publicName, privateName, chainedName) {
137
+ const config = this.#ctx.config;
138
+ publicName = publicName || config.certPublic;
139
+ privateName = privateName || config.certPrivate;
140
+ chainedName = chainedName || config.certChained;
141
+ if (publicName !== void 0) {
142
+ import_validator.Validator.assertString(publicName, "publicName");
143
+ }
144
+ if (privateName !== void 0) {
145
+ import_validator.Validator.assertString(privateName, "privateName");
146
+ }
147
+ if (chainedName !== void 0) {
148
+ import_validator.Validator.assertString(chainedName, "chainedName");
149
+ }
150
+ return this.#certificates.getCertificates({ publicName, privateName, chainedName });
151
+ }
152
+ /**
153
+ * Tells whether a new version of the `system.certificates` object changes one of the certificates
154
+ * handed out by the last {@link getCertificates} call. Returns false if certificates were never
155
+ * requested, so unrelated certificate edits do not concern this adapter.
156
+ *
157
+ * @param obj the new `system.certificates` object, or null/undefined if it was deleted
158
+ */
159
+ hasRelevantCertificateChange(obj) {
160
+ return this.#certificatesInstance?.hasRelevantChange(obj) ?? false;
161
+ }
162
+ /**
163
+ * Forgets the certificates handed out by the last {@link getCertificates} call, so
164
+ * {@link hasRelevantCertificateChange} no longer reports changes to them. Used when the adapter
165
+ * stops watching its certificates.
166
+ */
167
+ stopWatchingCertificates() {
168
+ this.#certificatesInstance?.stopWatching();
169
+ }
170
+ /**
171
+ * Registers an exclusive resource (serial port, TCP/UDP port, USB device, ...) as used by this
172
+ * instance. The registration is forwarded to the host, which stores it under
173
+ * `system.host.<hostname>.usedResources.<type>`.
174
+ *
175
+ * @param type the kind of resource, e.g. "serialPort" or "tcpPort"
176
+ * @param data payload describing the resource
177
+ * @throws {Error} when the host refuses the registration or does not answer
178
+ */
179
+ async registerUsedResource(type, data) {
180
+ import_validator.Validator.assertString(type, "type");
181
+ import_validator.Validator.assertObject(data, "data");
182
+ return this.#resources.registerUsedResource(type, data);
183
+ }
184
+ /**
185
+ * Asks the host whether another instance currently holds a resource, without registering it.
186
+ *
187
+ * @param type the kind of resource, e.g. "serialPort" or "tcpPort"
188
+ * @param data description of the resource that is about to be used
189
+ * @returns the entries of other instances that currently hold it
190
+ * @throws {Error} when the host refuses the request or does not answer
191
+ */
192
+ async checkUsedResource(type, data) {
193
+ import_validator.Validator.assertString(type, "type");
194
+ if (data !== void 0) {
195
+ import_validator.Validator.assertObject(data, "data");
196
+ }
197
+ return this.#resources.checkUsedResource(type, data);
198
+ }
199
+ /**
200
+ * Frees all exclusive resources this instance registered, across all types.
201
+ *
202
+ * @throws {Error} when the host refuses the command or does not answer
203
+ */
204
+ async clearUsedResources() {
205
+ return this.#resources.clearUsedResources();
206
+ }
207
+ /**
208
+ * Frees previously registered exclusive resources of this instance. `data` is a filter: every field it
209
+ * names must match. If it is omitted, all registered resources of the given `type` are freed.
210
+ *
211
+ * @param type the kind of resource, e.g. "serialPort" or "tcpPort"
212
+ * @param data fields identifying the resources to free; if omitted, all resources of `type` are freed
213
+ * @throws {Error} when the host refuses the command or does not answer
214
+ */
215
+ async freeUsedResource(type, data) {
216
+ import_validator.Validator.assertString(type, "type");
217
+ if (data !== void 0) {
218
+ import_validator.Validator.assertObject(data, "data");
219
+ }
220
+ return this.#resources.freeUsedResource(type, data);
221
+ }
222
+ /**
223
+ * @param type resource type to read; if omitted, the resources of every type are read
224
+ */
225
+ getHostUsedResources(type) {
226
+ if (type !== void 0) {
227
+ import_validator.Validator.assertString(type, "type");
228
+ return this.#resources.getHostUsedResources(type);
229
+ }
230
+ return this.#resources.getHostUsedResources();
231
+ }
232
+ /**
233
+ * Resolves a pending reply promise for an acked messagebox message.
234
+ * Returns true if a pending entry was found and consumed.
235
+ *
236
+ * @param obj incoming message object from the messagebox
237
+ */
238
+ resolveReply(obj) {
239
+ return this.#messagingInstance?.resolveCallback(obj) ?? false;
240
+ }
241
+ /**
242
+ * Rejects all pending reply promises and clears their timers (used on stop).
243
+ */
244
+ clearPending() {
245
+ this.#messagingInstance?.clearPendingCallbacks();
246
+ }
247
+ }
248
+ // Annotate the CommonJS export names for ESM import in node:
249
+ 0 && (module.exports = {
250
+ AsyncAdapter
251
+ });
252
+ //# sourceMappingURL=asyncAdapter.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/lib/adapter/asyncAdapter.ts"],
4
+ "sourcesContent": ["import type {\n AllPropsUnknown,\n InternalAdapterConfig,\n InternalGetCertificatesResult,\n NotificationOptions,\n SendToOptions,\n SendToUserInterfaceClientOptions,\n} from '@/lib/_Types.js';\nimport type { AdapterContext } from '@/lib/adapter/context.js';\nimport { CertificateManager } from '@/lib/adapter/managers/CertificateManager.js';\nimport { MessagingManager } from '@/lib/adapter/managers/MessagingManager.js';\nimport { ResourceManager } from '@/lib/adapter/managers/ResourceManager.js';\nimport { Validator } from '@/lib/adapter/validator.js';\n\n/**\n * Clean async-only facade for the adapter's outbound messaging. Owns the {@link MessagingManager}\n * and exposes promise-based methods without the legacy `*Async` postfix.\n */\nexport class AsyncAdapter {\n readonly #ctx: AdapterContext;\n #messagingInstance?: MessagingManager;\n #certificatesInstance?: CertificateManager;\n #resourcesInstance?: ResourceManager;\n\n /**\n * @param ctx Shared adapter context providing live runtime state\n */\n constructor(ctx: AdapterContext) {\n this.#ctx = ctx;\n }\n\n /** Lazily-constructed outbound messaging manager. */\n get #messaging(): MessagingManager {\n return (this.#messagingInstance ??= new MessagingManager(this.#ctx));\n }\n\n /** Lazily-constructed certificate manager. */\n get #certificates(): CertificateManager {\n return (this.#certificatesInstance ??= new CertificateManager(this.#ctx));\n }\n\n /** Lazily-constructed exclusive-resource manager. */\n get #resources(): ResourceManager {\n return (this.#resourcesInstance ??= new ResourceManager(this.#ctx, () => this.#messaging));\n }\n\n /**\n * Sends a message to another adapter instance and, unless `options.expectReply` is `false`,\n * resolves with the reply when it arrives (or rejects with `Error('Timeout exceeded')` on timeout).\n *\n * Broadcast targets (instance name without a trailing `.<number>`) resolve void regardless.\n *\n * @param instanceName name of the instance to send the message to\n * @param command command name\n * @param message message payload\n * @param options send options; set `expectReply: false` for fire-and-forget, or pass a legacy\n * `callback` info header (mutually exclusive with `expectReply`)\n */\n sendTo(\n instanceName: string,\n command: string,\n message: any,\n options?: SendToOptions & { expectReply?: boolean; callback?: ioBroker.MessageCallbackInfo },\n ): Promise<any>;\n /**\n * @internal\n * @param instanceName name of the instance to send the message to\n * @param command command name\n * @param message message payload\n * @param options send options\n */\n sendTo(instanceName: unknown, command: unknown, message?: unknown, options?: unknown): Promise<any>;\n /**\n * @param instanceName name of the instance to send the message to\n * @param command command name\n * @param message message payload\n * @param options send options\n */\n async sendTo(instanceName: unknown, command: unknown, message?: unknown, options?: unknown): Promise<any> {\n Validator.assertString(instanceName, 'instanceName');\n Validator.assertString(command, 'command');\n if (options !== undefined) {\n Validator.assertObject<SendToOptions & { expectReply?: boolean; callback?: ioBroker.MessageCallbackInfo }>(\n options,\n 'options',\n );\n }\n\n const { expectReply, callback, ...sendOptions } = options ?? {};\n return this.#messaging.sendTo({\n instanceName,\n command,\n message,\n callback,\n options: Object.keys(sendOptions).length ? sendOptions : undefined,\n expectReply: callback ? false : (expectReply ?? true),\n });\n }\n\n /**\n * Sends a message to a host, or broadcasts to all hosts when `hostName` is `null`.\n * For a specific host, resolves with the reply unless `options.expectReply` is `false`.\n * Broadcasts resolve void.\n *\n * @param hostName name of the host, or `null` to broadcast to all hosts\n * @param command command name\n * @param message message payload\n * @param options send options; set `expectReply: false` for fire-and-forget\n */\n sendToHost(\n hostName: string | null,\n command: string,\n message: any,\n options?: SendToOptions & { expectReply?: boolean; callback?: ioBroker.MessageCallbackInfo },\n ): Promise<any>;\n /**\n * @internal\n * @param hostName name of the host, or `null` to broadcast to all hosts\n * @param command command name\n * @param message message payload\n * @param options send options\n */\n sendToHost(hostName: unknown, command: unknown, message?: unknown, options?: unknown): Promise<any>;\n /**\n * @param hostName name of the host, or `null` to broadcast to all hosts\n * @param command command name\n * @param message message payload\n * @param options send options\n */\n async sendToHost(hostName: unknown, command: unknown, message?: unknown, options?: unknown): Promise<any> {\n if (hostName !== null) {\n Validator.assertString(hostName, 'hostName');\n }\n Validator.assertString(command, 'command');\n if (options !== undefined) {\n Validator.assertObject<SendToOptions & { expectReply?: boolean; callback?: ioBroker.MessageCallbackInfo }>(\n options,\n 'options',\n );\n }\n\n const { expectReply, callback, ...sendOptions } = options ?? {};\n return this.#messaging.sendToHost({\n hostName,\n command,\n message,\n callback,\n options: Object.keys(sendOptions).length ? sendOptions : undefined,\n // broadcast (null host) yields many responses \u2192 never wait for a reply\n expectReply: hostName !== null && !callback && (expectReply ?? true),\n });\n }\n\n /**\n * Sends a message to a single UI client, or broadcasts to all connected UI clients when `clientId` is omitted.\n *\n * @param options clientId and data options\n */\n sendToUI(options: AllPropsUnknown<SendToUserInterfaceClientOptions>): Promise<void> {\n const { clientId, data } = options;\n if (clientId !== undefined) {\n Validator.assertString(clientId, 'clientId');\n }\n return this.#messaging.sendToUI({ clientId, data });\n }\n\n /**\n * Sends an addNotification command to the host of this adapter instance.\n *\n * @param scope notification scope\n * @param category notification category, or `null` to match by scope regex\n * @param message notification message\n * @param options additional notification options\n */\n registerNotification<Scope extends keyof ioBroker.NotificationScopes>(\n scope: Scope,\n category: ioBroker.NotificationScopes[Scope] | null,\n message: string,\n options?: NotificationOptions,\n ): Promise<void>;\n /**\n * @internal\n * @param scope notification scope\n * @param category notification category\n * @param message notification message\n * @param options additional notification options\n */\n registerNotification(scope: unknown, category: unknown, message: unknown, options?: unknown): Promise<void>;\n /**\n * @param scope notification scope\n * @param category notification category\n * @param message notification message\n * @param options additional notification options\n */\n async registerNotification(scope: unknown, category: unknown, message: unknown, options?: unknown): Promise<void> {\n Validator.assertString(scope, 'scope');\n if (category !== null) {\n Validator.assertString(category, 'category');\n }\n Validator.assertString(message, 'message');\n if (options !== undefined) {\n Validator.assertObject<NotificationOptions>(options, 'options');\n }\n return this.#messaging.registerNotification(scope, category, message, options);\n }\n\n /**\n * Loads SSL certificates by name, falling back to the instance config defaults. File-backed\n * certificate values are resolved to their content and their paths returned for watching.\n *\n * @param publicName public certificate name (defaults to `config.certPublic`)\n * @param privateName private key name (defaults to `config.certPrivate`)\n * @param chainedName chained certificate name (defaults to `config.certChained`)\n */\n getCertificates(\n publicName?: string,\n privateName?: string,\n chainedName?: string,\n ): Promise<InternalGetCertificatesResult>;\n /**\n * @internal\n * @param publicName public certificate name\n * @param privateName private key name\n * @param chainedName chained certificate name\n */\n getCertificates(\n publicName?: unknown,\n privateName?: unknown,\n chainedName?: unknown,\n ): Promise<InternalGetCertificatesResult>;\n /**\n * @param publicName public certificate name\n * @param privateName private key name\n * @param chainedName chained certificate name\n */\n async getCertificates(\n publicName?: unknown,\n privateName?: unknown,\n chainedName?: unknown,\n ): Promise<InternalGetCertificatesResult> {\n const config = this.#ctx.config as InternalAdapterConfig;\n publicName = publicName || config.certPublic;\n privateName = privateName || config.certPrivate;\n chainedName = chainedName || config.certChained;\n\n if (publicName !== undefined) {\n Validator.assertString(publicName, 'publicName');\n }\n if (privateName !== undefined) {\n Validator.assertString(privateName, 'privateName');\n }\n if (chainedName !== undefined) {\n Validator.assertString(chainedName, 'chainedName');\n }\n\n return this.#certificates.getCertificates({ publicName, privateName, chainedName });\n }\n\n /**\n * Tells whether a new version of the `system.certificates` object changes one of the certificates\n * handed out by the last {@link getCertificates} call. Returns false if certificates were never\n * requested, so unrelated certificate edits do not concern this adapter.\n *\n * @param obj the new `system.certificates` object, or null/undefined if it was deleted\n */\n hasRelevantCertificateChange(obj: ioBroker.OtherObject | null | undefined): boolean {\n return this.#certificatesInstance?.hasRelevantChange(obj) ?? false;\n }\n\n /**\n * Forgets the certificates handed out by the last {@link getCertificates} call, so\n * {@link hasRelevantCertificateChange} no longer reports changes to them. Used when the adapter\n * stops watching its certificates.\n */\n stopWatchingCertificates(): void {\n this.#certificatesInstance?.stopWatching();\n }\n\n /**\n * Registers an exclusive resource (serial port, TCP/UDP port, USB device, ...) as used by this\n * instance. The registration is forwarded to the host, which stores it under\n * `system.host.<hostname>.usedResources.<type>`.\n *\n * @param type the kind of resource, e.g. \"serialPort\" or \"tcpPort\"\n * @param data payload describing the resource\n * @throws {Error} when the host refuses the registration or does not answer\n */\n async registerUsedResource<T extends ioBroker.UsedResourceType>(\n type: T,\n data: ioBroker.UsedResourceData<T>,\n ): Promise<void> {\n Validator.assertString(type, 'type');\n Validator.assertObject(data, 'data');\n return this.#resources.registerUsedResource(type, data);\n }\n\n /**\n * Asks the host whether another instance currently holds a resource, without registering it.\n *\n * @param type the kind of resource, e.g. \"serialPort\" or \"tcpPort\"\n * @param data description of the resource that is about to be used\n * @returns the entries of other instances that currently hold it\n * @throws {Error} when the host refuses the request or does not answer\n */\n async checkUsedResource<T extends ioBroker.UsedResourceType>(\n type: T,\n data?: Partial<ioBroker.UsedResourceData<T>>,\n ): Promise<ioBroker.RegisteredResource[]> {\n Validator.assertString(type, 'type');\n if (data !== undefined) {\n Validator.assertObject(data, 'data');\n }\n return this.#resources.checkUsedResource(type, data);\n }\n\n /**\n * Frees all exclusive resources this instance registered, across all types.\n *\n * @throws {Error} when the host refuses the command or does not answer\n */\n async clearUsedResources(): Promise<void> {\n return this.#resources.clearUsedResources();\n }\n\n /**\n * Frees previously registered exclusive resources of this instance. `data` is a filter: every field it\n * names must match. If it is omitted, all registered resources of the given `type` are freed.\n *\n * @param type the kind of resource, e.g. \"serialPort\" or \"tcpPort\"\n * @param data fields identifying the resources to free; if omitted, all resources of `type` are freed\n * @throws {Error} when the host refuses the command or does not answer\n */\n async freeUsedResource<T extends ioBroker.UsedResourceType>(\n type: T,\n data?: Partial<ioBroker.UsedResourceData<T>>,\n ): Promise<void> {\n Validator.assertString(type, 'type');\n if (data !== undefined) {\n Validator.assertObject(data, 'data');\n }\n return this.#resources.freeUsedResource(type, data);\n }\n\n /**\n * Reads the exclusive resources of the given type registered on this instance's host, across all\n * instances of that host.\n *\n * @param type resource type to read, e.g. \"serialPort\"\n */\n getHostUsedResources<T extends ioBroker.UsedResourceType>(type: T): Promise<ioBroker.RegisteredResource<T>[]>;\n /** Reads the exclusive resources of every type registered on this instance's host. */\n getHostUsedResources(): Promise<ioBroker.RegisteredResource[]>;\n\n /**\n * @param type resource type to read; if omitted, the resources of every type are read\n */\n getHostUsedResources(type?: ioBroker.UsedResourceType): Promise<ioBroker.RegisteredResource[]> {\n if (type !== undefined) {\n Validator.assertString(type, 'type');\n return this.#resources.getHostUsedResources(type);\n }\n return this.#resources.getHostUsedResources();\n }\n\n /**\n * Resolves a pending reply promise for an acked messagebox message.\n * Returns true if a pending entry was found and consumed.\n *\n * @param obj incoming message object from the messagebox\n */\n resolveReply(obj: ioBroker.Message): boolean {\n return this.#messagingInstance?.resolveCallback(obj) ?? false;\n }\n\n /**\n * Rejects all pending reply promises and clears their timers (used on stop).\n */\n clearPending(): void {\n this.#messagingInstance?.clearPendingCallbacks();\n }\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,34 @@
1
+ import type Winston from 'winston';
2
+ import type { Client as StatesInRedisClient } from '@iobroker/db-states-redis';
3
+ import type { Client as ObjectsInRedisClient } from '@iobroker/db-objects-redis';
4
+ import type { UserInterfaceMessagingController } from '../../lib/adapter/userInterfaceMessagingController.js';
5
+ /**
6
+ * Live view of the adapter's shared runtime state, passed to managers at construction time.
7
+ *
8
+ * The mutable fields are exposed as getter properties so late-bound values (DB clients,
9
+ * namespace, host) stay live: the adapter builds one context whose getters read its own
10
+ * fields, and every manager reads the same object.
11
+ */
12
+ export interface AdapterContext {
13
+ /** Current states DB client */
14
+ readonly states: StatesInRedisClient | null | undefined;
15
+ /** Current objects DB client */
16
+ readonly objects: ObjectsInRedisClient | null | undefined;
17
+ /** Current adapter common config */
18
+ readonly common: ioBroker.InstanceCommon | undefined;
19
+ /** Current adapter instance config (native) */
20
+ readonly config: ioBroker.AdapterConfig;
21
+ /** Current host name (may be undefined before init) */
22
+ readonly host: string | undefined;
23
+ /** Current adapter namespace, e.g. `"adapter.0"` */
24
+ readonly namespace: `${string}.${number}`;
25
+ /** Current namespace string used in log messages */
26
+ readonly namespaceLog: string;
27
+ /** Logger instance */
28
+ readonly logger: Winston.Logger;
29
+ /** Controller for UI messaging */
30
+ readonly uiMessagingController: UserInterfaceMessagingController;
31
+ /** Increment the adapter's outbound-write counter. */
32
+ readonly countOutput: () => void;
33
+ }
34
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var context_exports = {};
16
+ module.exports = __toCommonJS(context_exports);
17
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../esm/lib/adapter/context.js"],
4
+ "sourcesContent": ["export {};\n//# sourceMappingURL=context.js.map"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,2 +1,7 @@
1
+ /**
2
+ * Create the default `common` definitions for the well-known state roles (e.g. level.dimmer, indicator.working)
3
+ *
4
+ * @returns a map of state role to its default common properties
5
+ */
1
6
  export declare function createDefaults(): Record<string, Partial<ioBroker.StateCommon>>;
2
7
  //# sourceMappingURL=defaultObjs.d.ts.map
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -64,6 +65,7 @@ function createDefaults() {
64
65
  }
65
66
  };
66
67
  }
68
+ __name(createDefaults, "createDefaults");
67
69
  // Annotate the CommonJS export names for ESM import in node:
68
70
  0 && (module.exports = {
69
71
  createDefaults
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/adapter/defaultObjs.ts"],
4
- "sourcesContent": ["export function createDefaults(): Record<string, Partial<ioBroker.StateCommon>> {\n return {\n 'level.dimmer': {\n type: 'number',\n read: true,\n write: true,\n min: 0,\n max: 100,\n unit: '%',\n },\n 'indicator.working': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n },\n 'indicator.maintenance': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n },\n 'indicator.maintenance.lowbat': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n desc: 'Low battery',\n },\n 'indicator.maintenance.unreach': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n desc: 'Device unreachable',\n },\n switch: {\n type: 'boolean',\n read: true,\n write: true,\n },\n } as const;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAM,SAAU,iBAAc;AAC1B,SAAO;IACH,gBAAgB;MACZ,MAAM;MACN,MAAM;MACN,OAAO;MACP,KAAK;MACL,KAAK;MACL,MAAM;;IAEV,qBAAqB;MACjB,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;;IAEX,yBAAyB;MACrB,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;;IAEX,gCAAgC;MAC5B,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;MACP,MAAM;;IAEV,iCAAiC;MAC7B,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;MACP,MAAM;;IAEV,QAAQ;MACJ,MAAM;MACN,MAAM;MACN,OAAO;;;AAGnB;",
4
+ "sourcesContent": ["/**\n * Create the default `common` definitions for the well-known state roles (e.g. level.dimmer, indicator.working)\n *\n * @returns a map of state role to its default common properties\n */\nexport function createDefaults(): Record<string, Partial<ioBroker.StateCommon>> {\n return {\n 'level.dimmer': {\n type: 'number',\n read: true,\n write: true,\n min: 0,\n max: 100,\n unit: '%',\n },\n 'indicator.working': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n },\n 'indicator.maintenance': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n },\n 'indicator.maintenance.lowbat': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n desc: 'Low battery',\n },\n 'indicator.maintenance.unreach': {\n def: false,\n type: 'boolean',\n read: true,\n write: false,\n desc: 'Device unreachable',\n },\n switch: {\n type: 'boolean',\n read: true,\n write: true,\n },\n } as const;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKM,SAAU,iBAAc;AAC1B,SAAO;IACH,gBAAgB;MACZ,MAAM;MACN,MAAM;MACN,OAAO;MACP,KAAK;MACL,KAAK;MACL,MAAM;;IAEV,qBAAqB;MACjB,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;;IAEX,yBAAyB;MACrB,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;;IAEX,gCAAgC;MAC5B,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;MACP,MAAM;;IAEV,iCAAiC;MAC7B,KAAK;MACL,MAAM;MACN,MAAM;MACN,OAAO;MACP,MAAM;;IAEV,QAAQ;MACJ,MAAM;MACN,MAAM;MACN,OAAO;;;AAGnB;AA1CgB;",
6
6
  "names": []
7
7
  }
@@ -13,10 +13,35 @@ export declare class Log implements ioBroker.Logger {
13
13
  * @param logger logger instance
14
14
  */
15
15
  constructor(namespaceLog: string, level: ioBroker.LogLevel, logger: any);
16
+ /**
17
+ * Log a message at the silly level, prefixed with the adapter namespace
18
+ *
19
+ * @param msg the message to log
20
+ */
16
21
  silly(msg: string): void;
22
+ /**
23
+ * Log a message at the debug level, prefixed with the adapter namespace
24
+ *
25
+ * @param msg the message to log
26
+ */
17
27
  debug(msg: string): void;
28
+ /**
29
+ * Log a message at the info level, prefixed with the adapter namespace
30
+ *
31
+ * @param msg the message to log
32
+ */
18
33
  info(msg: string): void;
34
+ /**
35
+ * Log a message at the error level, prefixed with the adapter namespace
36
+ *
37
+ * @param msg the message to log
38
+ */
19
39
  error(msg: string): void;
40
+ /**
41
+ * Log a message at the warn level, prefixed with the adapter namespace
42
+ *
43
+ * @param msg the message to log
44
+ */
20
45
  warn(msg: string): void;
21
46
  }
22
47
  //# sourceMappingURL=log.d.ts.map