@iobroker/types 7.2.4 → 7.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/shared.d.ts CHANGED
@@ -293,6 +293,22 @@ declare global {
293
293
  message: MessagePayload;
294
294
  /** The source of this message */
295
295
  from: string;
296
+ /**
297
+ * The user this message is sent on behalf of, if the sender named one (`options.user` of
298
+ * `sendTo`/`sendToHost`). A socket server such as `admin` or `web` puts the authenticated
299
+ * user of the connection here, so the receiving instance can check what that user may do
300
+ * instead of acting with its own rights.
301
+ *
302
+ * It is only as trustworthy as `from`: every instance can claim any user here, and all of
303
+ * them run with full database rights anyway. Trust it when `from` is an instance you trust
304
+ * to have authenticated the user, and never as a substitute for your own permission check.
305
+ *
306
+ * Set from js-controller 7.2.5 on; an older one never sets it. A message that was sent
307
+ * without a user does not carry the field at all, so the absence of the field means
308
+ * "nobody was named" - for whichever of the two reasons, and in both cases there is
309
+ * nothing to check against.
310
+ */
311
+ user?: ioBroker.ObjectIDs.User;
296
312
  /** Callback information. This is set when the source expects a response */
297
313
  callback?: MessageCallbackInfo;
298
314
  }
package/build/types.d.ts CHANGED
@@ -166,7 +166,7 @@ export declare interface AdapterClass {
166
166
  * Sends a message to a specific host or all hosts.
167
167
  */
168
168
  sendToHostAsync(hostName: string, message: ioBroker.MessagePayload): Promise<ioBroker.Message | undefined>;
169
- sendToHostAsync(hostName: string, command: string, message: ioBroker.MessagePayload): Promise<ioBroker.Message | undefined>;
169
+ sendToHostAsync(hostName: string, command: string, message: ioBroker.MessagePayload, options?: SendToOptions): Promise<ioBroker.Message | undefined>;
170
170
  /**
171
171
  * Sends a message to a specific instance or all instances of some specific adapter.
172
172
  */
@@ -714,7 +714,7 @@ export declare class AdapterClass extends EventEmitter {
714
714
  sendTo(instanceName: string, command: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo, options?: SendToOptions): void;
715
715
  private _sendTo;
716
716
  sendToHost(hostName: string | null, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
717
- sendToHost(hostName: string | null, command: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
717
+ sendToHost(hostName: string | null, command: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo, options?: SendToOptions): void;
718
718
  private _sendToHost;
719
719
  sendToUI(options: SendToUserInterfaceClientOptions): Promise<void>;
720
720
  registerNotification<Scope extends keyof ioBroker.NotificationScopes>(scope: Scope, category: ioBroker.NotificationScopes[Scope] | null, message: string, options?: NotificationOptions): Promise<void>;
@@ -1257,6 +1257,7 @@ export declare interface InternalSendToHostOptions {
1257
1257
  command: string;
1258
1258
  message: any;
1259
1259
  callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo;
1260
+ options?: SendToOptions;
1260
1261
  }
1261
1262
 
1262
1263
  export declare interface InternalSendToOptions {
@@ -1378,6 +1379,8 @@ declare type Pattern_2 = string | string[];
1378
1379
  export declare interface SendToOptions {
1379
1380
  /** Method throws or calls error cb, if callback not called in time, works for single targets only */
1380
1381
  timeout?: number;
1382
+ /** The user on whose behalf the message is sent */
1383
+ user?: ioBroker.ObjectIDs.User;
1381
1384
  }
1382
1385
 
1383
1386
  export declare interface SendToUserInterfaceClientOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/types",
3
- "version": "7.2.4",
3
+ "version": "7.2.5",
4
4
  "engines": {
5
5
  "node": ">=12.0.0"
6
6
  },
@@ -41,5 +41,5 @@
41
41
  ]
42
42
  }
43
43
  },
44
- "gitHead": "1849f5d9d69ad07fdf61f7d132ddc6ee9824a394"
44
+ "gitHead": "9bc56bf00b9eedf53f0028d88c1e19d6d769615a"
45
45
  }