@interopio/desktop 6.2.2 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -1,3 +1,16 @@
1
+ 6.4.0
2
+ - feat: channels - add support for channel restrictions
3
+ - chore: update types
4
+ - chore: update schemas to 9.3.0 (was 9.2.0)
5
+ 6.3.1
6
+ - chore: update core to 6.2.1 (was 6.1.0)
7
+ 6.3.0
8
+ - feat: notifications - add support for snooze
9
+ - feat: windows - add showPopup method to the group object
10
+ - feat: windows - two new methods - create and close group
11
+ - feat: appManager - introduce new method - instance.startedBy
12
+ - feat: channels - introduce new methods - restrict, restrictAll, getRestrictions
13
+ - chore: prefs - fix typings - getAll
1
14
  6.2.2
2
15
  - feat: notifications - click method now accepts a third optional argument - options
3
16
  6.2.1
package/desktop.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-shadow */
2
- import { ApplicationConfig } from "@glue42/schemas";
2
+ import { ApplicationConfig } from "@interopio/schemas";
3
3
  import { IOConnectCore } from "@interopio/core";
4
4
  import { IOConnectWorkspaces } from "@interopio/workspaces-api";
5
5
  import { UnsubscribeFunction } from "callback-registry";
@@ -1070,7 +1070,7 @@ export declare namespace IOConnectDesktop {
1070
1070
  * Retrieves an app by name.
1071
1071
  * @param name Name of the desired app.
1072
1072
  */
1073
- application(name: string): Application;
1073
+ application(name: string): Application | undefined;
1074
1074
 
1075
1075
  /**
1076
1076
  * Retrieves a collection of the available apps.
@@ -1513,6 +1513,12 @@ export declare namespace IOConnectDesktop {
1513
1513
  */
1514
1514
  getWindow(): Promise<Windows.IOConnectWindow>;
1515
1515
 
1516
+ /**
1517
+ * Retrieves information about how the current app instance was started, and about the identity of the initiator.
1518
+ * @since io.Connect Desktop 9.3
1519
+ */
1520
+ startedBy(): Promise<StartedByInfo>;
1521
+
1516
1522
  /**
1517
1523
  * Notifies when the Interop library is ready to be used.
1518
1524
  * @param callback Callback function for handling the event.
@@ -1533,6 +1539,26 @@ export declare namespace IOConnectDesktop {
1533
1539
  onStopped(callback: (instance: Instance) => any): UnsubscribeFunction;
1534
1540
  }
1535
1541
 
1542
+ /**
1543
+ * Describes how the current app instance was started and provides details about the app that started it.
1544
+ */
1545
+ export interface StartedByInfo {
1546
+ /**
1547
+ * Indicates how the current app instance was started. Apps can be started by other apps, by a raised Intent, or can be auto started by the system.
1548
+ */
1549
+ startedBy: "application" | "intent" | "autoStart";
1550
+
1551
+ /**
1552
+ * Name of the app that started the current app instance.
1553
+ */
1554
+ applicationName: string;
1555
+
1556
+ /**
1557
+ * ID of the app instance that started the current app instance.
1558
+ */
1559
+ instanceID: string;
1560
+ }
1561
+
1536
1562
  /**
1537
1563
  * @ignore
1538
1564
  */
@@ -1588,6 +1614,16 @@ export declare namespace IOConnectDesktop {
1588
1614
  * @default false
1589
1615
  */
1590
1616
  ignoreSavedLayout?: boolean;
1617
+
1618
+ /**
1619
+ * Key/value pairs that will be merged with the `process.env` object when spawning a new process for an executable app from the Node.js environment.
1620
+ */
1621
+ env?: Record<string, (string)>;
1622
+
1623
+ /**
1624
+ * Optional parameters that will be passed to the executable app that is to be started. The value will be used as is and no validation will be performed on it.
1625
+ */
1626
+ parameters?: string;
1591
1627
  }
1592
1628
 
1593
1629
  /**
@@ -2626,16 +2662,23 @@ export declare namespace IOConnectDesktop {
2626
2662
  borderColor?: string;
2627
2663
 
2628
2664
  /**
2629
- * Name of the Channel which the window will join.
2665
+ * Deprecated. Use `channelSelector` instead. Name of the Channel which the window will join.
2666
+ * @ignore
2630
2667
  */
2631
2668
  channelId?: string;
2632
2669
 
2633
2670
  /**
2634
- * If `true`, Channels will be enabled for the window and it will show the Channel Selector.
2671
+ * Deprecated. Use `channelSelector` instead. If `true`, Channels will be enabled for the window and it will show the Channel Selector.
2635
2672
  * @default false
2673
+ * @ignore
2636
2674
  */
2637
2675
  allowChannels?: boolean;
2638
2676
 
2677
+ /**
2678
+ * Settings for the Channel Selector UI.
2679
+ */
2680
+ channelSelector?: ChannelSelector;
2681
+
2639
2682
  /**
2640
2683
  * Defines the height of the window when collapsed.
2641
2684
  * @default -1
@@ -2926,6 +2969,36 @@ export declare namespace IOConnectDesktop {
2926
2969
  preloadScripts?: string[];
2927
2970
  }
2928
2971
 
2972
+ /**
2973
+ * Settings for the Channel Selector UI.
2974
+ */
2975
+ export interface ChannelSelector {
2976
+ /**
2977
+ * If `true`, will allow showing the Channel Selector.
2978
+ * @default false
2979
+ */
2980
+ enabled?: boolean;
2981
+
2982
+ /**
2983
+ * Type of the Channel Selector to show on the io.Connect Windows. A single Channel Selector (default) allows the window to join a single Channel
2984
+ * to which it can subscribe and publish data unrestrictedly. A directional single Channel Selector allows the window to join a single Channel,
2985
+ * but also enables the user to restrict the window from publishing or from subscribing to the current Channel.
2986
+ * @default "single"
2987
+ */
2988
+ type?: "single" | "directionalSingle";
2989
+
2990
+ /**
2991
+ * Name of the Channel to which the window will be joined by default when it's started.
2992
+ */
2993
+ channelId: string;
2994
+
2995
+ /**
2996
+ * If `true`, the Channel Selector will be visible, but the user won't be able to switch between Channels from it.
2997
+ * @default false
2998
+ */
2999
+ readOnly: boolean;
3000
+ }
3001
+
2929
3002
  /**
2930
3003
  * Options for loading a window URL.
2931
3004
  */
@@ -2946,8 +3019,7 @@ export declare namespace IOConnectDesktop {
2946
3019
  extraHeaders?: string;
2947
3020
 
2948
3021
  /**
2949
- * Data for the POST request. Either an array of `UploadFile` objects describing the location and other properties of the file to upload,
2950
- * or an array of `UploadBase64Data` objects containing data encoded as a Base64 string.
3022
+ * Data for the POST request. The list can contain both `UploadFile` objects (describing the location and other properties of the file to upload) and `UploadBase64Data` objects (containing data encoded as a Base64 string).
2951
3023
  */
2952
3024
  postData?: ((UploadBase64Data) | (UploadFile))[];
2953
3025
 
@@ -2955,6 +3027,11 @@ export declare namespace IOConnectDesktop {
2955
3027
  * Base URL for files loaded by a data URL. Must end with a trailing path separator. This property is necessary only when the loaded URL is a data URL.
2956
3028
  */
2957
3029
  baseURLForDataURL?: string;
3030
+
3031
+ /**
3032
+ * Query string that will be appended to the URL when starting the app. If the string doesn't start with a `?`, one will be prepended to it. Note that the query string must be URL encoded.
3033
+ */
3034
+ queryString?: string;
2958
3035
  }
2959
3036
 
2960
3037
  /**
@@ -4133,6 +4210,66 @@ export declare namespace IOConnectDesktop {
4133
4210
  showDialog?: boolean
4134
4211
  }
4135
4212
 
4213
+ /**
4214
+ * Options for creating window groups.
4215
+ */
4216
+ export interface CreateGroupsOptions {
4217
+ /**
4218
+ * List of window groups to be created.
4219
+ */
4220
+ groups: GroupDefinition[];
4221
+ /**
4222
+ * Context for the created window groups.
4223
+ */
4224
+ context?: unknown;
4225
+ }
4226
+
4227
+ /**
4228
+ * Describes a window group that will be created.
4229
+ */
4230
+ export interface GroupDefinition {
4231
+ /**
4232
+ * Title for the created window group.
4233
+ */
4234
+ title?: string;
4235
+ /**
4236
+ * State for the created window group.
4237
+ */
4238
+ state?: string;
4239
+ /**
4240
+ * List of window frames that will be part of the created window group.
4241
+ */
4242
+ frames: FrameDefinition[];
4243
+ }
4244
+
4245
+ /**
4246
+ * Describes a window frame that will be part of a created window group.
4247
+ */
4248
+ export interface FrameDefinition {
4249
+ /**
4250
+ * Bounds for the window frame.
4251
+ */
4252
+ bounds: Bounds;
4253
+ /**
4254
+ * Mode for the window frame.
4255
+ */
4256
+ mode?: WindowMode;
4257
+ /**
4258
+ * List of objects containing the names of the apps to be started and loaded in the window frames of the created window group, as well as additional app settings.
4259
+ */
4260
+ applications: CreateGroupApplicationOptions[];
4261
+ }
4262
+
4263
+ /**
4264
+ * Options for the app that will be started and loaded in a window frame of a created window group.
4265
+ */
4266
+ export interface CreateGroupApplicationOptions extends IOConnectDesktop.Windows.WindowSettings {
4267
+ /**
4268
+ * App name as specified in its definition.
4269
+ */
4270
+ name: string;
4271
+ }
4272
+
4136
4273
  /**
4137
4274
  * API for managing window groups.
4138
4275
  */
@@ -4142,6 +4279,21 @@ export declare namespace IOConnectDesktop {
4142
4279
  */
4143
4280
  my: Group;
4144
4281
 
4282
+ /**
4283
+ * Creates window groups.
4284
+ * @param options Options for creating window groups.
4285
+ * @since io.Connect Desktop 9.3
4286
+ */
4287
+ create(options: CreateGroupsOptions): Promise<Group[]>;
4288
+
4289
+ /**
4290
+ * Closes a window group.
4291
+ * @param group The `Group` object or the ID of the window group to be closed.
4292
+ * @param options Options for closing the group that can be used to prevent closing the group and control whether to show a confirmation dialog before closing it.
4293
+ * @since io.Connect Desktop 9.3
4294
+ */
4295
+ close(group: Group | string, options?: CloseOptions): Promise<void>;
4296
+
4145
4297
  /**
4146
4298
  * Lists all window groups.
4147
4299
  * @param success Callback function for handling the successfully returned result.
@@ -4162,6 +4314,12 @@ export declare namespace IOConnectDesktop {
4162
4314
  */
4163
4315
  waitForGroup(groupId: string): Promise<IOConnectDesktop.Windows.Group>;
4164
4316
 
4317
+ /**
4318
+ * Retrieves the current window group.
4319
+ * @since io.Connect Desktop 9.3
4320
+ */
4321
+ getMyGroup(): Promise<IOConnectDesktop.Windows.Group>;
4322
+
4165
4323
  /**
4166
4324
  * Hibernates a window group.
4167
4325
  * @param groupId ID of the window group to hibernate.
@@ -4254,6 +4412,11 @@ export declare namespace IOConnectDesktop {
4254
4412
  */
4255
4413
  message: string;
4256
4414
 
4415
+ /**
4416
+ * Title for the message that will be displayed in the dialog.
4417
+ */
4418
+ messageTitle: string;
4419
+
4257
4420
  /**
4258
4421
  * If `true`, the user will be able to move the dialog.
4259
4422
  * @default true
@@ -4267,7 +4430,7 @@ export declare namespace IOConnectDesktop {
4267
4430
  transparent?: boolean;
4268
4431
 
4269
4432
  /**
4270
- * Title for the dialog to show.
4433
+ * Title for the dialog that will be displayed in the dialog header.
4271
4434
  */
4272
4435
  title?: string;
4273
4436
 
@@ -4445,7 +4608,7 @@ export declare namespace IOConnectDesktop {
4445
4608
  * @param window Window ID or a window object by which to find a window in the group.
4446
4609
  * @param success Callback function for handling the successfully returned result.
4447
4610
  */
4448
- find(window: string | IOConnectWindow, success?: (window: IOConnectWindow) => void): IOConnectWindow;
4611
+ find(window: string | IOConnectWindow, success?: (window: IOConnectWindow) => void): IOConnectWindow | undefined;
4449
4612
 
4450
4613
  /**
4451
4614
  * Restores a window group.
@@ -4492,7 +4655,6 @@ export declare namespace IOConnectDesktop {
4492
4655
  */
4493
4656
  capture(options?: CaptureOptions): Promise<string>;
4494
4657
 
4495
-
4496
4658
  /**
4497
4659
  * Shows a previously hidden window group.
4498
4660
  * @param activate Flag indicating whether to activate the group and focus the last focused app window.
@@ -4504,6 +4666,20 @@ export declare namespace IOConnectDesktop {
4504
4666
  */
4505
4667
  hide(): Promise<void>;
4506
4668
 
4669
+ /**
4670
+ * Closes the window group.
4671
+ * @param options Options for closing the group that can be used to prevent closing the group and control whether to show a confirmation dialog before closing it.
4672
+ * @since io.Connect Desktop 9.3
4673
+ */
4674
+ close(options?: CloseOptions): Promise<void>;
4675
+
4676
+ /**
4677
+ * Creates a popup window.
4678
+ * @param config Options for creating a popup window.
4679
+ * @since io.Connect Desktop 9.3
4680
+ */
4681
+ showPopup(config: PopupOptions): Promise<void>;
4682
+
4507
4683
  /**
4508
4684
  * Notifies when the visibility of the window group header is changed.
4509
4685
  * @param callback Callback function for handling the event.
@@ -4548,7 +4724,7 @@ export declare namespace IOConnectDesktop {
4548
4724
  /**
4549
4725
  * Retrieves the current window.
4550
4726
  */
4551
- my(): IOConnectWindow;
4727
+ my(): IOConnectWindow | undefined;
4552
4728
 
4553
4729
  /**
4554
4730
  * Opens a new io.Connect Window.
@@ -4566,7 +4742,7 @@ export declare namespace IOConnectDesktop {
4566
4742
  * @param success Callback function for handling the successfully returned result.
4567
4743
  * @param error Callback function for handling errors.
4568
4744
  */
4569
- find(name: string, success?: (window: IOConnectWindow) => void, error?: (error: string) => void): IOConnectWindow;
4745
+ find(name: string, success?: (window: IOConnectWindow) => void, error?: (error: string) => void): IOConnectWindow | undefined;
4570
4746
 
4571
4747
  /**
4572
4748
  * Finds a window by ID.
@@ -4574,7 +4750,7 @@ export declare namespace IOConnectDesktop {
4574
4750
  * @param success Callback function for handling the successfully returned result.
4575
4751
  * @param error Callback function for handling errors.
4576
4752
  */
4577
- findById(id: string, success?: (window: IOConnectWindow) => void, error?: (error: string) => void): IOConnectWindow;
4753
+ findById(id: string, success?: (window: IOConnectWindow) => void, error?: (error: string) => void): IOConnectWindow | undefined;
4578
4754
 
4579
4755
  /**
4580
4756
  * Lists all windows.
@@ -5841,6 +6017,27 @@ export declare namespace IOConnectDesktop {
5841
6017
  */
5842
6018
  getWindowsWithChannels(filter?: WindowWithChannelFilter): Promise<WindowOnChannelInfo[]>;
5843
6019
 
6020
+ /**
6021
+ * Prevents or allows the current or another window to publish or subscribe to a specific Channel.
6022
+ * @param restrictions Restrictions for publishing or subscribing to a specific Channel.
6023
+ * @since io.Connect Desktop 9.3
6024
+ */
6025
+ restrict(restrictions: ChannelRestrictions): Promise<void>;
6026
+
6027
+ /**
6028
+ * Prevents or allows the current or another window to publish or subscribe to all Channels.
6029
+ * @param restrictions Restrictions for publishing or subscribing to all Channels.
6030
+ * @since io.Connect Desktop 9.3
6031
+ */
6032
+ restrictAll(restrictions: RestrictionsConfig): Promise<void>;
6033
+
6034
+ /**
6035
+ * Retrieves the restrictions applied to the current window for publishing or subscribing to Channels. Pass a window ID to retrieve the restrictions for the specified window.
6036
+ * @param windowId ID of the window for which to retrieve the applied restrictions for publishing or subscribing to Channels.
6037
+ * @since io.Connect Desktop 9.3
6038
+ */
6039
+ getRestrictions(windowId?: string): Promise<Restrictions>;
6040
+
5844
6041
  /**
5845
6042
  * Notifies when a Channel is changed.
5846
6043
  * @param callback Callback function for handling the event.
@@ -5914,6 +6111,44 @@ export declare namespace IOConnectDesktop {
5914
6111
  */
5915
6112
  data: any;
5916
6113
  }
6114
+
6115
+ /**
6116
+ * All restrictions applied to a window for publishing or subscribing to Channels.
6117
+ */
6118
+ export interface Restrictions {
6119
+ /**
6120
+ * List of restrictions for publishing or subscribing to Channels.
6121
+ */
6122
+ channels: ChannelRestrictions[];
6123
+ }
6124
+
6125
+ /**
6126
+ * Restrictions applied to a window for publishing or subscribing to a specific Channel.
6127
+ */
6128
+ export interface ChannelRestrictions extends RestrictionsConfig {
6129
+ /**
6130
+ * Name of the Channel for which the restrictions apply.
6131
+ */
6132
+ name: string;
6133
+ }
6134
+
6135
+ /**
6136
+ * Restrictions applied to a window for publishing or subscribing to all Channels.
6137
+ */
6138
+ export interface RestrictionsConfig {
6139
+ /**
6140
+ * If `true`, the window will be able to subscribe to the specified Channel.
6141
+ */
6142
+ read: boolean;
6143
+ /**
6144
+ * If `true`, the window will be able to publish to the specified Channel.
6145
+ */
6146
+ write: boolean;
6147
+ /**
6148
+ * ID of the window for which apply the restrictions for publishing or subscribing to Channels.
6149
+ */
6150
+ windowId?: string;
6151
+ }
5917
6152
  }
5918
6153
 
5919
6154
  /**
@@ -6496,6 +6731,13 @@ export declare namespace IOConnectDesktop {
6496
6731
  */
6497
6732
  updateData(id: string, data: unknown): Promise<void>;
6498
6733
 
6734
+ /**
6735
+ * Snoozes a notification.
6736
+ * @param id ID of the notification to snooze.
6737
+ * @param duration Interval in milliseconds for which to snooze the notification.
6738
+ */
6739
+ snooze(id: string, duration: number): Promise<void>;
6740
+
6499
6741
  /**
6500
6742
  * Notifies when a new notification is raised.
6501
6743
  * @param callback Callback function for handling the event.
@@ -6621,15 +6863,16 @@ export declare namespace IOConnectDesktop {
6621
6863
  }
6622
6864
 
6623
6865
  /**
6624
- * Notification state.
6625
- * - `"Active"` - based on configuration, the notification is either visible as a toast, or is raised only in the Notification Panel, but the user hasn't seen it yet.
6626
- * When the toast is hidden, the user clicks on the toast, or sees the notification in the Notification Panel, the state will change;
6627
- * - `"Acknowledged"` - the user has seen the notification in the Notification Panel;
6628
- * - `"Closed"` - the notification has either been closed from its "Close" button, or the user has clicked on it or on an action in it;
6629
- * - `"Stale"` - the time specified in `toastExpiry` has elapsed;
6866
+ * Notification states that are used by the platform when handling notifications. These states can also be used in your custom logic for processing notifications on the client or on the server side. Defaults to `"Active"`.
6867
+ * - `"Active"` - a notification can be marked as active when it is raised, but the user hasn't seen it, or interacted in any way with it yet;
6868
+ * - `"Acknowledged"` - a notification can be marked as acknowledged when the user has interacted with it by clicking on the notification or on an action in it;
6869
+ * - `"Seen"` - a notification can be marked as seen when the user has seen it (e.g., by opening the Notification Panel);
6870
+ * - `"Closed"` - a notification can be marked as closed when the user has closed the notification in the Notification Panel;
6871
+ * - `"Stale"` - a notification can be marked as stale after a predefined period of time;
6872
+ * - `"Snoozed"` - a notification can be marked as snoozed when the user snoozes it from the UI;
6873
+ * - `"Processing"` - a notification can be marked as `"Processing"` when its state is in the process of changing (e.g., the user interacts with a notification from the UI, you make a request to a remote service to update the notification state, and you are still waiting for a response);
6630
6874
  */
6631
- export type State = "Active" | "Acknowledged" | "Closed" | "Stale";
6632
-
6875
+ export type State = "Active" | "Acknowledged" | "Seen" | "Closed" | "Stale" | "Snoozed" | "Processing";
6633
6876
  /**
6634
6877
  * Options for the clicked notification.
6635
6878
  */
@@ -7068,7 +7311,7 @@ export declare namespace IOConnectDesktop {
7068
7311
  /**
7069
7312
  * Retrieves all preferences stored for the current user.
7070
7313
  */
7071
- getAll(): Promise<AppPreferences[]>;
7314
+ getAll(): Promise<{ all: AppPreferences[]; }>;
7072
7315
 
7073
7316
  /**
7074
7317
  * Removes all preferences stored for the current user.
@@ -7106,7 +7349,7 @@ export declare namespace IOConnectDesktop {
7106
7349
  /**
7107
7350
  * Timestamp of the last update of the user preferences.
7108
7351
  */
7109
- lastUpdate: string;
7352
+ lastUpdate?: string;
7110
7353
  }
7111
7354
  }
7112
7355