@interopio/desktop 6.5.1 → 6.6.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,6 @@
1
+ 6.6.0
2
+ - feat: layouts - add new methods - reset, getRestoredLayoutsInfo
3
+ - feat: layouts - resume/restore methods now returns the restored instances
1
4
  6.5.1
2
5
  - chore: unified repo bump
3
6
  6.5.0
package/desktop.d.ts CHANGED
@@ -2008,7 +2008,13 @@ export declare namespace IOConnectDesktop {
2008
2008
  * Restores a Layout.
2009
2009
  * @param options Options for restoring a Layout.
2010
2010
  */
2011
- restore(options: RestoreOptions): Promise<void>;
2011
+ restore(options: RestoreOptions): Promise<RestoreResumeResult>;
2012
+
2013
+ /**
2014
+ * Resets a Layout.
2015
+ * @param options Options for resetting a Layout.
2016
+ */
2017
+ reset(options: ResetLayoutOptions): Promise<RestoreResumeResult>;
2012
2018
 
2013
2019
  /**
2014
2020
  * Removes a Layout
@@ -2035,6 +2041,11 @@ export declare namespace IOConnectDesktop {
2035
2041
  */
2036
2042
  getCurrentLayout(): Promise<Layout | undefined>;
2037
2043
 
2044
+ /**
2045
+ * Retrieves info about the currently active Layout (ID, type, name, participating app instances), as well as about any previously active Layouts that still have running instances of their participating apps.
2046
+ */
2047
+ getRestoredLayoutsInfo(): Promise<GetRestoredLayoutsInfoResult | undefined>;
2048
+
2038
2049
  /**
2039
2050
  * Hibernates a Layout.
2040
2051
  * @param name Name of the Layout to hibernate.
@@ -2048,7 +2059,7 @@ export declare namespace IOConnectDesktop {
2048
2059
  * @param context Context for the Layout.
2049
2060
  * @param options Options for resuming a Layout.
2050
2061
  */
2051
- resume(name: string, context?: any, options?: IOConnectDesktop.Layouts.ResumeOptions): Promise<ResumeResult>;
2062
+ resume(name: string, context?: any, options?: IOConnectDesktop.Layouts.ResumeOptions): Promise<RestoreResumeResult>;
2052
2063
 
2053
2064
  /**
2054
2065
  * Updates the context saved for your app in the currently loaded Layout.
@@ -2196,17 +2207,37 @@ export declare namespace IOConnectDesktop {
2196
2207
  }
2197
2208
 
2198
2209
  /**
2199
- * Describes the result returned from resuming a Layout.
2210
+ * Describes the result returned from restoring or resuming a Layout.
2200
2211
  */
2201
- export interface ResumeResult extends LayoutResult {
2212
+ export interface RestoreResumeResult extends LayoutResult {
2202
2213
  /**
2203
- * Array of objects describing all resumed app instances participating in the Layout.
2204
- * Each object contains the instance ID and the app name of the resumed app instance.
2214
+ * Status of the Layout restore or resume operation.
2205
2215
  */
2206
- instances: {
2207
- instanceId: string,
2208
- appName: string
2209
- }[];
2216
+ status: "Success" | "Failed";
2217
+
2218
+ /**
2219
+ * ID of the Layout that was restored or resumed.
2220
+ */
2221
+ layoutId: string;
2222
+
2223
+ /**
2224
+ * List of objects describing the app instances participating in the restored or resumed Layout.
2225
+ */
2226
+ instances: RestoredInstance[];
2227
+ }
2228
+
2229
+ /**
2230
+ * Describes an app instance participating in a restored or resumed Layout.
2231
+ */
2232
+ export interface RestoredInstance {
2233
+ /**
2234
+ * Name of the app within the io.Connect framework.
2235
+ */
2236
+ appName: string;
2237
+ /**
2238
+ * Unique ID of the app instance within the io.Connect framework.
2239
+ */
2240
+ instanceId: string;
2210
2241
  }
2211
2242
 
2212
2243
  /**
@@ -2223,6 +2254,48 @@ export declare namespace IOConnectDesktop {
2223
2254
  }[];
2224
2255
  }
2225
2256
 
2257
+ /**
2258
+ * Describes the currently active Layout (ID, type, name and participating app instances), as well as any previously active Layouts that still have running instances of their participating apps.
2259
+ */
2260
+ export interface GetRestoredLayoutsInfoResult {
2261
+ /**
2262
+ * List of objects each describing the currently active Layout or any previously active Layouts.
2263
+ */
2264
+ layoutInfo: RestoredLayoutDetails[];
2265
+ }
2266
+
2267
+ /**
2268
+ * Describes a currently active Layout, or a previously active Layout that may still have running instances of its participating apps.
2269
+ */
2270
+ export interface RestoredLayoutDetails {
2271
+ /**
2272
+ * ID of the Layout.
2273
+ */
2274
+ id: string;
2275
+ /**
2276
+ * Type of the Layout.
2277
+ */
2278
+ type: string;
2279
+ /**
2280
+ * Name of the Layout.
2281
+ */
2282
+ name: string;
2283
+ /**
2284
+ * List of objects each describing the app instances participating in the Layout.
2285
+ */
2286
+ instances: RestoredLayoutInstanceInfo[];
2287
+ }
2288
+
2289
+ /**
2290
+ * Describes an app instance participating in a Layout.
2291
+ */
2292
+ export interface RestoredLayoutInstanceInfo extends RestoredInstance {
2293
+ /**
2294
+ * Flag indicating whether the app instance has been stopped.
2295
+ */
2296
+ stopped: boolean;
2297
+ }
2298
+
2226
2299
  /**
2227
2300
  * Type of the Layout component - an activity or an app.
2228
2301
  * @ignore
@@ -2409,6 +2482,31 @@ export declare namespace IOConnectDesktop {
2409
2482
  splash?: RestoreSplashOptions;
2410
2483
  }
2411
2484
 
2485
+ /**
2486
+ * Options for resetting a Layout.
2487
+ */
2488
+ export interface ResetLayoutOptions {
2489
+ /**
2490
+ * ID of the Layout to reset.
2491
+ */
2492
+ layoutId: string
2493
+ /**
2494
+ * If `true`, will reset only the visible apps. Any apps that may have been hidden programmatically won't be included in the Layout reset process.
2495
+ * @default false
2496
+ */
2497
+ visibleOnly?: boolean;
2498
+ /**
2499
+ * If `true`, will create any missing apps that may have been closed by the user or programmatically.
2500
+ * @default true
2501
+ */
2502
+ createMissing?: boolean;
2503
+ /**
2504
+ * If `true`, will reset the Layout to its default state. Set to `false` to preserve any current app context or Channel selection.
2505
+ * @default true
2506
+ */
2507
+ resetState?: boolean;
2508
+ }
2509
+
2412
2510
  /**
2413
2511
  * Options for hibernating Layouts.
2414
2512
  */
@@ -2933,7 +2933,7 @@
2933
2933
  }
2934
2934
  };
2935
2935
 
2936
- var version$1 = "6.3.3";
2936
+ var version$1 = "6.3.4";
2937
2937
 
2938
2938
  function prepareConfig$1 (configuration, ext, glue42gd) {
2939
2939
  let nodeStartingContext;
@@ -6903,6 +6903,10 @@
6903
6903
  return unsubscribeFunc;
6904
6904
  }
6905
6905
  getServerById(id) {
6906
+ const server = this.servers[id];
6907
+ if (!server) {
6908
+ return undefined;
6909
+ }
6906
6910
  return this.hideServerMethodSystemFlags(this.servers[id]);
6907
6911
  }
6908
6912
  reset() {
@@ -7215,7 +7219,7 @@
7215
7219
  }
7216
7220
  handleAddInterest(msg) {
7217
7221
  const caller = this.repository.getServerById(msg.caller_id);
7218
- const instance = caller.instance;
7222
+ const instance = caller?.instance ?? {};
7219
7223
  const requestContext = {
7220
7224
  msg,
7221
7225
  arguments: msg.arguments_kv || {},
@@ -7387,7 +7391,7 @@
7387
7391
  if (method === undefined) {
7388
7392
  return;
7389
7393
  }
7390
- const client = this.clientRepository.getServerById(callerId).instance;
7394
+ const client = this.clientRepository.getServerById(callerId)?.instance;
7391
7395
  const invocationArgs = { args, instance: client };
7392
7396
  this.callbacks.execute("onInvoked", method, invocationId, invocationArgs);
7393
7397
  }
@@ -7400,9 +7404,15 @@
7400
7404
  return this.subscriptionData.params.arguments || {};
7401
7405
  }
7402
7406
  get servers() {
7403
- return this.subscriptionData.trackedServers
7404
- .filter((pair) => pair.subscriptionId)
7405
- .map((pair) => this.repository.getServerById(pair.serverId).instance);
7407
+ return this.subscriptionData.trackedServers.reduce((servers, pair) => {
7408
+ if (pair.subscriptionId) {
7409
+ const server = this.repository.getServerById(pair.serverId)?.instance;
7410
+ if (server) {
7411
+ servers.push(server);
7412
+ }
7413
+ }
7414
+ return servers;
7415
+ }, []);
7406
7416
  }
7407
7417
  get serverInstance() {
7408
7418
  return this.servers[0];
@@ -7692,18 +7702,19 @@
7692
7702
  if (typeof subscription !== "object") {
7693
7703
  return;
7694
7704
  }
7695
- const trackedServersFound = subscription.trackedServers.filter((server) => {
7696
- return server.subscriptionId === msg.subscription_id;
7705
+ const trackedServersFound = subscription.trackedServers.filter((s) => {
7706
+ return s.subscriptionId === msg.subscription_id;
7697
7707
  });
7698
7708
  if (trackedServersFound.length !== 1) {
7699
7709
  return;
7700
7710
  }
7701
7711
  const isPrivateData = msg.oob;
7702
7712
  const sendingServerId = trackedServersFound[0].serverId;
7713
+ const server = this.repository.getServerById(sendingServerId);
7703
7714
  const receivedStreamData = () => {
7704
7715
  return {
7705
7716
  data: msg.data,
7706
- server: this.repository.getServerById(sendingServerId).instance,
7717
+ server: server?.instance ?? {},
7707
7718
  requestArguments: subscription.params.arguments,
7708
7719
  message: undefined,
7709
7720
  private: isPrivateData,
@@ -7757,7 +7768,7 @@
7757
7768
  const closingServerId = (closersCount > 0) ? subscription.queued.closers[closersCount - 1] : null;
7758
7769
  let closingServer;
7759
7770
  if (closingServerId !== undefined && typeof closingServerId === "string") {
7760
- closingServer = this.repository.getServerById(closingServerId).instance;
7771
+ closingServer = this.repository.getServerById(closingServerId)?.instance ?? {};
7761
7772
  }
7762
7773
  subscription.handlers.onClosed.forEach((callback) => {
7763
7774
  if (typeof callback !== "function") {
@@ -7869,13 +7880,15 @@
7869
7880
  const serverId = msg.server_id;
7870
7881
  const methodIdList = msg.methods;
7871
7882
  const server = this.repository.getServerById(serverId);
7872
- const serverMethodKeys = Object.keys(server.methods);
7873
- serverMethodKeys.forEach((methodKey) => {
7874
- const method = server.methods[methodKey];
7875
- if (methodIdList.indexOf(method.gatewayId) > -1) {
7876
- this.repository.removeServerMethod(serverId, methodKey);
7877
- }
7878
- });
7883
+ if (server) {
7884
+ const serverMethodKeys = Object.keys(server.methods);
7885
+ serverMethodKeys.forEach((methodKey) => {
7886
+ const method = server.methods[methodKey];
7887
+ if (methodIdList.indexOf(method.gatewayId) > -1) {
7888
+ this.repository.removeServerMethod(serverId, methodKey);
7889
+ }
7890
+ });
7891
+ }
7879
7892
  }
7880
7893
  handleResultMessage(msg) {
7881
7894
  const invocationId = msg._tag.invocationId;
@@ -7885,7 +7898,7 @@
7885
7898
  return {
7886
7899
  invocationId,
7887
7900
  result,
7888
- instance: server.instance,
7901
+ instance: server?.instance,
7889
7902
  status: InvokeStatus.Success,
7890
7903
  message: ""
7891
7904
  };
@@ -7901,7 +7914,7 @@
7901
7914
  return {
7902
7915
  invocationId,
7903
7916
  result: context,
7904
- instance: server.instance,
7917
+ instance: server?.instance,
7905
7918
  status: InvokeStatus.Error,
7906
7919
  message
7907
7920
  };
@@ -16935,6 +16948,21 @@
16935
16948
  this.invokeMethodAndTrack("RestoreLayout", arg, resolve, reject, true);
16936
16949
  });
16937
16950
  }
16951
+ reset(options) {
16952
+ return new Promise((resolve, reject) => {
16953
+ this.verifyNotSlimMode();
16954
+ if (typeof options !== "object") {
16955
+ return reject(new Error("options argument is required"));
16956
+ }
16957
+ if (isNullOrWhiteSpace(options.layoutId)) {
16958
+ return reject(new Error("options.layoutId argument is required"));
16959
+ }
16960
+ const msg = {
16961
+ ...options
16962
+ };
16963
+ this.invokeMethodAndTrack("ResetLayout", msg, resolve, reject, true);
16964
+ });
16965
+ }
16938
16966
  remove(type, name) {
16939
16967
  return new Promise((resolve, reject) => {
16940
16968
  this.verifyNotSlimMode();
@@ -17064,6 +17092,17 @@
17064
17092
  }
17065
17093
  return layout;
17066
17094
  }
17095
+ getRestoredLayoutsInfo() {
17096
+ return new Promise((resolve, reject) => {
17097
+ const methodName = "GetRestoredLayoutsInfo";
17098
+ this.invokeMethodCore(methodName)
17099
+ .then((result) => {
17100
+ const restoredLayouts = result.returned;
17101
+ resolve(restoredLayouts);
17102
+ })
17103
+ .catch(reject);
17104
+ });
17105
+ }
17067
17106
  onAdded(callback) {
17068
17107
  const result = this.callbacks.add("added", callback);
17069
17108
  if (store.all.length > 0) {
@@ -18245,7 +18284,7 @@
18245
18284
  };
18246
18285
  }
18247
18286
 
18248
- var version = "6.5.0";
18287
+ var version = "6.5.1";
18249
18288
 
18250
18289
  var prepareConfig = (options) => {
18251
18290
  function getLibConfig(value, defaultMode, trueMode) {