@iobroker/js-controller-adapter 7.2.3 → 8.0.0-alpha.1-20260921-e5941ca8a

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 (101) 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 +1818 -177
  6. package/build/cjs/lib/adapter/adapter.js +715 -1035
  7. package/build/cjs/lib/adapter/adapter.js.map +2 -2
  8. package/build/cjs/lib/adapter/asyncAdapter.d.ts +124 -0
  9. package/build/cjs/lib/adapter/asyncAdapter.js +184 -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/SubscriptionManager.d.ts +107 -0
  33. package/build/cjs/lib/adapter/managers/SubscriptionManager.js +349 -0
  34. package/build/cjs/lib/adapter/managers/SubscriptionManager.js.map +7 -0
  35. package/build/cjs/lib/adapter/userInterfaceMessagingController.d.ts +10 -0
  36. package/build/cjs/lib/adapter/userInterfaceMessagingController.js +9 -2
  37. package/build/cjs/lib/adapter/userInterfaceMessagingController.js.map +2 -2
  38. package/build/cjs/lib/adapter/utils.js +15 -1
  39. package/build/cjs/lib/adapter/utils.js.map +2 -2
  40. package/build/cjs/lib/adapter/validator.d.ts +10 -5
  41. package/build/cjs/lib/adapter/validator.js +6 -5
  42. package/build/cjs/lib/adapter/validator.js.map +2 -2
  43. package/build/esm/index.d.ts +0 -1
  44. package/build/esm/index.d.ts.map +1 -1
  45. package/build/esm/index.js +0 -1
  46. package/build/esm/index.js.map +1 -1
  47. package/build/esm/lib/_Types.d.ts +394 -63
  48. package/build/esm/lib/_Types.d.ts.map +1 -1
  49. package/build/esm/lib/adapter/adapter.d.ts +1818 -177
  50. package/build/esm/lib/adapter/adapter.d.ts.map +1 -1
  51. package/build/esm/lib/adapter/adapter.js +827 -1215
  52. package/build/esm/lib/adapter/adapter.js.map +1 -1
  53. package/build/esm/lib/adapter/asyncAdapter.d.ts +124 -0
  54. package/build/esm/lib/adapter/asyncAdapter.d.ts.map +1 -0
  55. package/build/esm/lib/adapter/asyncAdapter.js +157 -0
  56. package/build/esm/lib/adapter/asyncAdapter.js.map +1 -0
  57. package/build/esm/lib/adapter/context.d.ts +34 -0
  58. package/build/esm/lib/adapter/context.d.ts.map +1 -0
  59. package/build/esm/lib/adapter/context.js +2 -0
  60. package/build/esm/lib/adapter/context.js.map +1 -0
  61. package/build/esm/lib/adapter/defaultObjs.d.ts +5 -0
  62. package/build/esm/lib/adapter/defaultObjs.d.ts.map +1 -1
  63. package/build/esm/lib/adapter/defaultObjs.js +5 -0
  64. package/build/esm/lib/adapter/defaultObjs.js.map +1 -1
  65. package/build/esm/lib/adapter/log.d.ts +25 -0
  66. package/build/esm/lib/adapter/log.d.ts.map +1 -1
  67. package/build/esm/lib/adapter/log.js +25 -0
  68. package/build/esm/lib/adapter/log.js.map +1 -1
  69. package/build/esm/lib/adapter/managers/AdapterContextBase.d.ts +49 -0
  70. package/build/esm/lib/adapter/managers/AdapterContextBase.d.ts.map +1 -0
  71. package/build/esm/lib/adapter/managers/AdapterContextBase.js +77 -0
  72. package/build/esm/lib/adapter/managers/AdapterContextBase.js.map +1 -0
  73. package/build/esm/lib/adapter/managers/AliasManager.d.ts +103 -0
  74. package/build/esm/lib/adapter/managers/AliasManager.d.ts.map +1 -0
  75. package/build/esm/lib/adapter/managers/AliasManager.js +269 -0
  76. package/build/esm/lib/adapter/managers/AliasManager.js.map +1 -0
  77. package/build/esm/lib/adapter/managers/CertificateManager.d.ts +50 -0
  78. package/build/esm/lib/adapter/managers/CertificateManager.d.ts.map +1 -0
  79. package/build/esm/lib/adapter/managers/CertificateManager.js +142 -0
  80. package/build/esm/lib/adapter/managers/CertificateManager.js.map +1 -0
  81. package/build/esm/lib/adapter/managers/MessagingManager.d.ts +58 -0
  82. package/build/esm/lib/adapter/managers/MessagingManager.d.ts.map +1 -0
  83. package/build/esm/lib/adapter/managers/MessagingManager.js +267 -0
  84. package/build/esm/lib/adapter/managers/MessagingManager.js.map +1 -0
  85. package/build/esm/lib/adapter/managers/SubscriptionManager.d.ts +107 -0
  86. package/build/esm/lib/adapter/managers/SubscriptionManager.d.ts.map +1 -0
  87. package/build/esm/lib/adapter/managers/SubscriptionManager.js +374 -0
  88. package/build/esm/lib/adapter/managers/SubscriptionManager.js.map +1 -0
  89. package/build/esm/lib/adapter/userInterfaceMessagingController.d.ts +10 -0
  90. package/build/esm/lib/adapter/userInterfaceMessagingController.d.ts.map +1 -1
  91. package/build/esm/lib/adapter/userInterfaceMessagingController.js +8 -2
  92. package/build/esm/lib/adapter/userInterfaceMessagingController.js.map +1 -1
  93. package/build/esm/lib/adapter/utils.d.ts.map +1 -1
  94. package/build/esm/lib/adapter/utils.js +1 -1
  95. package/build/esm/lib/adapter/utils.js.map +1 -1
  96. package/build/esm/lib/adapter/validator.d.ts +10 -5
  97. package/build/esm/lib/adapter/validator.d.ts.map +1 -1
  98. package/build/esm/lib/adapter/validator.js +8 -5
  99. package/build/esm/lib/adapter/validator.js.map +1 -1
  100. package/build/tsconfig.build.tsbuildinfo +1 -1
  101. package/package.json +25 -20
@@ -0,0 +1,124 @@
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
+ * Resolves a pending reply promise for an acked messagebox message.
114
+ * Returns true if a pending entry was found and consumed.
115
+ *
116
+ * @param obj incoming message object from the messagebox
117
+ */
118
+ resolveReply(obj: ioBroker.Message): boolean;
119
+ /**
120
+ * Rejects all pending reply promises and clears their timers (used on stop).
121
+ */
122
+ clearPending(): void;
123
+ }
124
+ //# sourceMappingURL=asyncAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapter/asyncAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EAEf,6BAA6B,EAC7B,mBAAmB,EACnB,aAAa,EACb,gCAAgC,EACnC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D;;;GAGG;AACH,qBAAa,Y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,OAAO,CAAC,EAAE,mBAAmB,GAC9B,OAAO,CAAC,IAAI,CAAC;IAChB;;;;;;OAMG;IACH,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB3G;;;;;;;OAOG;IACH,eAAe,CACX,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,6BAA6B,CAAC;IACzC;;;;;OAKG;IACH,eAAe,CACX,UAAU,CAAC,EAAE,OAAO,EACpB,WAAW,CAAC,EAAE,OAAO,EACrB,WAAW,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,6BAA6B,CAAC;IA6BzC;;;;;;OAMG;IACH,4BAA4B,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAInF;;;;OAIG;IACH,wBAAwB,IAAI,IAAI;IAIhC;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,GAAG,OAAO;IAI5C;;OAEG;IACH,YAAY,IAAI,IAAI;CAGvB"}
@@ -0,0 +1,157 @@
1
+ import { CertificateManager } from '../../lib/adapter/managers/CertificateManager.js';
2
+ import { MessagingManager } from '../../lib/adapter/managers/MessagingManager.js';
3
+ import { Validator } from '../../lib/adapter/validator.js';
4
+ /**
5
+ * Clean async-only facade for the adapter's outbound messaging. Owns the {@link MessagingManager}
6
+ * and exposes promise-based methods without the legacy `*Async` postfix.
7
+ */
8
+ export class AsyncAdapter {
9
+ #ctx;
10
+ #messagingInstance;
11
+ #certificatesInstance;
12
+ /**
13
+ * @param ctx Shared adapter context providing live runtime state
14
+ */
15
+ constructor(ctx) {
16
+ this.#ctx = ctx;
17
+ }
18
+ /** Lazily-constructed outbound messaging manager. */
19
+ get #messaging() {
20
+ return (this.#messagingInstance ??= new MessagingManager(this.#ctx));
21
+ }
22
+ /** Lazily-constructed certificate manager. */
23
+ get #certificates() {
24
+ return (this.#certificatesInstance ??= new CertificateManager(this.#ctx));
25
+ }
26
+ /**
27
+ * @param instanceName name of the instance to send the message to
28
+ * @param command command name
29
+ * @param message message payload
30
+ * @param options send options
31
+ */
32
+ async sendTo(instanceName, command, message, options) {
33
+ Validator.assertString(instanceName, 'instanceName');
34
+ Validator.assertString(command, 'command');
35
+ if (options !== undefined) {
36
+ Validator.assertObject(options, 'options');
37
+ }
38
+ const { expectReply, callback, ...sendOptions } = options ?? {};
39
+ return this.#messaging.sendTo({
40
+ instanceName,
41
+ command,
42
+ message,
43
+ callback,
44
+ options: Object.keys(sendOptions).length ? sendOptions : undefined,
45
+ expectReply: callback ? false : (expectReply ?? true),
46
+ });
47
+ }
48
+ /**
49
+ * @param hostName name of the host, or `null` to broadcast to all hosts
50
+ * @param command command name
51
+ * @param message message payload
52
+ * @param options send options
53
+ */
54
+ async sendToHost(hostName, command, message, options) {
55
+ if (hostName !== null) {
56
+ Validator.assertString(hostName, 'hostName');
57
+ }
58
+ Validator.assertString(command, 'command');
59
+ if (options !== undefined) {
60
+ Validator.assertObject(options, 'options');
61
+ }
62
+ const { expectReply, callback, ...sendOptions } = options ?? {};
63
+ return this.#messaging.sendToHost({
64
+ hostName,
65
+ command,
66
+ message,
67
+ callback,
68
+ options: Object.keys(sendOptions).length ? sendOptions : undefined,
69
+ // broadcast (null host) yields many responses → never wait for a reply
70
+ expectReply: hostName !== null && !callback && (expectReply ?? true),
71
+ });
72
+ }
73
+ /**
74
+ * Sends a message to a single UI client, or broadcasts to all connected UI clients when `clientId` is omitted.
75
+ *
76
+ * @param options clientId and data options
77
+ */
78
+ sendToUI(options) {
79
+ const { clientId, data } = options;
80
+ if (clientId !== undefined) {
81
+ Validator.assertString(clientId, 'clientId');
82
+ }
83
+ return this.#messaging.sendToUI({ clientId, data });
84
+ }
85
+ /**
86
+ * @param scope notification scope
87
+ * @param category notification category
88
+ * @param message notification message
89
+ * @param options additional notification options
90
+ */
91
+ async registerNotification(scope, category, message, options) {
92
+ Validator.assertString(scope, 'scope');
93
+ if (category !== null) {
94
+ Validator.assertString(category, 'category');
95
+ }
96
+ Validator.assertString(message, 'message');
97
+ if (options !== undefined) {
98
+ Validator.assertObject(options, 'options');
99
+ }
100
+ return this.#messaging.registerNotification(scope, category, message, options);
101
+ }
102
+ /**
103
+ * @param publicName public certificate name
104
+ * @param privateName private key name
105
+ * @param chainedName chained certificate name
106
+ */
107
+ async getCertificates(publicName, privateName, chainedName) {
108
+ const config = this.#ctx.config;
109
+ publicName = publicName || config.certPublic;
110
+ privateName = privateName || config.certPrivate;
111
+ chainedName = chainedName || config.certChained;
112
+ if (publicName !== undefined) {
113
+ Validator.assertString(publicName, 'publicName');
114
+ }
115
+ if (privateName !== undefined) {
116
+ Validator.assertString(privateName, 'privateName');
117
+ }
118
+ if (chainedName !== undefined) {
119
+ Validator.assertString(chainedName, 'chainedName');
120
+ }
121
+ return this.#certificates.getCertificates({ publicName, privateName, chainedName });
122
+ }
123
+ /**
124
+ * Tells whether a new version of the `system.certificates` object changes one of the certificates
125
+ * handed out by the last {@link getCertificates} call. Returns false if certificates were never
126
+ * requested, so unrelated certificate edits do not concern this adapter.
127
+ *
128
+ * @param obj the new `system.certificates` object, or null/undefined if it was deleted
129
+ */
130
+ hasRelevantCertificateChange(obj) {
131
+ return this.#certificatesInstance?.hasRelevantChange(obj) ?? false;
132
+ }
133
+ /**
134
+ * Forgets the certificates handed out by the last {@link getCertificates} call, so
135
+ * {@link hasRelevantCertificateChange} no longer reports changes to them. Used when the adapter
136
+ * stops watching its certificates.
137
+ */
138
+ stopWatchingCertificates() {
139
+ this.#certificatesInstance?.stopWatching();
140
+ }
141
+ /**
142
+ * Resolves a pending reply promise for an acked messagebox message.
143
+ * Returns true if a pending entry was found and consumed.
144
+ *
145
+ * @param obj incoming message object from the messagebox
146
+ */
147
+ resolveReply(obj) {
148
+ return this.#messagingInstance?.resolveCallback(obj) ?? false;
149
+ }
150
+ /**
151
+ * Rejects all pending reply promises and clears their timers (used on stop).
152
+ */
153
+ clearPending() {
154
+ this.#messagingInstance?.clearPendingCallbacks();
155
+ }
156
+ }
157
+ //# sourceMappingURL=asyncAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asyncAdapter.js","sourceRoot":"","sources":["../../../../src/lib/adapter/asyncAdapter.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,YAAY;IACZ,IAAI,CAAiB;IAC9B,kBAAkB,CAAoB;IACtC,qBAAqB,CAAsB;IAE3C;;OAEG;IACH,YAAY,GAAmB;QAC3B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED,qDAAqD;IACrD,IAAI,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,kBAAkB,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,8CAA8C;IAC9C,IAAI,aAAa;QACb,OAAO,CAAC,IAAI,CAAC,qBAAqB,KAAK,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,CAAC;IA4BD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,YAAqB,EAAE,OAAgB,EAAE,OAAiB,EAAE,OAAiB;QACtF,SAAS,CAAC,YAAY,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrD,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC3C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS,CAAC,YAAY,CACl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C,WAAW,CAAC;QAEhD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAS,CAAC,YAAY,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;OAMG;IACH,4BAA4B,CAAC,GAA4C;QACrE,OAAO,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,wBAAwB;QACpB,IAAI,CAAC,qBAAqB,EAAE,YAAY,EAAE,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,GAAqB;QAC9B,OAAO,IAAI,CAAC,kBAAkB,EAAE,eAAe,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,YAAY;QACR,IAAI,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,CAAC;IACrD,CAAC;CACJ"}
@@ -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 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapter/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mDAAmD,CAAC;AAE1G;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;IACxD,gCAAgC;IAChC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1D,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,GAAG,SAAS,CAAC;IACrD,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,aAAa,CAAC;IACxC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAC1C,oDAAoD;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sBAAsB;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;IAChC,kCAAkC;IAClC,QAAQ,CAAC,qBAAqB,EAAE,gCAAgC,CAAC;IACjE,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC;CACpC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/lib/adapter/context.ts"],"names":[],"mappings":""}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"defaultObjs.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapter/defaultObjs.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CA0C9E"}
1
+ {"version":3,"file":"defaultObjs.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapter/defaultObjs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CA0C9E"}
@@ -1,3 +1,8 @@
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 function createDefaults() {
2
7
  return {
3
8
  'level.dimmer': {
@@ -1 +1 @@
1
- {"version":3,"file":"defaultObjs.js","sourceRoot":"","sources":["../../../../src/lib/adapter/defaultObjs.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc;IAC1B,OAAO;QACH,cAAc,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;SACZ;QACD,mBAAmB,EAAE;YACjB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;SACf;QACD,uBAAuB,EAAE;YACrB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;SACf;QACD,8BAA8B,EAAE;YAC5B,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,aAAa;SACtB;QACD,+BAA+B,EAAE;YAC7B,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,oBAAoB;SAC7B;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;SACd;KACK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"defaultObjs.js","sourceRoot":"","sources":["../../../../src/lib/adapter/defaultObjs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC1B,OAAO;QACH,cAAc,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,CAAC;YACN,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,GAAG;SACZ;QACD,mBAAmB,EAAE;YACjB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;SACf;QACD,uBAAuB,EAAE;YACrB,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;SACf;QACD,8BAA8B,EAAE;YAC5B,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,aAAa;SACtB;QACD,+BAA+B,EAAE;YAC7B,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,oBAAoB;SAC7B;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,IAAI;SACd;KACK,CAAC;AACf,CAAC"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapter/log.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,GAAI,YAAW,QAAQ,CAAC,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAElC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAMrB;IAEF;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG;IAgBvE,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIvB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG1B"}
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/lib/adapter/log.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,qBAAa,GAAI,YAAW,QAAQ,CAAC,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAElC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAMrB;IAEF;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG;IAgBvE;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIvB;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxB;;;;OAIG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG1B"}
@@ -28,18 +28,43 @@ export class Log {
28
28
  this.error = this.error.bind(this);
29
29
  this.warn = this.warn.bind(this);
30
30
  }
31
+ /**
32
+ * Log a message at the silly level, prefixed with the adapter namespace
33
+ *
34
+ * @param msg the message to log
35
+ */
31
36
  silly(msg) {
32
37
  this.logger.silly(`${this.namespaceLog} ${msg}`);
33
38
  }
39
+ /**
40
+ * Log a message at the debug level, prefixed with the adapter namespace
41
+ *
42
+ * @param msg the message to log
43
+ */
34
44
  debug(msg) {
35
45
  this.logger.debug(`${this.namespaceLog} ${msg}`);
36
46
  }
47
+ /**
48
+ * Log a message at the info level, prefixed with the adapter namespace
49
+ *
50
+ * @param msg the message to log
51
+ */
37
52
  info(msg) {
38
53
  this.logger.info(`${this.namespaceLog} ${msg}`);
39
54
  }
55
+ /**
56
+ * Log a message at the error level, prefixed with the adapter namespace
57
+ *
58
+ * @param msg the message to log
59
+ */
40
60
  error(msg) {
41
61
  this.logger.error(`${this.namespaceLog} ${msg}`);
42
62
  }
63
+ /**
64
+ * Log a message at the warn level, prefixed with the adapter namespace
65
+ *
66
+ * @param msg the message to log
67
+ */
43
68
  warn(msg) {
44
69
  this.logger.warn(`${this.namespaceLog} ${msg}`);
45
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../src/lib/adapter/log.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,GAAG;IACK,YAAY,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,GAAW;QACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,GAAW;QACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAW;QACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,GAAW;QACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC,CAAC;IACpD,CAAC;CACJ"}
@@ -0,0 +1,49 @@
1
+ import type { Client as StatesInRedisClient } from '@iobroker/db-states-redis';
2
+ import type { Client as ObjectsInRedisClient } from '@iobroker/db-objects-redis';
3
+ import type { AdapterContext } from '../../../lib/adapter/context.js';
4
+ /**
5
+ * Base class for adapter managers that read from the shared {@link AdapterContext}.
6
+ *
7
+ * Holds the context in a private `#ctx` field so subclasses cannot bypass the connection-checked
8
+ * getters and reach the raw (possibly null) DB clients directly. Access to `states`/`objects` goes
9
+ * through the throwing getters, which raise `ERROR_DB_CLOSED` when the respective database is not
10
+ * connected; the other getters pass ctx values through unchanged.
11
+ *
12
+ * Getters are `protected` because `#` privates are not visible to subclasses.
13
+ */
14
+ export declare abstract class AdapterContextBase {
15
+ #private;
16
+ /**
17
+ * @param ctx Shared adapter context providing live runtime state
18
+ */
19
+ constructor(ctx: AdapterContext);
20
+ /**
21
+ * The connected states DB client.
22
+ *
23
+ * @throws {Error} `ERROR_DB_CLOSED` when the states database is not connected.
24
+ */
25
+ protected get states(): StatesInRedisClient;
26
+ /**
27
+ * The connected objects DB client.
28
+ *
29
+ * @throws {Error} `ERROR_DB_CLOSED` when the objects database is not connected.
30
+ */
31
+ protected get objects(): ObjectsInRedisClient;
32
+ /** Current adapter common config */
33
+ protected get common(): ioBroker.InstanceCommon | undefined;
34
+ /** Current adapter instance config (native) */
35
+ protected get config(): ioBroker.AdapterConfig;
36
+ /** Current host name (may be undefined before init) */
37
+ protected get host(): string | undefined;
38
+ /** Current adapter namespace, e.g. `"adapter.0"` */
39
+ protected get namespace(): `${string}.${number}`;
40
+ /** Current namespace string used in log messages */
41
+ protected get namespaceLog(): string;
42
+ /** Logger instance */
43
+ protected get logger(): AdapterContext['logger'];
44
+ /** Controller for UI messaging */
45
+ protected get uiMessagingController(): AdapterContext['uiMessagingController'];
46
+ /** Increment the adapter's outbound-write counter. */
47
+ protected countOutput(): void;
48
+ }
49
+ //# sourceMappingURL=AdapterContextBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdapterContextBase.d.ts","sourceRoot":"","sources":["../../../../../src/lib/adapter/managers/AdapterContextBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D;;;;;;;;;GASG;AACH,8BAAsB,kBAAkB;;IAGpC;;OAEG;gBACS,GAAG,EAAE,cAAc;IAI/B;;;;OAIG;IACH,SAAS,KAAK,MAAM,IAAI,mBAAmB,CAM1C;IAED;;;;OAIG;IACH,SAAS,KAAK,OAAO,IAAI,oBAAoB,CAM5C;IAED,oCAAoC;IACpC,SAAS,KAAK,MAAM,IAAI,QAAQ,CAAC,cAAc,GAAG,SAAS,CAE1D;IAED,+CAA+C;IAC/C,SAAS,KAAK,MAAM,IAAI,QAAQ,CAAC,aAAa,CAE7C;IAED,uDAAuD;IACvD,SAAS,KAAK,IAAI,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED,oDAAoD;IACpD,SAAS,KAAK,SAAS,IAAI,GAAG,MAAM,IAAI,MAAM,EAAE,CAE/C;IAED,oDAAoD;IACpD,SAAS,KAAK,YAAY,IAAI,MAAM,CAEnC;IAED,sBAAsB;IACtB,SAAS,KAAK,MAAM,IAAI,cAAc,CAAC,QAAQ,CAAC,CAE/C;IAED,kCAAkC;IAClC,SAAS,KAAK,qBAAqB,IAAI,cAAc,CAAC,uBAAuB,CAAC,CAE7E;IAED,sDAAsD;IACtD,SAAS,CAAC,WAAW,IAAI,IAAI;CAGhC"}
@@ -0,0 +1,77 @@
1
+ import { tools } from '@iobroker/js-controller-common';
2
+ /**
3
+ * Base class for adapter managers that read from the shared {@link AdapterContext}.
4
+ *
5
+ * Holds the context in a private `#ctx` field so subclasses cannot bypass the connection-checked
6
+ * getters and reach the raw (possibly null) DB clients directly. Access to `states`/`objects` goes
7
+ * through the throwing getters, which raise `ERROR_DB_CLOSED` when the respective database is not
8
+ * connected; the other getters pass ctx values through unchanged.
9
+ *
10
+ * Getters are `protected` because `#` privates are not visible to subclasses.
11
+ */
12
+ export class AdapterContextBase {
13
+ #ctx;
14
+ /**
15
+ * @param ctx Shared adapter context providing live runtime state
16
+ */
17
+ constructor(ctx) {
18
+ this.#ctx = ctx;
19
+ }
20
+ /**
21
+ * The connected states DB client.
22
+ *
23
+ * @throws {Error} `ERROR_DB_CLOSED` when the states database is not connected.
24
+ */
25
+ get states() {
26
+ const states = this.#ctx.states;
27
+ if (!states) {
28
+ throw new Error(tools.ERRORS.ERROR_DB_CLOSED);
29
+ }
30
+ return states;
31
+ }
32
+ /**
33
+ * The connected objects DB client.
34
+ *
35
+ * @throws {Error} `ERROR_DB_CLOSED` when the objects database is not connected.
36
+ */
37
+ get objects() {
38
+ const objects = this.#ctx.objects;
39
+ if (!objects) {
40
+ throw new Error(tools.ERRORS.ERROR_DB_CLOSED);
41
+ }
42
+ return objects;
43
+ }
44
+ /** Current adapter common config */
45
+ get common() {
46
+ return this.#ctx.common;
47
+ }
48
+ /** Current adapter instance config (native) */
49
+ get config() {
50
+ return this.#ctx.config;
51
+ }
52
+ /** Current host name (may be undefined before init) */
53
+ get host() {
54
+ return this.#ctx.host;
55
+ }
56
+ /** Current adapter namespace, e.g. `"adapter.0"` */
57
+ get namespace() {
58
+ return this.#ctx.namespace;
59
+ }
60
+ /** Current namespace string used in log messages */
61
+ get namespaceLog() {
62
+ return this.#ctx.namespaceLog;
63
+ }
64
+ /** Logger instance */
65
+ get logger() {
66
+ return this.#ctx.logger;
67
+ }
68
+ /** Controller for UI messaging */
69
+ get uiMessagingController() {
70
+ return this.#ctx.uiMessagingController;
71
+ }
72
+ /** Increment the adapter's outbound-write counter. */
73
+ countOutput() {
74
+ this.#ctx.countOutput();
75
+ }
76
+ }
77
+ //# sourceMappingURL=AdapterContextBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdapterContextBase.js","sourceRoot":"","sources":["../../../../../src/lib/adapter/managers/AdapterContextBase.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,OAAgB,kBAAkB;IAC3B,IAAI,CAAiB;IAE9B;;OAEG;IACH,YAAY,GAAmB;QAC3B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,IAAc,MAAM;QAChB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACH,IAAc,OAAO;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC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