@interopio/browser 3.1.1 → 3.1.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.
@@ -1952,7 +1952,7 @@
1952
1952
  mergeBaseAppDataWithGlueManifest(baseAppData, hostManifestDefinition) {
1953
1953
  let baseApplicationDefinition = baseAppData;
1954
1954
  if (hostManifestDefinition.details) {
1955
- const details = hostManifestDefinition.details;
1955
+ const details = Object.assign(Object.assign({}, baseAppData.createOptions), hostManifestDefinition.details);
1956
1956
  baseApplicationDefinition.createOptions = details;
1957
1957
  baseApplicationDefinition.userProperties.details = details;
1958
1958
  }
@@ -1965,8 +1965,7 @@
1965
1965
  return baseApplicationDefinition;
1966
1966
  }
1967
1967
  mergeDesktopConfigWithGlueManifest(config, desktopDefinition) {
1968
- let appConfig = Object.assign({}, config);
1969
- appConfig = Object.assign(Object.assign({}, config), desktopDefinition);
1968
+ const appConfig = Object.assign({}, config, desktopDefinition, { details: Object.assign(Object.assign({}, config.details), desktopDefinition.details) });
1970
1969
  if (Array.isArray(desktopDefinition.intents)) {
1971
1970
  appConfig.intents = (config.intents || []).concat(desktopDefinition.intents);
1972
1971
  }
@@ -4780,7 +4779,8 @@
4780
4779
  }
4781
4780
  registerPromise = this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
4782
4781
  if (this.myIntents.has(intentName)) {
4783
- return handler(args);
4782
+ const rest = __rest$2(args, ["_initialCallerId"]);
4783
+ return handler(rest);
4784
4784
  }
4785
4785
  });
4786
4786
  registerPromise.catch(err => {
@@ -4811,7 +4811,9 @@
4811
4811
  try {
4812
4812
  yield this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
4813
4813
  if (this.myIntents.has(intentName)) {
4814
- return handler(args);
4814
+ const { _initialCallerId } = args, rest = __rest$2(args, ["_initialCallerId"]);
4815
+ const caller = this.interop.servers().find((server) => server.instance === _initialCallerId);
4816
+ return handler(rest, caller);
4815
4817
  }
4816
4818
  });
4817
4819
  }
@@ -6122,7 +6124,7 @@
6122
6124
  }
6123
6125
  }
6124
6126
 
6125
- var version$2 = "3.1.1";
6127
+ var version$2 = "3.1.3";
6126
6128
 
6127
6129
  const createFactoryFunction = (coreFactoryFunction) => {
6128
6130
  return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {
@@ -8443,7 +8445,7 @@
8443
8445
  });
8444
8446
  };
8445
8447
  GW3ProtocolImpl.prototype.getNewGWToken = function () {
8446
- if (typeof window !== undefined) {
8448
+ if (typeof window !== "undefined") {
8447
8449
  var glue42gd = window.glue42gd;
8448
8450
  if (glue42gd) {
8449
8451
  return glue42gd.getGWToken();
@@ -8781,6 +8783,11 @@
8781
8783
  if (!data || _this.rejected) {
8782
8784
  return;
8783
8785
  }
8786
+ var allowedOrigins = _this.settings.allowedOrigins || [];
8787
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
8788
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
8789
+ return;
8790
+ }
8784
8791
  if (!_this.checkMessageTypeValid(data.type)) {
8785
8792
  _this.logger.error("cannot handle the incoming glue42 core message, because the type is invalid: ".concat(data.type));
8786
8793
  return;
@@ -8888,6 +8895,11 @@
8888
8895
  if (!extData) {
8889
8896
  return;
8890
8897
  }
8898
+ var allowedOrigins = _this.settings.allowedOrigins || [];
8899
+ if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
8900
+ _this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
8901
+ return;
8902
+ }
8891
8903
  _this.registry.execute("onMessage", extData);
8892
8904
  });
8893
8905
  if (this.connectionResolve) {
@@ -9765,7 +9777,7 @@
9765
9777
  }
9766
9778
  };
9767
9779
 
9768
- var version = "6.1.0";
9780
+ var version = "6.1.1";
9769
9781
 
9770
9782
  function prepareConfig (configuration, ext, glue42gd) {
9771
9783
  var _a, _b, _c, _d;
@@ -13546,41 +13558,46 @@
13546
13558
  return this.registerCore(methodDefinition, wrappedCallbackFunction);
13547
13559
  };
13548
13560
  Server.prototype.registerAsync = function (methodDefinition, callback) {
13561
+ var _this = this;
13549
13562
  if (!methodDefinition) {
13550
13563
  return Promise.reject("Method definition is required. Please, provide either a unique string for a method name or a “methodDefinition” object with a required “name” property.");
13551
13564
  }
13552
13565
  if (typeof callback !== "function") {
13553
13566
  return Promise.reject("The second parameter must be a callback function. Method: ".concat(typeof methodDefinition === "string" ? methodDefinition : methodDefinition.name));
13554
13567
  }
13555
- var wrappedCallback = function (context, resultCallback) {
13556
- try {
13557
- var resultCalled_1 = false;
13558
- var success = function (result) {
13559
- if (!resultCalled_1) {
13560
- resultCallback(undefined, result);
13561
- }
13562
- resultCalled_1 = true;
13563
- };
13564
- var error = function (e) {
13565
- if (!resultCalled_1) {
13566
- if (!e) {
13567
- e = "";
13568
+ var wrappedCallback = function (context, resultCallback) { return __awaiter(_this, void 0, void 0, function () {
13569
+ var resultCalled_1, success, error, methodResult;
13570
+ return __generator(this, function (_a) {
13571
+ try {
13572
+ resultCalled_1 = false;
13573
+ success = function (result) {
13574
+ if (!resultCalled_1) {
13575
+ resultCallback(undefined, result);
13568
13576
  }
13569
- resultCallback(e, e);
13577
+ resultCalled_1 = true;
13578
+ };
13579
+ error = function (e) {
13580
+ if (!resultCalled_1) {
13581
+ if (!e) {
13582
+ e = "";
13583
+ }
13584
+ resultCallback(e, e);
13585
+ }
13586
+ resultCalled_1 = true;
13587
+ };
13588
+ methodResult = callback(context.args, context.instance, success, error);
13589
+ if (methodResult && typeof methodResult.then === "function") {
13590
+ methodResult
13591
+ .then(success)
13592
+ .catch(error);
13570
13593
  }
13571
- resultCalled_1 = true;
13572
- };
13573
- var methodResult = callback(context.args, context.instance, success, error);
13574
- if (methodResult && typeof methodResult.then === "function") {
13575
- methodResult
13576
- .then(success)
13577
- .catch(error);
13578
13594
  }
13579
- }
13580
- catch (e) {
13581
- resultCallback(e, undefined);
13582
- }
13583
- };
13595
+ catch (e) {
13596
+ resultCallback(e, undefined);
13597
+ }
13598
+ return [2];
13599
+ });
13600
+ }); };
13584
13601
  wrappedCallback.userCallbackAsync = callback;
13585
13602
  return this.registerCore(methodDefinition, wrappedCallback);
13586
13603
  };
@@ -13691,7 +13708,7 @@
13691
13708
  return [2, Promise.reject("Please, provide a (unique) string value for the \u201Cname\u201D property in the \u201CmethodDefinition\u201D object: ".concat(JSON.stringify(method)))];
13692
13709
  }
13693
13710
  unregisterInProgress = this.currentlyUnregistering[methodDefinition.name];
13694
- if (!unregisterInProgress) return [3, 2];
13711
+ if (!(typeof unregisterInProgress !== "undefined")) return [3, 2];
13695
13712
  return [4, unregisterInProgress];
13696
13713
  case 1:
13697
13714
  _a.sent();