@interopio/workspaces-api 3.4.1 → 3.4.3

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,5 @@
1
+ 3.4.3
2
+ feat: Enable Workspaces API for Node.js
1
3
  3.4.0
2
4
  chore: io.CB 3.4 bump
3
5
  3.3.3
@@ -1835,6 +1835,16 @@ const promisePlus = (promise, timeoutMilliseconds, timeoutMessage) => {
1835
1835
  });
1836
1836
  };
1837
1837
 
1838
+ const isDesktop = () => {
1839
+ return typeof window === "undefined" ?
1840
+ true :
1841
+ window.glue42gd || window.iodesktop;
1842
+ };
1843
+ const browserGlobal = () => {
1844
+ return typeof window === "undefined" ? null :
1845
+ window.glue42core || window.iobrowser;
1846
+ };
1847
+
1838
1848
  class InteropTransport {
1839
1849
  agm;
1840
1850
  registry;
@@ -1846,8 +1856,7 @@ class InteropTransport {
1846
1856
  this.registry = registry;
1847
1857
  }
1848
1858
  async initiate(actualWindowId) {
1849
- const desktopGlobal = window.glue42gd || window.iodesktop;
1850
- if (desktopGlobal) {
1859
+ if (isDesktop()) {
1851
1860
  await Promise.all(Object.values(OUTGOING_METHODS).map((method) => {
1852
1861
  return this.verifyMethodLive(method.name);
1853
1862
  }));
@@ -1856,8 +1865,7 @@ class InteropTransport {
1856
1865
  }));
1857
1866
  return;
1858
1867
  }
1859
- const browserGlobal = window.glue42core || window.iobrowser;
1860
- const systemId = browserGlobal.communicationId;
1868
+ const systemId = browserGlobal().communicationId;
1861
1869
  await Promise.all([
1862
1870
  this.verifyMethodLive(webPlatformMethodName, systemId),
1863
1871
  this.verifyMethodLive(webPlatformWspStreamName, systemId)
@@ -1872,8 +1880,7 @@ class InteropTransport {
1872
1880
  }
1873
1881
  subscribePlatform(eventCallback) {
1874
1882
  this.coreEventMethodInitiated = true;
1875
- const browserGlobal = window.glue42core || window.iobrowser;
1876
- const systemId = browserGlobal.communicationId;
1883
+ const systemId = browserGlobal().communicationId;
1877
1884
  this.corePlatformSubPromise = this.agm.subscribe(webPlatformWspStreamName, systemId ? { target: { instance: systemId } } : undefined);
1878
1885
  this.corePlatformSubPromise
1879
1886
  .then((sub) => {
@@ -1896,11 +1903,9 @@ class InteropTransport {
1896
1903
  return subscription;
1897
1904
  }
1898
1905
  async transmitControl(operation, operationArguments) {
1899
- const desktopGlobal = window.glue42gd || window.iodesktop;
1900
- const browserGlobal = window.glue42core || window.iobrowser;
1901
- const invocationArguments = desktopGlobal ? { operation, operationArguments } : { operation, domain: "workspaces", data: operationArguments };
1902
- const methodName = desktopGlobal ? OUTGOING_METHODS.control.name : webPlatformMethodName;
1903
- const platformTarget = desktopGlobal ? undefined : browserGlobal.communicationId;
1906
+ const invocationArguments = isDesktop() ? { operation, operationArguments } : { operation, domain: "workspaces", data: operationArguments };
1907
+ const methodName = isDesktop() ? OUTGOING_METHODS.control.name : webPlatformMethodName;
1908
+ const platformTarget = isDesktop() ? undefined : browserGlobal().communicationId;
1904
1909
  let invocationResult;
1905
1910
  const baseErrorMessage = `Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(invocationArguments)}. `;
1906
1911
  try {
@@ -2886,15 +2891,13 @@ class Workspace {
2886
2891
  await this.refreshReference();
2887
2892
  }
2888
2893
  async showLoadingAnimation() {
2889
- const desktopGlobal = window.glue42gd || window.iodesktop;
2890
- if (!desktopGlobal) {
2894
+ if (!isDesktop()) {
2891
2895
  throw new Error("Not supported in IO Connect Browser");
2892
2896
  }
2893
2897
  await getData$3(this).controller.showWorkspaceLoadingAnimation(this.id);
2894
2898
  }
2895
2899
  async hideLoadingAnimation() {
2896
- const desktopGlobal = window.glue42gd || window.iodesktop;
2897
- if (!desktopGlobal) {
2900
+ if (!isDesktop()) {
2898
2901
  throw new Error("Not supported in IO Connect Browser");
2899
2902
  }
2900
2903
  await getData$3(this).controller.hideWorkspaceLoadingAnimation(this.id);
@@ -3372,32 +3375,28 @@ class Frame {
3372
3375
  return getData$1(this).controller.focusItem(myId);
3373
3376
  }
3374
3377
  async state() {
3375
- const desktopGlobal = window.glue42gd || window.iodesktop;
3376
- if (!desktopGlobal) {
3378
+ if (!isDesktop()) {
3377
3379
  throw new Error("State operations are not supported in IO Connect Browser");
3378
3380
  }
3379
3381
  const myId = getData$1(this).summary.id;
3380
3382
  return getData$1(this).controller.getFrameState(myId);
3381
3383
  }
3382
3384
  async minimize() {
3383
- const desktopGlobal = window.glue42gd || window.iodesktop;
3384
- if (!desktopGlobal) {
3385
+ if (!isDesktop()) {
3385
3386
  throw new Error("State operations are not supported in IO Connect Browser");
3386
3387
  }
3387
3388
  const myId = getData$1(this).summary.id;
3388
3389
  return getData$1(this).controller.changeFrameState(myId, "minimized");
3389
3390
  }
3390
3391
  async maximize() {
3391
- const desktopGlobal = window.glue42gd || window.iodesktop;
3392
- if (!desktopGlobal) {
3392
+ if (!isDesktop()) {
3393
3393
  throw new Error("State operations are not supported in IO Connect Browser");
3394
3394
  }
3395
3395
  const myId = getData$1(this).summary.id;
3396
3396
  return getData$1(this).controller.changeFrameState(myId, "maximized");
3397
3397
  }
3398
3398
  async restore() {
3399
- const desktopGlobal = window.glue42gd || window.iodesktop;
3400
- if (!desktopGlobal) {
3399
+ if (!isDesktop()) {
3401
3400
  throw new Error("State operations are not supported in IO Connect Browser");
3402
3401
  }
3403
3402
  const myId = getData$1(this).summary.id;
@@ -4330,8 +4329,7 @@ class BaseController {
4330
4329
  }
4331
4330
  }
4332
4331
  async isOperationSupported(operation) {
4333
- const desktopGlobal = window.glue42gd || window.iodesktop;
4334
- if (desktopGlobal) {
4332
+ if (isDesktop()) {
4335
4333
  return { isSupported: true };
4336
4334
  }
4337
4335
  return await this.bridge.send(OPERATIONS.operationCheck.name, { operation });
@@ -4383,14 +4381,12 @@ class MainController {
4383
4381
  return await this.base.add(type, parentId, parentType, definition);
4384
4382
  }
4385
4383
  processLocalSubscription(config, levelId) {
4386
- const desktopGlobal = window.glue42gd || window.iodesktop;
4387
- return desktopGlobal ?
4384
+ return isDesktop() ?
4388
4385
  this.handleEnterpriseLocalSubscription(config, levelId) :
4389
4386
  this.handleCoreLocalSubscription(config, levelId);
4390
4387
  }
4391
4388
  processGlobalSubscription(callback, eventType, action) {
4392
- const desktopGlobal = window.glue42gd || window.iodesktop;
4393
- return desktopGlobal ?
4389
+ return isDesktop() ?
4394
4390
  this.handleEnterpriseGlobalSubscription(callback, eventType, action) :
4395
4391
  this.handleCoreGlobalSubscription(callback, eventType, action);
4396
4392
  }
@@ -4411,8 +4407,7 @@ class MainController {
4411
4407
  return this.base.fetchWorkspace(workspaceId);
4412
4408
  }
4413
4409
  async getWorkspaceByWindowId(itemId) {
4414
- const desktopGlobal = window.glue42gd || window.iodesktop;
4415
- if (!desktopGlobal) {
4410
+ if (!isDesktop()) {
4416
4411
  return (await this.getWorkspaces((wsp) => !!wsp.getWindow((w) => w.id === itemId)))[0];
4417
4412
  }
4418
4413
  return this.base.fetchWorkspace(itemId);
@@ -4493,8 +4488,7 @@ class MainController {
4493
4488
  return await this.bridge.send(OPERATIONS.saveLayout.name, config);
4494
4489
  }
4495
4490
  async importLayouts(layouts, mode) {
4496
- const desktopGlobal = window.glue42gd || window.iodesktop;
4497
- if (desktopGlobal) {
4491
+ if (isDesktop()) {
4498
4492
  try {
4499
4493
  await this.bridge.send(OPERATIONS.importLayouts.name, { layouts, mode });
4500
4494
  }
@@ -4908,7 +4902,7 @@ class IoC {
4908
4902
  }
4909
4903
  }
4910
4904
 
4911
- var version = "3.4.1";
4905
+ var version = "3.4.3";
4912
4906
 
4913
4907
  const composeAPI = (glue, ioc) => {
4914
4908
  const controller = ioc.controller;