@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.
- package/browser.d.ts +35 -10
- package/changelog.md +4 -0
- package/dist/browser.es.js +52 -35
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.umd.js +52 -35
- package/dist/browser.umd.js.map +1 -1
- package/dist/browser.umd.min.js +1 -1
- package/package.json +6 -6
package/browser.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { IOConnectCore } from "@interopio/core";
|
|
|
6
6
|
import { IOConnectDesktop } from "@interopio/desktop";
|
|
7
7
|
import { IOConnectWorkspaces } from "@interopio/workspaces-api";
|
|
8
8
|
import { IOConnectSearch } from "@interopio/search-api";
|
|
9
|
-
import { WindowOnChannelInfo, WindowWithChannelFilter } from "./src/channels/protocol";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Factory function that creates a new ioconnect instance.
|
|
@@ -858,9 +857,10 @@ export namespace IOConnectBrowser {
|
|
|
858
857
|
/**
|
|
859
858
|
* Joins a new channel by name. Leaves the current channel.
|
|
860
859
|
* @param name The name of the channel to join.
|
|
860
|
+
* @param windowId ID of a window which to join to a Channel. If not provided, will join the current window to the specified Channel.
|
|
861
861
|
* @returns Promise that resolves when the channel has been joined.
|
|
862
862
|
*/
|
|
863
|
-
join(name: string): Promise<void>;
|
|
863
|
+
join(name: string, windowId?: string): Promise<void>;
|
|
864
864
|
|
|
865
865
|
/**
|
|
866
866
|
* Leaves the current channel.
|
|
@@ -936,6 +936,31 @@ export namespace IOConnectBrowser {
|
|
|
936
936
|
/** Channel data. */
|
|
937
937
|
data: any;
|
|
938
938
|
}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Filter for retrieving windows that can use Channels.
|
|
942
|
+
*/
|
|
943
|
+
export interface WindowWithChannelFilter {
|
|
944
|
+
/** Name of the app whose window instances to retrieve. */
|
|
945
|
+
application?: string;
|
|
946
|
+
/** List of Channel names. Only the windows that are joined to one of the specified Channels will be retrieved. */
|
|
947
|
+
channels?: string[];
|
|
948
|
+
/** IDs of windows to retrieve. */
|
|
949
|
+
windowIds?: string[];
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* Describes a window that can use Channels.
|
|
954
|
+
*/
|
|
955
|
+
export interface WindowOnChannelInfo {
|
|
956
|
+
/** Name of the app to which the window instance belongs. */
|
|
957
|
+
application: string;
|
|
958
|
+
/** Name of the Channel to which the window is joined. */
|
|
959
|
+
channel: string | undefined;
|
|
960
|
+
/** Describes the window instance. */
|
|
961
|
+
window: IOConnectBrowser.Windows.WebWindow
|
|
962
|
+
}
|
|
963
|
+
|
|
939
964
|
}
|
|
940
965
|
|
|
941
966
|
/**
|
|
@@ -1254,8 +1279,8 @@ export namespace IOConnectBrowser {
|
|
|
1254
1279
|
intents?: Intent[];
|
|
1255
1280
|
}
|
|
1256
1281
|
|
|
1257
|
-
|
|
1258
|
-
|
|
1282
|
+
/** App Image holder */
|
|
1283
|
+
interface ImageV1 {
|
|
1259
1284
|
/**
|
|
1260
1285
|
* App Image URL.
|
|
1261
1286
|
*/
|
|
@@ -1417,7 +1442,7 @@ export namespace IOConnectBrowser {
|
|
|
1417
1442
|
size?: string;
|
|
1418
1443
|
type?: string;
|
|
1419
1444
|
}
|
|
1420
|
-
|
|
1445
|
+
|
|
1421
1446
|
interface ImageV2 {
|
|
1422
1447
|
src: string;
|
|
1423
1448
|
size?: string;
|
|
@@ -1431,19 +1456,19 @@ export namespace IOConnectBrowser {
|
|
|
1431
1456
|
listensFor?: { [intentName: string]: IntentV2 };
|
|
1432
1457
|
raises?: { [intentName: string]: string[] };
|
|
1433
1458
|
}
|
|
1434
|
-
|
|
1459
|
+
|
|
1435
1460
|
interface InteropUserChannelV2 {
|
|
1436
1461
|
broadcasts?: string[];
|
|
1437
1462
|
listensFor?: string[];
|
|
1438
1463
|
}
|
|
1439
|
-
|
|
1464
|
+
|
|
1440
1465
|
interface InteropAppChannelV2 {
|
|
1441
1466
|
name: string;
|
|
1442
1467
|
description?: string;
|
|
1443
1468
|
broadcasts?: string[];
|
|
1444
1469
|
listensFor?: string[];
|
|
1445
1470
|
}
|
|
1446
|
-
|
|
1471
|
+
|
|
1447
1472
|
interface InteropV2 {
|
|
1448
1473
|
intents?: InteropIntentsV2;
|
|
1449
1474
|
userChannels?: InteropUserChannelV2;
|
|
@@ -1620,10 +1645,10 @@ export namespace IOConnectBrowser {
|
|
|
1620
1645
|
* The handler callback will be invoked whenever an intent is raised and your app was selected as an IntentTarget.
|
|
1621
1646
|
* You can also use this method to register new dynamic intents, that will have the the same lifespan as your application instance.
|
|
1622
1647
|
* @param intent The intent to be handled. The intent name of an object containing the intent, contextTypes that the intent can handle and a display name.
|
|
1623
|
-
* @param handler The callback that will handle a raised intent. Will be called with an IntentContext if it is provided by the raising application.
|
|
1648
|
+
* @param handler The callback that will handle a raised intent. Will be called with an IntentContext if it is provided by the raising application and caller - the Interop Instance which raised the intent.
|
|
1624
1649
|
* @returns Promise that resolves to an object with an unsubscribe function under the unsubscribe property.
|
|
1625
1650
|
*/
|
|
1626
|
-
register(intent: string | AddIntentListenerRequest, handler: (context: IntentContext) => any): Promise<{ unsubscribe: UnsubscribeFunction }>;
|
|
1651
|
+
register(intent: string | AddIntentListenerRequest, handler: (context: IntentContext, caller?: IOConnectCore.Interop.Instance) => any): Promise<{ unsubscribe: UnsubscribeFunction }>;
|
|
1627
1652
|
|
|
1628
1653
|
/**
|
|
1629
1654
|
* Searches for registered intents.
|
package/changelog.md
CHANGED
package/dist/browser.es.js
CHANGED
|
@@ -1946,7 +1946,7 @@ class FDC3Service {
|
|
|
1946
1946
|
mergeBaseAppDataWithGlueManifest(baseAppData, hostManifestDefinition) {
|
|
1947
1947
|
let baseApplicationDefinition = baseAppData;
|
|
1948
1948
|
if (hostManifestDefinition.details) {
|
|
1949
|
-
const details = hostManifestDefinition.details;
|
|
1949
|
+
const details = Object.assign(Object.assign({}, baseAppData.createOptions), hostManifestDefinition.details);
|
|
1950
1950
|
baseApplicationDefinition.createOptions = details;
|
|
1951
1951
|
baseApplicationDefinition.userProperties.details = details;
|
|
1952
1952
|
}
|
|
@@ -1959,8 +1959,7 @@ class FDC3Service {
|
|
|
1959
1959
|
return baseApplicationDefinition;
|
|
1960
1960
|
}
|
|
1961
1961
|
mergeDesktopConfigWithGlueManifest(config, desktopDefinition) {
|
|
1962
|
-
|
|
1963
|
-
appConfig = Object.assign(Object.assign({}, config), desktopDefinition);
|
|
1962
|
+
const appConfig = Object.assign({}, config, desktopDefinition, { details: Object.assign(Object.assign({}, config.details), desktopDefinition.details) });
|
|
1964
1963
|
if (Array.isArray(desktopDefinition.intents)) {
|
|
1965
1964
|
appConfig.intents = (config.intents || []).concat(desktopDefinition.intents);
|
|
1966
1965
|
}
|
|
@@ -4774,7 +4773,8 @@ class IntentsController {
|
|
|
4774
4773
|
}
|
|
4775
4774
|
registerPromise = this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
4776
4775
|
if (this.myIntents.has(intentName)) {
|
|
4777
|
-
|
|
4776
|
+
const rest = __rest$2(args, ["_initialCallerId"]);
|
|
4777
|
+
return handler(rest);
|
|
4778
4778
|
}
|
|
4779
4779
|
});
|
|
4780
4780
|
registerPromise.catch(err => {
|
|
@@ -4805,7 +4805,9 @@ class IntentsController {
|
|
|
4805
4805
|
try {
|
|
4806
4806
|
yield this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
4807
4807
|
if (this.myIntents.has(intentName)) {
|
|
4808
|
-
|
|
4808
|
+
const { _initialCallerId } = args, rest = __rest$2(args, ["_initialCallerId"]);
|
|
4809
|
+
const caller = this.interop.servers().find((server) => server.instance === _initialCallerId);
|
|
4810
|
+
return handler(rest, caller);
|
|
4809
4811
|
}
|
|
4810
4812
|
});
|
|
4811
4813
|
}
|
|
@@ -6116,7 +6118,7 @@ class IoC {
|
|
|
6116
6118
|
}
|
|
6117
6119
|
}
|
|
6118
6120
|
|
|
6119
|
-
var version$2 = "3.1.
|
|
6121
|
+
var version$2 = "3.1.3";
|
|
6120
6122
|
|
|
6121
6123
|
const createFactoryFunction = (coreFactoryFunction) => {
|
|
6122
6124
|
return (userConfig) => __awaiter$1(void 0, void 0, void 0, function* () {
|
|
@@ -8437,7 +8439,7 @@ var GW3ProtocolImpl = (function () {
|
|
|
8437
8439
|
});
|
|
8438
8440
|
};
|
|
8439
8441
|
GW3ProtocolImpl.prototype.getNewGWToken = function () {
|
|
8440
|
-
if (typeof window !== undefined) {
|
|
8442
|
+
if (typeof window !== "undefined") {
|
|
8441
8443
|
var glue42gd = window.glue42gd;
|
|
8442
8444
|
if (glue42gd) {
|
|
8443
8445
|
return glue42gd.getGWToken();
|
|
@@ -8775,6 +8777,11 @@ var WebPlatformTransport = (function () {
|
|
|
8775
8777
|
if (!data || _this.rejected) {
|
|
8776
8778
|
return;
|
|
8777
8779
|
}
|
|
8780
|
+
var allowedOrigins = _this.settings.allowedOrigins || [];
|
|
8781
|
+
if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
|
|
8782
|
+
_this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
|
|
8783
|
+
return;
|
|
8784
|
+
}
|
|
8778
8785
|
if (!_this.checkMessageTypeValid(data.type)) {
|
|
8779
8786
|
_this.logger.error("cannot handle the incoming glue42 core message, because the type is invalid: ".concat(data.type));
|
|
8780
8787
|
return;
|
|
@@ -8882,6 +8889,11 @@ var WebPlatformTransport = (function () {
|
|
|
8882
8889
|
if (!extData) {
|
|
8883
8890
|
return;
|
|
8884
8891
|
}
|
|
8892
|
+
var allowedOrigins = _this.settings.allowedOrigins || [];
|
|
8893
|
+
if (allowedOrigins.length && !allowedOrigins.includes(event.origin)) {
|
|
8894
|
+
_this.logger.warn("received a message from an origin which is not in the allowed list: ".concat(event.origin));
|
|
8895
|
+
return;
|
|
8896
|
+
}
|
|
8885
8897
|
_this.registry.execute("onMessage", extData);
|
|
8886
8898
|
});
|
|
8887
8899
|
if (this.connectionResolve) {
|
|
@@ -9759,7 +9771,7 @@ var ContextMessageReplaySpec = {
|
|
|
9759
9771
|
}
|
|
9760
9772
|
};
|
|
9761
9773
|
|
|
9762
|
-
var version = "6.1.
|
|
9774
|
+
var version = "6.1.1";
|
|
9763
9775
|
|
|
9764
9776
|
function prepareConfig (configuration, ext, glue42gd) {
|
|
9765
9777
|
var _a, _b, _c, _d;
|
|
@@ -13540,41 +13552,46 @@ var Server = (function () {
|
|
|
13540
13552
|
return this.registerCore(methodDefinition, wrappedCallbackFunction);
|
|
13541
13553
|
};
|
|
13542
13554
|
Server.prototype.registerAsync = function (methodDefinition, callback) {
|
|
13555
|
+
var _this = this;
|
|
13543
13556
|
if (!methodDefinition) {
|
|
13544
13557
|
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.");
|
|
13545
13558
|
}
|
|
13546
13559
|
if (typeof callback !== "function") {
|
|
13547
13560
|
return Promise.reject("The second parameter must be a callback function. Method: ".concat(typeof methodDefinition === "string" ? methodDefinition : methodDefinition.name));
|
|
13548
13561
|
}
|
|
13549
|
-
var wrappedCallback = function (context, resultCallback) {
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
};
|
|
13558
|
-
var error = function (e) {
|
|
13559
|
-
if (!resultCalled_1) {
|
|
13560
|
-
if (!e) {
|
|
13561
|
-
e = "";
|
|
13562
|
+
var wrappedCallback = function (context, resultCallback) { return __awaiter(_this, void 0, void 0, function () {
|
|
13563
|
+
var resultCalled_1, success, error, methodResult;
|
|
13564
|
+
return __generator(this, function (_a) {
|
|
13565
|
+
try {
|
|
13566
|
+
resultCalled_1 = false;
|
|
13567
|
+
success = function (result) {
|
|
13568
|
+
if (!resultCalled_1) {
|
|
13569
|
+
resultCallback(undefined, result);
|
|
13562
13570
|
}
|
|
13563
|
-
|
|
13571
|
+
resultCalled_1 = true;
|
|
13572
|
+
};
|
|
13573
|
+
error = function (e) {
|
|
13574
|
+
if (!resultCalled_1) {
|
|
13575
|
+
if (!e) {
|
|
13576
|
+
e = "";
|
|
13577
|
+
}
|
|
13578
|
+
resultCallback(e, e);
|
|
13579
|
+
}
|
|
13580
|
+
resultCalled_1 = true;
|
|
13581
|
+
};
|
|
13582
|
+
methodResult = callback(context.args, context.instance, success, error);
|
|
13583
|
+
if (methodResult && typeof methodResult.then === "function") {
|
|
13584
|
+
methodResult
|
|
13585
|
+
.then(success)
|
|
13586
|
+
.catch(error);
|
|
13564
13587
|
}
|
|
13565
|
-
resultCalled_1 = true;
|
|
13566
|
-
};
|
|
13567
|
-
var methodResult = callback(context.args, context.instance, success, error);
|
|
13568
|
-
if (methodResult && typeof methodResult.then === "function") {
|
|
13569
|
-
methodResult
|
|
13570
|
-
.then(success)
|
|
13571
|
-
.catch(error);
|
|
13572
13588
|
}
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13589
|
+
catch (e) {
|
|
13590
|
+
resultCallback(e, undefined);
|
|
13591
|
+
}
|
|
13592
|
+
return [2];
|
|
13593
|
+
});
|
|
13594
|
+
}); };
|
|
13578
13595
|
wrappedCallback.userCallbackAsync = callback;
|
|
13579
13596
|
return this.registerCore(methodDefinition, wrappedCallback);
|
|
13580
13597
|
};
|
|
@@ -13685,7 +13702,7 @@ var Server = (function () {
|
|
|
13685
13702
|
return [2, Promise.reject("Please, provide a (unique) string value for the \u201Cname\u201D property in the \u201CmethodDefinition\u201D object: ".concat(JSON.stringify(method)))];
|
|
13686
13703
|
}
|
|
13687
13704
|
unregisterInProgress = this.currentlyUnregistering[methodDefinition.name];
|
|
13688
|
-
if (!unregisterInProgress) return [3, 2];
|
|
13705
|
+
if (!(typeof unregisterInProgress !== "undefined")) return [3, 2];
|
|
13689
13706
|
return [4, unregisterInProgress];
|
|
13690
13707
|
case 1:
|
|
13691
13708
|
_a.sent();
|