@interopio/browser 4.4.0 → 4.5.0-beta.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/browser.d.ts CHANGED
@@ -1536,9 +1536,10 @@ export namespace IOConnectBrowser {
1536
1536
  /**
1537
1537
  * Retrieves a list with the contexts of the current Channels. Can be used both in single and in multi Channel mode.
1538
1538
  * If used in single Channel mode, the returned array will always contain a single member if the window is joined to a Channel, or will be empty otherwise.
1539
+ * @param options Settings for retrieving FDC3 contexts published in the io.Connect Channels. *Available since io.Connect Browser 4.5.*
1539
1540
  * @since io.Connect Browser 3.5
1540
1541
  */
1541
- getMyChannels(): Promise<ChannelContext[]>;
1542
+ getMyChannels(options?: FDC3Options): Promise<ChannelContext[]>;
1542
1543
 
1543
1544
  /**
1544
1545
  * Retrieves a list with the names of the current Channels. Can be used both in single and in multi Channel mode.
@@ -2415,7 +2416,8 @@ export namespace IOConnectBrowser {
2415
2416
  }
2416
2417
 
2417
2418
  interface InteropAppChannelV2 {
2418
- name: string;
2419
+ name?: string;
2420
+ id?: string;
2419
2421
  description?: string;
2420
2422
  broadcasts?: string[];
2421
2423
  listensFor?: string[];
package/changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ 4.5.0
2
+ fix: G4E-10635 Enforced stricter URL validation for app definitions and io.windows.open() URLs. URLs with unsafe protocols ("data:", "javascript:", "vbscript:") are now rejected.
3
+ feat: G4E-10757 Add 'options' argument to io.channels.getMyChannels() method
1
4
  4.4.0
2
5
  feat: G4E-10351 Add 'saveWindowContexts' option to 'io.layouts.save' that includes web window contexts in the saved layout
3
6
  4.3.0
@@ -1798,22 +1798,26 @@ Decoder$1.valueAt;
1798
1798
  /** See `Decoder.succeed` */
1799
1799
  Decoder$1.succeed;
1800
1800
  /** See `Decoder.fail` */
1801
- Decoder$1.fail;
1801
+ var fail$1 = Decoder$1.fail;
1802
1802
  /** See `Decoder.lazy` */
1803
1803
  Decoder$1.lazy;
1804
1804
 
1805
1805
  const nonEmptyStringDecoder$3 = string$1().where((s) => s.length > 0, "Expected a non-empty string");
1806
1806
  const nonNegativeNumberDecoder$3 = number$1().where((num) => num >= 0, "Expected a non-negative number");
1807
1807
  const regexDecoder = anyJson$1().andThen((value) => {
1808
- return value instanceof RegExp ? anyJson$1() : fail(`expected a regex, got a ${typeof value}`);
1808
+ return value instanceof RegExp ? anyJson$1() : fail$1(`expected a regex, got a ${typeof value}`);
1809
1809
  });
1810
- const urlDecoder = nonEmptyStringDecoder$3.andThen((url) => {
1810
+ const urlDecoder$1 = nonEmptyStringDecoder$3.andThen((url) => {
1811
1811
  try {
1812
- new URL(url);
1812
+ const { protocol } = new URL(url);
1813
+ const disallowedProtocols = ["data:", "javascript:", "vbscript:"];
1814
+ if (disallowedProtocols.includes(protocol)) {
1815
+ return fail$1(`Expected a URL with a safe protocol, got: ${protocol} (disallowed protocols: ${disallowedProtocols.join(", ")})`);
1816
+ }
1813
1817
  return nonEmptyStringDecoder$3;
1814
1818
  }
1815
1819
  catch {
1816
- return fail("Should be a valid URL");
1820
+ return fail$1("Expected a valid URL");
1817
1821
  }
1818
1822
  });
1819
1823
 
@@ -1825,7 +1829,7 @@ const intentDefinitionDecoder$1 = object$1({
1825
1829
  });
1826
1830
  const v2TypeDecoder = oneOf(constant$1("web"), constant$1("native"), constant$1("citrix"), constant$1("onlineNative"), constant$1("other"));
1827
1831
  const v2DetailsDecoder = object$1({
1828
- url: nonEmptyStringDecoder$3
1832
+ url: urlDecoder$1
1829
1833
  });
1830
1834
  const v2IconDecoder = object$1({
1831
1835
  src: nonEmptyStringDecoder$3,
@@ -1853,18 +1857,19 @@ const v2UserChannelDecoder = object$1({
1853
1857
  listensFor: optional$1(array$1(nonEmptyStringDecoder$3))
1854
1858
  });
1855
1859
  const v2AppChannelDecoder = object$1({
1856
- name: nonEmptyStringDecoder$3,
1860
+ name: optional$1(nonEmptyStringDecoder$3),
1861
+ id: optional$1(nonEmptyStringDecoder$3),
1857
1862
  description: optional$1(nonEmptyStringDecoder$3),
1858
1863
  broadcasts: optional$1(array$1(nonEmptyStringDecoder$3)),
1859
1864
  listensFor: optional$1(array$1(nonEmptyStringDecoder$3))
1860
- });
1865
+ }).where((appChannel) => Boolean(appChannel.name || appChannel.id), "Expected at least a name or an id property to be present in the app channel definition");
1861
1866
  const v2InteropDecoder = object$1({
1862
1867
  intents: optional$1(v2IntentsDecoder),
1863
1868
  userChannels: optional$1(v2UserChannelDecoder),
1864
1869
  appChannels: optional$1(array$1(v2AppChannelDecoder))
1865
1870
  });
1866
1871
  const glue42ApplicationDetailsDecoder = object$1({
1867
- url: optional$1(nonEmptyStringDecoder$3),
1872
+ url: optional$1(urlDecoder$1),
1868
1873
  top: optional$1(number$1()),
1869
1874
  left: optional$1(number$1()),
1870
1875
  width: optional$1(nonNegativeNumberDecoder$3),
@@ -2144,7 +2149,7 @@ const decoders$1 = {
2144
2149
  nonEmptyStringDecoder: nonEmptyStringDecoder$3,
2145
2150
  nonNegativeNumberDecoder: nonNegativeNumberDecoder$3,
2146
2151
  regexDecoder,
2147
- urlDecoder
2152
+ urlDecoder: urlDecoder$1
2148
2153
  },
2149
2154
  fdc3: {
2150
2155
  allDefinitionsDecoder,
@@ -2193,9 +2198,10 @@ ioc.fdc3;
2193
2198
  const decoders = ioc.decoders;
2194
2199
  ioc.errors;
2195
2200
 
2196
- const nonEmptyStringDecoder$2 = string$2().where((s) => s.length > 0, "Expected a non-empty string");
2197
- const nonNegativeNumberDecoder$2 = number$2().where((num) => num >= 0, "Expected a non-negative number");
2201
+ const nonEmptyStringDecoder$2 = decoders.common.nonEmptyStringDecoder;
2202
+ const nonNegativeNumberDecoder$2 = decoders.common.nonNegativeNumberDecoder;
2198
2203
  const optionalNonEmptyStringDecoder = optional$2(nonEmptyStringDecoder$2);
2204
+ const urlDecoder = decoders.common.urlDecoder;
2199
2205
  const libDomainDecoder = oneOf$1(constant$2("system"), constant$2("windows"), constant$2("appManager"), constant$2("layouts"), constant$2("intents"), constant$2("notifications"), constant$2("channels"), constant$2("extension"), constant$2("themes"), constant$2("prefs"), constant$2("ui"));
2200
2206
  const windowOperationTypesDecoder = oneOf$1(constant$2("openWindow"), constant$2("windowHello"), constant$2("windowAdded"), constant$2("windowRemoved"), constant$2("getBounds"), constant$2("getFrameBounds"), constant$2("getUrl"), constant$2("moveResize"), constant$2("focus"), constant$2("close"), constant$2("getTitle"), constant$2("setTitle"), constant$2("focusChange"), constant$2("getChannel"), constant$2("notifyChannelsChanged"), constant$2("setZoomFactor"), constant$2("zoomFactorChange"), constant$2("refresh"), constant$2("operationCheck"));
2201
2207
  const appManagerOperationTypesDecoder = oneOf$1(constant$2("appHello"), constant$2("appDirectoryStateChange"), constant$2("instanceStarted"), constant$2("instanceStopped"), constant$2("applicationStart"), constant$2("instanceStop"), constant$2("clear"), constant$2("operationCheck"));
@@ -2222,7 +2228,7 @@ const windowOpenSettingsDecoder = optional$2(object$2({
2222
2228
  }));
2223
2229
  const openWindowConfigDecoder = object$2({
2224
2230
  name: nonEmptyStringDecoder$2,
2225
- url: nonEmptyStringDecoder$2,
2231
+ url: urlDecoder,
2226
2232
  options: windowOpenSettingsDecoder
2227
2233
  });
2228
2234
  const windowHelloDecoder = object$2({
@@ -2274,7 +2280,7 @@ const frameWindowBoundsResultDecoder = object$2({
2274
2280
  });
2275
2281
  const windowUrlResultDecoder = object$2({
2276
2282
  windowId: nonEmptyStringDecoder$2,
2277
- url: nonEmptyStringDecoder$2
2283
+ url: urlDecoder
2278
2284
  });
2279
2285
  const windowZoomFactorConfigDecoder = object$2({
2280
2286
  windowId: nonEmptyStringDecoder$2,
@@ -2305,7 +2311,7 @@ const channelSelectorDecoder$1 = object$2({
2305
2311
  enabled: boolean$2(),
2306
2312
  });
2307
2313
  const applicationDetailsDecoder = object$2({
2308
- url: nonEmptyStringDecoder$2,
2314
+ url: urlDecoder,
2309
2315
  top: optional$2(number$2()),
2310
2316
  left: optional$2(number$2()),
2311
2317
  width: optional$2(nonNegativeNumberDecoder$2),
@@ -2380,7 +2386,7 @@ const windowComponentStateDecoder = object$2({
2380
2386
  bounds: windowBoundsDecoder,
2381
2387
  createArgs: object$2({
2382
2388
  name: optional$2(nonEmptyStringDecoder$2),
2383
- url: optional$2(nonEmptyStringDecoder$2),
2389
+ url: optional$2(urlDecoder),
2384
2390
  context: optional$2(anyJson$2())
2385
2391
  }),
2386
2392
  windowState: optional$2(nonEmptyStringDecoder$2),
@@ -2404,7 +2410,7 @@ const windowLayoutItemDecoder = object$2({
2404
2410
  type: constant$2("window"),
2405
2411
  config: object$2({
2406
2412
  appName: nonEmptyStringDecoder$2,
2407
- url: optional$2(nonEmptyStringDecoder$2),
2413
+ url: optional$2(urlDecoder),
2408
2414
  title: optional$2(string$2()),
2409
2415
  allowExtract: optional$2(boolean$2()),
2410
2416
  allowReorder: optional$2(boolean$2()),
@@ -3806,7 +3812,7 @@ class WindowsController {
3806
3812
  }
3807
3813
  async open(name, url, options) {
3808
3814
  runDecoderWithIOError(nonEmptyStringDecoder$2, name);
3809
- runDecoderWithIOError(nonEmptyStringDecoder$2, url);
3815
+ runDecoderWithIOError(urlDecoder, url);
3810
3816
  const settings = runDecoderWithIOError(windowOpenSettingsDecoder, options);
3811
3817
  const windowSuccess = await this.bridge.send("windows", operations$a.openWindow, { name, url, options: settings });
3812
3818
  return this.waitForWindowAdded(windowSuccess.windowId);
@@ -5967,11 +5973,8 @@ class ChannelsController {
5967
5973
  }
5968
5974
  return channelContext;
5969
5975
  }
5970
- async getMyChannels() {
5971
- return Promise.all(this.storage.channels.map((channelName) => {
5972
- const contextName = this.createContextName(channelName);
5973
- return this.contexts.get(contextName);
5974
- }));
5976
+ async getMyChannels(options) {
5977
+ return Promise.all(this.storage.channels.map((channelName) => this.get(channelName, options)));
5975
5978
  }
5976
5979
  myChannels() {
5977
5980
  return this.storage.channels;
@@ -7777,7 +7780,7 @@ class IoC {
7777
7780
  }
7778
7781
  }
7779
7782
 
7780
- var version$1 = "4.4.0";
7783
+ var version$1 = "4.5.0-beta.0";
7781
7784
 
7782
7785
  const setupGlobalSystem = (io, bridge) => {
7783
7786
  return {
@@ -17037,7 +17040,7 @@ Decoder.valueAt;
17037
17040
  /** See `Decoder.succeed` */
17038
17041
  Decoder.succeed;
17039
17042
  /** See `Decoder.fail` */
17040
- var fail$1 = Decoder.fail;
17043
+ var fail = Decoder.fail;
17041
17044
  /** See `Decoder.lazy` */
17042
17045
  Decoder.lazy;
17043
17046
 
@@ -17045,7 +17048,7 @@ const functionCheck = (input, propDescription) => {
17045
17048
  const providedType = typeof input;
17046
17049
  return providedType === "function" ?
17047
17050
  anyJson() :
17048
- fail$1(`The provided argument as ${propDescription} should be of type function, provided: ${providedType}`);
17051
+ fail(`The provided argument as ${propDescription} should be of type function, provided: ${providedType}`);
17049
17052
  };
17050
17053
  const nonEmptyStringDecoder = string().where((s) => s.length > 0, "Expected a non-empty string");
17051
17054
  const nonNegativeNumberDecoder = number().where((num) => num >= 0, "Expected a non-negative number or 0");