@interopio/workspaces-api 5.0.0 → 5.1.0-next.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.
@@ -911,6 +911,7 @@
911
911
 
912
912
  const nonEmptyStringDecoder = string().where((s) => s.length > 0, "Expected a non-empty string");
913
913
  const nonNegativeNumberDecoder = number().where((num) => num >= 0, "Expected a non-negative number");
914
+ const nonNegativeIntegerDecoder = number().where((num) => Number.isInteger(num) && num >= 0, "Expected a non-negative integer");
914
915
  const positiveNumberDecoder = number().where((num) => num > 0, "Expected a positive number");
915
916
  const windowDragModeDecoder = oneOf(constant("keepInside"), constant("autoEject"));
916
917
  const isWindowInSwimlaneResultDecoder = object({
@@ -968,7 +969,8 @@
968
969
  maxHeight: optional(number()),
969
970
  allowExtract: optional(boolean()),
970
971
  allowReorder: optional(boolean()),
971
- showCloseButton: optional(boolean())
972
+ showCloseButton: optional(boolean()),
973
+ positionIndex: optional(nonNegativeIntegerDecoder)
972
974
  });
973
975
  const groupDefinitionConfigDecoder = object({
974
976
  minWidth: optional(number()),
@@ -985,7 +987,8 @@
985
987
  allowDropBottom: optional(boolean()),
986
988
  showMaximizeButton: optional(boolean()),
987
989
  showEjectButton: optional(boolean()),
988
- showAddWindowButton: optional(boolean())
990
+ showAddWindowButton: optional(boolean()),
991
+ positionIndex: optional(nonNegativeIntegerDecoder)
989
992
  });
990
993
  const rowDefinitionConfigDecoder = object({
991
994
  minHeight: optional(number()),
@@ -993,7 +996,8 @@
993
996
  allowDrop: optional(boolean()),
994
997
  allowSplitters: optional(boolean()),
995
998
  isPinned: optional(boolean()),
996
- maximizationBoundary: optional(boolean())
999
+ maximizationBoundary: optional(boolean()),
1000
+ positionIndex: optional(nonNegativeIntegerDecoder)
997
1001
  });
998
1002
  const columnDefinitionConfigDecoder = object({
999
1003
  minWidth: optional(number()),
@@ -1001,7 +1005,8 @@
1001
1005
  allowDrop: optional(boolean()),
1002
1006
  allowSplitters: optional(boolean()),
1003
1007
  isPinned: optional(boolean()),
1004
- maximizationBoundary: optional(boolean())
1008
+ maximizationBoundary: optional(boolean()),
1009
+ positionIndex: optional(nonNegativeIntegerDecoder)
1005
1010
  });
1006
1011
  const swimlaneWindowDefinitionDecoder = object({
1007
1012
  type: optional(constant("window")),
@@ -2071,17 +2076,18 @@
2071
2076
  await Promise.all(Object.values(OUTGOING_METHODS).map((method) => {
2072
2077
  return this.verifyMethodLive(method.name);
2073
2078
  }));
2074
- await Promise.all(Object.keys(INCOMING_METHODS).map((method) => {
2075
- return this.registerMethod(method);
2076
- }));
2077
- return;
2078
2079
  }
2079
- const systemId = browserGlobal().communicationId;
2080
- await Promise.all([
2081
- this.verifyMethodLive(webPlatformMethodName, systemId),
2082
- this.verifyMethodLive(webPlatformWspStreamName, systemId)
2083
- ]);
2084
- await this.transmitControl("frameHello", { windowId: actualWindowId });
2080
+ else {
2081
+ const systemId = browserGlobal().communicationId;
2082
+ await Promise.all([
2083
+ this.verifyMethodLive(webPlatformMethodName, systemId),
2084
+ this.verifyMethodLive(webPlatformWspStreamName, systemId)
2085
+ ]);
2086
+ await this.transmitControl("frameHello", { windowId: actualWindowId });
2087
+ }
2088
+ await Promise.all(Object.keys(INCOMING_METHODS).map((method) => {
2089
+ return this.registerMethod(method);
2090
+ }));
2085
2091
  }
2086
2092
  coreSubscriptionReady(eventCallback) {
2087
2093
  if (!this.coreEventMethodInitiated) {
@@ -3796,14 +3802,19 @@
3796
3802
  return getData$1(this).controller.setFrameOnTop(this.id, options);
3797
3803
  }
3798
3804
  async onClosing(callback) {
3799
- if (!isDesktop()) {
3800
- throw new Error("Frame closing operations are not supported in io.Connect Browser");
3801
- }
3802
3805
  checkThrowCallback(callback);
3803
3806
  const wrappedCallback = async () => {
3804
3807
  let shouldPrevent = false;
3805
3808
  const preventClose = () => shouldPrevent = true;
3806
- await callback({ prevent: preventClose });
3809
+ try {
3810
+ await callback({ prevent: preventClose });
3811
+ }
3812
+ catch (error) {
3813
+ if (isDesktop()) {
3814
+ throw error;
3815
+ }
3816
+ console.warn(`onClosing callback for frame "${this.id}" threw: ${error}`);
3817
+ }
3807
3818
  return { prevent: shouldPrevent };
3808
3819
  };
3809
3820
  const unsubscribe = await getData$1(this).controller.registerFrameOnClosing(this.id, wrappedCallback);
@@ -5267,6 +5278,13 @@
5267
5278
  this.subscribeToFrameClosing();
5268
5279
  }
5269
5280
  async registerFrameOnClosing(frameId, callback) {
5281
+ if (!isDesktop()) {
5282
+ const { isSupported } = await this.bridge.send(OPERATIONS.operationCheck.name, { operation: OPERATIONS.subscribeToFrameClosing.name }).catch(() => ({ isSupported: false }));
5283
+ if (!isSupported) {
5284
+ console.warn(`onClosing for frame "${frameId}" is not supported by the current version of @interopio/browser-platform (requires 5.0.0+).`);
5285
+ return () => { };
5286
+ }
5287
+ }
5270
5288
  await this.bridge.send(OPERATIONS.subscribeToFrameClosing.name, { itemId: frameId });
5271
5289
  return this.registry.add(frameId, callback);
5272
5290
  }
@@ -5465,7 +5483,7 @@
5465
5483
  }
5466
5484
  }
5467
5485
 
5468
- var version = "5.0.0";
5486
+ var version = "5.1.0-next.0";
5469
5487
 
5470
5488
  const composeAPI = (glue, ioc) => {
5471
5489
  const controller = ioc.controller;