@interopio/browser 3.2.3 → 3.3.1
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 +99 -5
- package/dist/browser.es.js +224 -37
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.umd.js +224 -37
- package/dist/browser.umd.js.map +1 -1
- package/dist/browser.umd.min.js +1 -1
- package/package.json +7 -6
package/browser.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ 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 { IOBrowserWidget } from "@interopio/widget";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Factory function that creates a new ioconnect instance.
|
|
@@ -104,6 +105,9 @@ export namespace IOConnectBrowser {
|
|
|
104
105
|
|
|
105
106
|
/* Enable and configure Intents Resolver UI */
|
|
106
107
|
intents?: IOConnectBrowser.Intents.Config;
|
|
108
|
+
|
|
109
|
+
/* Configure widget */
|
|
110
|
+
widget?: IOBrowserWidget.Config;
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
export interface SystemLogger {
|
|
@@ -465,6 +469,25 @@ export namespace IOConnectBrowser {
|
|
|
465
469
|
* Removes the default Global Layout.
|
|
466
470
|
*/
|
|
467
471
|
clearDefaultGlobal(): Promise<void>;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Renames a Layout.
|
|
475
|
+
* @param layout Existing Layout to rename.
|
|
476
|
+
* @param newName New name for the Layout.
|
|
477
|
+
*/
|
|
478
|
+
rename(layout: Layout, newName: string): Promise<LayoutResult>;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Notifies when a Layout is renamed.
|
|
482
|
+
* @param callback Callback function to handle the event. Receives the `Layout` object as an argument and returns an unsubscribe function.
|
|
483
|
+
*/
|
|
484
|
+
onRenamed(callback: (layout: Layout) => void): () => void;
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Updates the metadata of a Layout.
|
|
488
|
+
* @param layout Existing Layout to update.
|
|
489
|
+
*/
|
|
490
|
+
updateMetadata(layout: Layout): Promise<void>;
|
|
468
491
|
}
|
|
469
492
|
|
|
470
493
|
/**
|
|
@@ -666,6 +689,14 @@ export namespace IOConnectBrowser {
|
|
|
666
689
|
/** Type of the Layout. */
|
|
667
690
|
layoutType: LayoutType;
|
|
668
691
|
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Describes the base result returned by methods for manipulating Layouts - e.g., renaming, hibernating, updating default context.
|
|
695
|
+
*/
|
|
696
|
+
export interface LayoutResult {
|
|
697
|
+
/** Status of the Layout operation. If successful, will be set to "Success", otherwise, will contain the returned error message. */
|
|
698
|
+
status: string;
|
|
699
|
+
}
|
|
669
700
|
}
|
|
670
701
|
|
|
671
702
|
/**
|
|
@@ -975,13 +1006,17 @@ export namespace IOConnectBrowser {
|
|
|
975
1006
|
onChanged(callback: (channel: string) => void): UnsubscribeFunction;
|
|
976
1007
|
|
|
977
1008
|
/**
|
|
978
|
-
* Adds a new
|
|
979
|
-
* @
|
|
980
|
-
* @param info The initial channel context.
|
|
981
|
-
* @returns Promise that resolves with the initial channel context.
|
|
1009
|
+
* Adds a new Channel.
|
|
1010
|
+
* @param info Initial Channel context.
|
|
982
1011
|
*/
|
|
983
1012
|
add(info: ChannelContext): Promise<ChannelContext>;
|
|
984
1013
|
|
|
1014
|
+
/**
|
|
1015
|
+
* Removes a Channel.
|
|
1016
|
+
* @param name The name of the Channel to remove.
|
|
1017
|
+
*/
|
|
1018
|
+
remove(name: string): Promise<void>;
|
|
1019
|
+
|
|
985
1020
|
/**
|
|
986
1021
|
* Retrieves the context of the current Channel.
|
|
987
1022
|
* @returns Promise that resolves with the context of the current Channel.
|
|
@@ -1000,7 +1035,66 @@ export namespace IOConnectBrowser {
|
|
|
1000
1035
|
* @param filter Filter describing which windows to retrieve. If no filter is supplied, will return all windows that can use Channels.
|
|
1001
1036
|
* @returns Promise that resolves with the list of all windows that can use Channels together with their current Channel.
|
|
1002
1037
|
*/
|
|
1003
|
-
getWindowsWithChannels(filter?: WindowWithChannelFilter): Promise<WindowOnChannelInfo[]
|
|
1038
|
+
getWindowsWithChannels(filter?: WindowWithChannelFilter): Promise<WindowOnChannelInfo[]>;
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Prevents or allows the current or another window to publish or subscribe to a specific Channel.
|
|
1042
|
+
* @param restrictions Restrictions for publishing or subscribing to a specific Channel.
|
|
1043
|
+
* @since io.Connect Browser 3.3
|
|
1044
|
+
*/
|
|
1045
|
+
restrict(config: ChannelRestrictions): Promise<void>;
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Retrieves the restrictions applied to the current window for publishing or subscribing to Channels. Pass a window ID to retrieve the restrictions for the specified window.
|
|
1049
|
+
* @param windowId ID of the window for which to retrieve the applied restrictions for publishing or subscribing to Channels.
|
|
1050
|
+
* @since io.Connect Browser 3.3
|
|
1051
|
+
*/
|
|
1052
|
+
getRestrictions(windowId?: string): Promise<Restrictions>;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Prevents or allows the current or another window to publish or subscribe to all Channels.
|
|
1056
|
+
* @param restrictions Restrictions for publishing or subscribing to all Channels.
|
|
1057
|
+
* @since io.Connect Browser 3.3
|
|
1058
|
+
*/
|
|
1059
|
+
restrictAll(restrictions: RestrictionsConfig): Promise<void>;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* All restrictions applied to a window for publishing or subscribing to Channels.
|
|
1064
|
+
*/
|
|
1065
|
+
export interface Restrictions {
|
|
1066
|
+
/**
|
|
1067
|
+
* List of restrictions for publishing or subscribing to Channels.
|
|
1068
|
+
*/
|
|
1069
|
+
channels: ChannelRestrictions[];
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Restrictions applied to a window for publishing or subscribing to a specific Channel.
|
|
1074
|
+
*/
|
|
1075
|
+
export interface ChannelRestrictions extends RestrictionsConfig {
|
|
1076
|
+
/**
|
|
1077
|
+
* Name of the Channel for which the restrictions apply.
|
|
1078
|
+
*/
|
|
1079
|
+
name: string;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Restrictions applied to a window for publishing or subscribing to all Channels.
|
|
1084
|
+
*/
|
|
1085
|
+
export interface RestrictionsConfig {
|
|
1086
|
+
/**
|
|
1087
|
+
* If `true`, the window will be able to subscribe to the specified Channel.
|
|
1088
|
+
*/
|
|
1089
|
+
read: boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* If `true`, the window will be able to publish to the specified Channel.
|
|
1092
|
+
*/
|
|
1093
|
+
write: boolean;
|
|
1094
|
+
/**
|
|
1095
|
+
* ID of the window for which apply the restrictions for publishing or subscribing to Channels.
|
|
1096
|
+
*/
|
|
1097
|
+
windowId?: string;
|
|
1004
1098
|
}
|
|
1005
1099
|
|
|
1006
1100
|
/**
|
package/dist/browser.es.js
CHANGED
|
@@ -1672,7 +1672,8 @@ const glue42HostManifestsBrowserDecoder = object({
|
|
|
1672
1672
|
hidden: optional(boolean())
|
|
1673
1673
|
});
|
|
1674
1674
|
const hostManifestsBrowserDecoder = oneOf(object({
|
|
1675
|
-
"
|
|
1675
|
+
"ioConnect": optional(oneOf(glue42HostManifestsBrowserDecoder, anyJson())),
|
|
1676
|
+
"Glue42": optional(oneOf(glue42HostManifestsBrowserDecoder, anyJson()))
|
|
1676
1677
|
}), anyJson());
|
|
1677
1678
|
const v1DefinitionDecoder = object({
|
|
1678
1679
|
name: nonEmptyStringDecoder$1,
|
|
@@ -1778,7 +1779,7 @@ class FDC3Service {
|
|
|
1778
1779
|
}
|
|
1779
1780
|
const userProperties = this.getUserPropertiesFromDefinition(definition, version);
|
|
1780
1781
|
const createOptions = { url: this.getUrl(definition, version) };
|
|
1781
|
-
|
|
1782
|
+
const baseApplicationData = {
|
|
1782
1783
|
name: definition.appId,
|
|
1783
1784
|
type: "window",
|
|
1784
1785
|
createOptions,
|
|
@@ -1795,17 +1796,18 @@ class FDC3Service {
|
|
|
1795
1796
|
caption: definition.description,
|
|
1796
1797
|
fdc3: version === "2.0" ? { ...definition, definitionVersion: "2.0" } : undefined,
|
|
1797
1798
|
};
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
}
|
|
1806
|
-
baseApplicationData = this.mergeBaseAppDataWithGlueManifest(baseApplicationData, decodeRes.result);
|
|
1799
|
+
const ioConnectDefinition = definition.hostManifests?.ioConnect || definition.hostManifests?.["Glue42"];
|
|
1800
|
+
if (!ioConnectDefinition) {
|
|
1801
|
+
return baseApplicationData;
|
|
1802
|
+
}
|
|
1803
|
+
const ioDefinitionDecodeRes = glue42HostManifestsBrowserDecoder.run(ioConnectDefinition);
|
|
1804
|
+
if (!ioDefinitionDecodeRes.ok) {
|
|
1805
|
+
throw new Error(`Invalid FDC3 ${version} definition. Error: ${parseDecoderErrorToStringMessage(ioDefinitionDecodeRes.error)}`);
|
|
1807
1806
|
}
|
|
1808
|
-
|
|
1807
|
+
if (!Object.keys(ioDefinitionDecodeRes.result).length) {
|
|
1808
|
+
return baseApplicationData;
|
|
1809
|
+
}
|
|
1810
|
+
return this.mergeBaseAppDataWithGlueManifest(baseApplicationData, ioDefinitionDecodeRes.result);
|
|
1809
1811
|
}
|
|
1810
1812
|
parseToDesktopAppConfig(definition) {
|
|
1811
1813
|
const { isFdc3, version } = this.isFdc3Definition(definition);
|
|
@@ -1842,7 +1844,7 @@ class FDC3Service {
|
|
|
1842
1844
|
};
|
|
1843
1845
|
}
|
|
1844
1846
|
const fdc3v2Definition = definition;
|
|
1845
|
-
|
|
1847
|
+
const desktopDefinition = {
|
|
1846
1848
|
name: fdc3v2Definition.appId,
|
|
1847
1849
|
type: this.fdc3ToDesktopDefinitionType[fdc3v2Definition.type],
|
|
1848
1850
|
details: fdc3v2Definition.details,
|
|
@@ -1854,13 +1856,14 @@ class FDC3Service {
|
|
|
1854
1856
|
intents: this.getIntentsFromV2AppDefinition(fdc3v2Definition),
|
|
1855
1857
|
fdc3: { ...fdc3v2Definition, definitionVersion: "2.0" }
|
|
1856
1858
|
};
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
}
|
|
1861
|
-
desktopDefinition = this.mergeDesktopConfigWithGlueManifest(desktopDefinition, fdc3v2Definition.hostManifests?.["Glue42"]);
|
|
1859
|
+
const ioConnectDefinition = definition.hostManifests?.ioConnect || definition.hostManifests?.["Glue42"];
|
|
1860
|
+
if (!ioConnectDefinition) {
|
|
1861
|
+
return desktopDefinition;
|
|
1862
1862
|
}
|
|
1863
|
-
|
|
1863
|
+
if (typeof ioConnectDefinition !== "object" || Array.isArray(ioConnectDefinition)) {
|
|
1864
|
+
throw new Error(`Invalid '${definition.hostManifests.ioConnect ? "hostManifests.ioConnect" : "hostManifests['Glue42']"}' key`);
|
|
1865
|
+
}
|
|
1866
|
+
return this.mergeDesktopConfigWithGlueManifest(desktopDefinition, ioConnectDefinition);
|
|
1864
1867
|
}
|
|
1865
1868
|
getUserPropertiesFromDefinition(definition, version) {
|
|
1866
1869
|
if (version === "1.2") {
|
|
@@ -1984,7 +1987,7 @@ const optionalNonEmptyStringDecoder = optional$1(nonEmptyStringDecoder);
|
|
|
1984
1987
|
const libDomainDecoder = oneOf$1(constant$1("system"), constant$1("windows"), constant$1("appManager"), constant$1("layouts"), constant$1("intents"), constant$1("notifications"), constant$1("channels"), constant$1("extension"), constant$1("themes"), constant$1("prefs"));
|
|
1985
1988
|
const windowOperationTypesDecoder = oneOf$1(constant$1("openWindow"), constant$1("windowHello"), constant$1("windowAdded"), constant$1("windowRemoved"), constant$1("getBounds"), constant$1("getFrameBounds"), constant$1("getUrl"), constant$1("moveResize"), constant$1("focus"), constant$1("close"), constant$1("getTitle"), constant$1("setTitle"), constant$1("focusChange"), constant$1("getChannel"));
|
|
1986
1989
|
const appManagerOperationTypesDecoder = oneOf$1(constant$1("appHello"), constant$1("appDirectoryStateChange"), constant$1("instanceStarted"), constant$1("instanceStopped"), constant$1("applicationStart"), constant$1("instanceStop"), constant$1("clear"));
|
|
1987
|
-
const layoutsOperationTypesDecoder = oneOf$1(constant$1("layoutAdded"), constant$1("layoutChanged"), constant$1("layoutRemoved"), constant$1("get"), constant$1("getAll"), constant$1("export"), constant$1("import"), constant$1("remove"), constant$1("clientSaveRequest"), constant$1("getGlobalPermissionState"), constant$1("checkGlobalActivated"), constant$1("requestGlobalPermission"), constant$1("getDefaultGlobal"), constant$1("setDefaultGlobal"), constant$1("clearDefaultGlobal"));
|
|
1990
|
+
const layoutsOperationTypesDecoder = oneOf$1(constant$1("layoutAdded"), constant$1("layoutChanged"), constant$1("layoutRemoved"), constant$1("layoutRenamed"), constant$1("get"), constant$1("getAll"), constant$1("export"), constant$1("import"), constant$1("remove"), constant$1("rename"), constant$1("clientSaveRequest"), constant$1("getGlobalPermissionState"), constant$1("checkGlobalActivated"), constant$1("requestGlobalPermission"), constant$1("getDefaultGlobal"), constant$1("setDefaultGlobal"), constant$1("clearDefaultGlobal"), constant$1("updateMetadata"));
|
|
1988
1991
|
const notificationsOperationTypesDecoder = oneOf$1(constant$1("raiseNotification"), constant$1("requestPermission"), constant$1("notificationShow"), constant$1("notificationClick"), constant$1("getPermission"), constant$1("list"), constant$1("notificationRaised"), constant$1("notificationClosed"), constant$1("click"), constant$1("clear"), constant$1("clearAll"), constant$1("configure"), constant$1("getConfiguration"), constant$1("configurationChanged"), constant$1("setState"), constant$1("clearOld"), constant$1("activeCountChange"), constant$1("stateChange"));
|
|
1989
1992
|
const systemOperationTypesDecoder = oneOf$1(constant$1("getEnvironment"), constant$1("getBase"), constant$1("platformShutdown"));
|
|
1990
1993
|
const windowRelativeDirectionDecoder = oneOf$1(constant$1("top"), constant$1("left"), constant$1("right"), constant$1("bottom"));
|
|
@@ -2285,6 +2288,16 @@ const simpleLayoutConfigDecoder = object$1({
|
|
|
2285
2288
|
const saveLayoutConfigDecoder = object$1({
|
|
2286
2289
|
layout: newLayoutOptionsDecoder
|
|
2287
2290
|
});
|
|
2291
|
+
const renameLayoutConfigDecoder = object$1({
|
|
2292
|
+
layout: glueLayoutDecoder,
|
|
2293
|
+
newName: nonEmptyStringDecoder
|
|
2294
|
+
});
|
|
2295
|
+
const layoutResultDecoder = object$1({
|
|
2296
|
+
status: nonEmptyStringDecoder
|
|
2297
|
+
});
|
|
2298
|
+
const updateLayoutMetadataConfigDecoder = object$1({
|
|
2299
|
+
layout: glueLayoutDecoder,
|
|
2300
|
+
});
|
|
2288
2301
|
const restoreLayoutConfigDecoder = object$1({
|
|
2289
2302
|
layout: restoreOptionsDecoder
|
|
2290
2303
|
});
|
|
@@ -2298,7 +2311,7 @@ const importModeDecoder = oneOf$1(constant$1("replace"), constant$1("merge"));
|
|
|
2298
2311
|
const layoutsImportConfigDecoder = object$1({
|
|
2299
2312
|
layouts: array$1(glueLayoutDecoder),
|
|
2300
2313
|
mode: importModeDecoder,
|
|
2301
|
-
|
|
2314
|
+
skipManagerRequest: optional$1(boolean$1())
|
|
2302
2315
|
});
|
|
2303
2316
|
const allLayoutsSummariesResultDecoder = object$1({
|
|
2304
2317
|
summaries: array$1(layoutSummaryDecoder)
|
|
@@ -2486,6 +2499,38 @@ const channelContextDecoder = object$1({
|
|
|
2486
2499
|
}),
|
|
2487
2500
|
data: optional$1(object$1()),
|
|
2488
2501
|
});
|
|
2502
|
+
const removeChannelDataDecoder = object$1({
|
|
2503
|
+
name: nonEmptyStringDecoder
|
|
2504
|
+
});
|
|
2505
|
+
const channelRestrictionsDecoder = object$1({
|
|
2506
|
+
name: nonEmptyStringDecoder,
|
|
2507
|
+
read: boolean$1(),
|
|
2508
|
+
write: boolean$1(),
|
|
2509
|
+
windowId: optional$1(nonEmptyStringDecoder)
|
|
2510
|
+
});
|
|
2511
|
+
const channelRestrictionConfigWithWindowIdDecoder = object$1({
|
|
2512
|
+
name: nonEmptyStringDecoder,
|
|
2513
|
+
read: boolean$1(),
|
|
2514
|
+
write: boolean$1(),
|
|
2515
|
+
windowId: nonEmptyStringDecoder
|
|
2516
|
+
});
|
|
2517
|
+
const restrictionConfigDataDecoder = object$1({
|
|
2518
|
+
config: channelRestrictionConfigWithWindowIdDecoder
|
|
2519
|
+
});
|
|
2520
|
+
const restrictionsDecoder = object$1({
|
|
2521
|
+
channels: array$1(channelRestrictionsDecoder)
|
|
2522
|
+
});
|
|
2523
|
+
const getRestrictionsDataDecoder = object$1({
|
|
2524
|
+
windowId: nonEmptyStringDecoder
|
|
2525
|
+
});
|
|
2526
|
+
const restrictionsConfigDecoder = object$1({
|
|
2527
|
+
read: boolean$1(),
|
|
2528
|
+
write: boolean$1(),
|
|
2529
|
+
windowId: optional$1(nonEmptyStringDecoder)
|
|
2530
|
+
});
|
|
2531
|
+
const restrictAllDataDecoder = object$1({
|
|
2532
|
+
restrictions: restrictionsConfigDecoder
|
|
2533
|
+
});
|
|
2489
2534
|
const raiseNotificationDecoder = object$1({
|
|
2490
2535
|
settings: glue42NotificationOptionsDecoder,
|
|
2491
2536
|
id: nonEmptyStringDecoder
|
|
@@ -2604,7 +2649,7 @@ const getWindowIdsOnChannelDataDecoder = object$1({
|
|
|
2604
2649
|
const getWindowIdsOnChannelResultDecoder = object$1({
|
|
2605
2650
|
windowIds: array$1(nonEmptyStringDecoder)
|
|
2606
2651
|
});
|
|
2607
|
-
const channelsOperationTypesDecoder = oneOf$1(constant$1("addChannel"), constant$1("getMyChannel"), constant$1("getWindowIdsOnChannel"), constant$1("getWindowIdsWithChannels"), constant$1("joinChannel"));
|
|
2652
|
+
const channelsOperationTypesDecoder = oneOf$1(constant$1("addChannel"), constant$1("getMyChannel"), constant$1("getWindowIdsOnChannel"), constant$1("getWindowIdsWithChannels"), constant$1("joinChannel"), constant$1("restrict"), constant$1("getRestrictions"), constant$1("restrictAll"));
|
|
2608
2653
|
const getMyChanelResultDecoder = object$1({
|
|
2609
2654
|
channel: optional$1(nonEmptyStringDecoder)
|
|
2610
2655
|
});
|
|
@@ -2933,7 +2978,8 @@ class WebWindowModel {
|
|
|
2933
2978
|
}
|
|
2934
2979
|
async getContext() {
|
|
2935
2980
|
const ctx = await this._bridge.contextLib.get(this.myCtxKey);
|
|
2936
|
-
|
|
2981
|
+
const { ___io___, ...rest } = ctx;
|
|
2982
|
+
return rest;
|
|
2937
2983
|
}
|
|
2938
2984
|
async updateContext(context) {
|
|
2939
2985
|
const ctx = anyDecoder.runWithException(context);
|
|
@@ -2942,7 +2988,9 @@ class WebWindowModel {
|
|
|
2942
2988
|
}
|
|
2943
2989
|
async setContext(context) {
|
|
2944
2990
|
const ctx = anyDecoder.runWithException(context);
|
|
2945
|
-
await this._bridge.contextLib.
|
|
2991
|
+
const current = await this._bridge.contextLib.get(this.myCtxKey);
|
|
2992
|
+
const newCtx = current.___io___ ? { ...ctx, ___io___: current.___io___ } : ctx;
|
|
2993
|
+
await this._bridge.contextLib.set(this.myCtxKey, newCtx);
|
|
2946
2994
|
return this.me;
|
|
2947
2995
|
}
|
|
2948
2996
|
onContextUpdated(callback) {
|
|
@@ -2950,7 +2998,8 @@ class WebWindowModel {
|
|
|
2950
2998
|
throw new Error("Cannot subscribe to context changes, because the provided callback is not a function!");
|
|
2951
2999
|
}
|
|
2952
3000
|
const wrappedCallback = (data) => {
|
|
2953
|
-
|
|
3001
|
+
const { ___io___, ...rest } = data;
|
|
3002
|
+
callback(rest, this.me);
|
|
2954
3003
|
};
|
|
2955
3004
|
return this.registry.add("context-updated", wrappedCallback);
|
|
2956
3005
|
}
|
|
@@ -3843,11 +3892,13 @@ const operations$7 = {
|
|
|
3843
3892
|
layoutAdded: { name: "layoutAdded", dataDecoder: glueLayoutDecoder },
|
|
3844
3893
|
layoutChanged: { name: "layoutChanged", dataDecoder: glueLayoutDecoder },
|
|
3845
3894
|
layoutRemoved: { name: "layoutRemoved", dataDecoder: glueLayoutDecoder },
|
|
3895
|
+
layoutRenamed: { name: "layoutRenamed", dataDecoder: glueLayoutDecoder },
|
|
3846
3896
|
get: { name: "get", dataDecoder: simpleLayoutConfigDecoder, resultDecoder: optionalSimpleLayoutResult },
|
|
3847
3897
|
getAll: { name: "getAll", dataDecoder: getAllLayoutsConfigDecoder, resultDecoder: allLayoutsSummariesResultDecoder },
|
|
3848
3898
|
export: { name: "export", dataDecoder: getAllLayoutsConfigDecoder, resultDecoder: allLayoutsFullConfigDecoder },
|
|
3849
3899
|
import: { name: "import", dataDecoder: layoutsImportConfigDecoder },
|
|
3850
3900
|
remove: { name: "remove", dataDecoder: simpleLayoutConfigDecoder },
|
|
3901
|
+
rename: { name: "rename", dataDecoder: renameLayoutConfigDecoder, resultDecoder: layoutResultDecoder },
|
|
3851
3902
|
save: { name: "save", dataDecoder: saveLayoutConfigDecoder, resultDecoder: simpleLayoutResultDecoder },
|
|
3852
3903
|
restore: { name: "restore", dataDecoder: restoreLayoutConfigDecoder },
|
|
3853
3904
|
clientSaveRequest: { name: "clientSaveRequest", dataDecoder: platformSaveRequestConfigDecoder, resultDecoder: saveRequestClientResponseDecoder },
|
|
@@ -3856,7 +3907,8 @@ const operations$7 = {
|
|
|
3856
3907
|
checkGlobalActivated: { name: "checkGlobalActivated", resultDecoder: simpleAvailabilityResultDecoder },
|
|
3857
3908
|
getDefaultGlobal: { name: "getDefaultGlobal", resultDecoder: optionalSimpleLayoutResult },
|
|
3858
3909
|
setDefaultGlobal: { name: "setDefaultGlobal", dataDecoder: setDefaultGlobalConfigDecoder },
|
|
3859
|
-
clearDefaultGlobal: { name: "clearDefaultGlobal" }
|
|
3910
|
+
clearDefaultGlobal: { name: "clearDefaultGlobal" },
|
|
3911
|
+
updateMetadata: { name: "updateMetadata", dataDecoder: updateLayoutMetadataConfigDecoder }
|
|
3860
3912
|
};
|
|
3861
3913
|
|
|
3862
3914
|
class LayoutsController {
|
|
@@ -3909,7 +3961,10 @@ class LayoutsController {
|
|
|
3909
3961
|
getGlobalTypeState: this.checkGlobalActivated.bind(this),
|
|
3910
3962
|
getDefaultGlobal: this.getDefaultGlobal.bind(this),
|
|
3911
3963
|
setDefaultGlobal: this.setDefaultGlobal.bind(this),
|
|
3912
|
-
clearDefaultGlobal: this.clearDefaultGlobal.bind(this)
|
|
3964
|
+
clearDefaultGlobal: this.clearDefaultGlobal.bind(this),
|
|
3965
|
+
rename: this.rename.bind(this),
|
|
3966
|
+
onRenamed: this.onRenamed.bind(this),
|
|
3967
|
+
updateMetadata: this.updateMetadata.bind(this)
|
|
3913
3968
|
};
|
|
3914
3969
|
return Object.freeze(api);
|
|
3915
3970
|
}
|
|
@@ -3917,6 +3972,7 @@ class LayoutsController {
|
|
|
3917
3972
|
operations$7.layoutAdded.execute = this.handleOnAdded.bind(this);
|
|
3918
3973
|
operations$7.layoutChanged.execute = this.handleOnChanged.bind(this);
|
|
3919
3974
|
operations$7.layoutRemoved.execute = this.handleOnRemoved.bind(this);
|
|
3975
|
+
operations$7.layoutRenamed.execute = this.handleOnRenamed.bind(this);
|
|
3920
3976
|
operations$7.clientSaveRequest.execute = this.handleSaveRequest.bind(this);
|
|
3921
3977
|
}
|
|
3922
3978
|
async get(name, type) {
|
|
@@ -4020,6 +4076,16 @@ class LayoutsController {
|
|
|
4020
4076
|
async clearDefaultGlobal() {
|
|
4021
4077
|
await this.bridge.send("layouts", operations$7.clearDefaultGlobal, undefined, undefined, { includeOperationCheck: true });
|
|
4022
4078
|
}
|
|
4079
|
+
async rename(layout, newName) {
|
|
4080
|
+
glueLayoutDecoder.runWithException(layout);
|
|
4081
|
+
nonEmptyStringDecoder.runWithException(newName);
|
|
4082
|
+
const result = await this.bridge.send("layouts", operations$7.rename, { layout, newName }, undefined, { includeOperationCheck: true });
|
|
4083
|
+
return result;
|
|
4084
|
+
}
|
|
4085
|
+
async updateMetadata(layout) {
|
|
4086
|
+
glueLayoutDecoder.runWithException(layout);
|
|
4087
|
+
await this.bridge.send("layouts", operations$7.updateMetadata, { layout }, undefined, { includeOperationCheck: true });
|
|
4088
|
+
}
|
|
4023
4089
|
onAdded(callback) {
|
|
4024
4090
|
this.export("Global").then((layouts) => layouts.forEach((layout) => callback(layout))).catch(() => { });
|
|
4025
4091
|
this.export("Workspace").then((layouts) => layouts.forEach((layout) => callback(layout))).catch(() => { });
|
|
@@ -4031,6 +4097,12 @@ class LayoutsController {
|
|
|
4031
4097
|
onRemoved(callback) {
|
|
4032
4098
|
return this.registry.add(operations$7.layoutRemoved.name, callback);
|
|
4033
4099
|
}
|
|
4100
|
+
onRenamed(callback) {
|
|
4101
|
+
if (typeof callback !== "function") {
|
|
4102
|
+
throw new Error("Cannot subscribe to onRenamed, because the provided callback is not a function!");
|
|
4103
|
+
}
|
|
4104
|
+
return this.registry.add(operations$7.layoutRenamed.name, callback);
|
|
4105
|
+
}
|
|
4034
4106
|
subscribeOnSaveRequested(callback) {
|
|
4035
4107
|
if (typeof callback !== "function") {
|
|
4036
4108
|
throw new Error("Cannot subscribe to onSaveRequested, because the provided argument is not a valid callback function.");
|
|
@@ -4052,6 +4124,9 @@ class LayoutsController {
|
|
|
4052
4124
|
async handleOnRemoved(layout) {
|
|
4053
4125
|
this.registry.execute(operations$7.layoutRemoved.name, layout);
|
|
4054
4126
|
}
|
|
4127
|
+
async handleOnRenamed(layout) {
|
|
4128
|
+
this.registry.execute(operations$7.layoutRenamed.name, layout);
|
|
4129
|
+
}
|
|
4055
4130
|
}
|
|
4056
4131
|
|
|
4057
4132
|
const operations$6 = {
|
|
@@ -4582,10 +4657,14 @@ const latestFDC3Type = "latest_fdc3_type";
|
|
|
4582
4657
|
|
|
4583
4658
|
const operations$4 = {
|
|
4584
4659
|
addChannel: { name: "addChannel", dataDecoder: channelContextDecoder },
|
|
4660
|
+
removeChannel: { name: "removeChannel", dataDecoder: removeChannelDataDecoder },
|
|
4585
4661
|
getMyChannel: { name: "getMyChannel", resultDecoder: getMyChanelResultDecoder },
|
|
4586
4662
|
getWindowIdsOnChannel: { name: "getWindowIdsOnChannel", dataDecoder: getWindowIdsOnChannelDataDecoder, resultDecoder: getWindowIdsOnChannelResultDecoder },
|
|
4587
4663
|
getWindowIdsWithChannels: { name: "getWindowIdsWithChannels", dataDecoder: wrappedWindowWithChannelFilterDecoder, resultDecoder: getWindowIdsWithChannelsResultDecoder },
|
|
4588
4664
|
joinChannel: { name: "joinChannel", dataDecoder: joinChannelDataDecoder },
|
|
4665
|
+
restrict: { name: "restrict", dataDecoder: restrictionConfigDataDecoder },
|
|
4666
|
+
getRestrictions: { name: "getRestrictions", dataDecoder: getRestrictionsDataDecoder, resultDecoder: restrictionsDecoder },
|
|
4667
|
+
restrictAll: { name: "restrictAll", dataDecoder: restrictAllDataDecoder }
|
|
4589
4668
|
};
|
|
4590
4669
|
|
|
4591
4670
|
class ChannelsController {
|
|
@@ -4606,6 +4685,9 @@ class ChannelsController {
|
|
|
4606
4685
|
addOperationsExecutors() {
|
|
4607
4686
|
operations$4.getMyChannel.execute = this.handleGetMyChannel.bind(this);
|
|
4608
4687
|
operations$4.joinChannel.execute = this.handleJoinChannel.bind(this);
|
|
4688
|
+
operations$4.restrict.execute = ({ config }) => this.restrict(config);
|
|
4689
|
+
operations$4.getRestrictions.execute = ({ windowId }) => this.getRestrictions(windowId);
|
|
4690
|
+
operations$4.restrictAll.execute = ({ restrictions }) => this.restrictAll(restrictions);
|
|
4609
4691
|
}
|
|
4610
4692
|
async start(coreGlue, ioc) {
|
|
4611
4693
|
this.logger = coreGlue.logger.subLogger("channels.controller.web");
|
|
@@ -4678,9 +4760,13 @@ class ChannelsController {
|
|
|
4678
4760
|
changed: this.changed.bind(this),
|
|
4679
4761
|
onChanged: this.onChanged.bind(this),
|
|
4680
4762
|
add: this.add.bind(this),
|
|
4763
|
+
remove: this.remove.bind(this),
|
|
4681
4764
|
getMy: this.getMy.bind(this),
|
|
4682
4765
|
getWindowsOnChannel: this.getWindowsOnChannel.bind(this),
|
|
4683
4766
|
getWindowsWithChannels: this.getWindowsWithChannels.bind(this),
|
|
4767
|
+
restrict: this.restrict.bind(this),
|
|
4768
|
+
getRestrictions: this.getRestrictions.bind(this),
|
|
4769
|
+
restrictAll: this.restrictAll.bind(this)
|
|
4684
4770
|
};
|
|
4685
4771
|
return Object.freeze(api);
|
|
4686
4772
|
}
|
|
@@ -4748,10 +4834,11 @@ class ChannelsController {
|
|
|
4748
4834
|
throw new Error("Cannot subscribe to channels, because the provided callback is not a function!");
|
|
4749
4835
|
}
|
|
4750
4836
|
const currentChannel = this.current();
|
|
4837
|
+
const wrappedCallback = this.getWrappedCallbackWithPermissionCheck(callback);
|
|
4751
4838
|
if (currentChannel) {
|
|
4752
|
-
this.replaySubscribe(
|
|
4839
|
+
this.replaySubscribe(wrappedCallback, currentChannel);
|
|
4753
4840
|
}
|
|
4754
|
-
return this.registry.add(this.SubsKey,
|
|
4841
|
+
return this.registry.add(this.SubsKey, wrappedCallback);
|
|
4755
4842
|
}
|
|
4756
4843
|
async subscribeFor(name, callback) {
|
|
4757
4844
|
const channelNames = this.getAllChannelNames();
|
|
@@ -4760,8 +4847,9 @@ class ChannelsController {
|
|
|
4760
4847
|
throw new Error(`Cannot subscribe to channel ${name}, because the provided callback is not a function!`);
|
|
4761
4848
|
}
|
|
4762
4849
|
const contextName = this.createContextName(name);
|
|
4850
|
+
const wrappedCallback = this.getWrappedCallbackWithPermissionCheck(callback);
|
|
4763
4851
|
return this.contexts.subscribe(contextName, (context, _, __, ___, extraData) => {
|
|
4764
|
-
|
|
4852
|
+
wrappedCallback(context.data, context, extraData?.updaterId);
|
|
4765
4853
|
});
|
|
4766
4854
|
}
|
|
4767
4855
|
publish(data, name) {
|
|
@@ -4771,12 +4859,16 @@ class ChannelsController {
|
|
|
4771
4859
|
if (typeof name !== "undefined") {
|
|
4772
4860
|
const channelNames = this.getAllChannelNames();
|
|
4773
4861
|
channelNameDecoder(channelNames).runWithException(name);
|
|
4774
|
-
return this.updateData(name, data);
|
|
4775
4862
|
}
|
|
4776
|
-
|
|
4863
|
+
const channelName = name || this.currentChannelName;
|
|
4864
|
+
if (!channelName) {
|
|
4777
4865
|
throw new Error("Cannot publish to channel, because not joined to a channel!");
|
|
4778
4866
|
}
|
|
4779
|
-
|
|
4867
|
+
const canPublish = this.isAllowedByRestrictions(channelName, "write");
|
|
4868
|
+
if (!canPublish) {
|
|
4869
|
+
throw new Error(`Cannot publish on channel ${channelName} due to restrictions`);
|
|
4870
|
+
}
|
|
4871
|
+
return this.updateData(channelName, data);
|
|
4780
4872
|
}
|
|
4781
4873
|
async all() {
|
|
4782
4874
|
const channelNames = this.getAllChannelNames();
|
|
@@ -4811,6 +4903,14 @@ class ChannelsController {
|
|
|
4811
4903
|
await this.bridge.send("channels", operations$4.addChannel, channelContext);
|
|
4812
4904
|
return channelContext;
|
|
4813
4905
|
}
|
|
4906
|
+
async remove(name) {
|
|
4907
|
+
nonEmptyStringDecoder.runWithException(name);
|
|
4908
|
+
const channelWithSuchNameExists = this.getAllChannelNames().includes(name);
|
|
4909
|
+
if (!channelWithSuchNameExists) {
|
|
4910
|
+
throw new Error("There's no channel with such name");
|
|
4911
|
+
}
|
|
4912
|
+
await this.bridge.send("channels", operations$4.removeChannel, { name }, undefined, { includeOperationCheck: true });
|
|
4913
|
+
}
|
|
4814
4914
|
replaySubscribe = (callback, channelId) => {
|
|
4815
4915
|
this.get(channelId)
|
|
4816
4916
|
.then((channelContext) => {
|
|
@@ -4856,6 +4956,93 @@ class ChannelsController {
|
|
|
4856
4956
|
}, []);
|
|
4857
4957
|
return result;
|
|
4858
4958
|
}
|
|
4959
|
+
async restrict(config) {
|
|
4960
|
+
channelRestrictionsDecoder.runWithException(config);
|
|
4961
|
+
const channelNames = this.getAllChannelNames();
|
|
4962
|
+
channelNameDecoder(channelNames).runWithException(config.name);
|
|
4963
|
+
const forAnotherClient = config.windowId && config.windowId !== this.windowsController.my().id;
|
|
4964
|
+
if (forAnotherClient) {
|
|
4965
|
+
return this.bridge.send("channels", operations$4.restrict, { config }, undefined, { includeOperationCheck: true });
|
|
4966
|
+
}
|
|
4967
|
+
const sessionStorageData = this.sessionController.getWindowData();
|
|
4968
|
+
const restrictions = sessionStorageData?.restrictions ? { ...sessionStorageData.restrictions, [config.name]: config } : { [config.name]: config };
|
|
4969
|
+
const currentChannel = await this.getMy();
|
|
4970
|
+
const prevReadAllowed = this.checkPreviousReadAllowed(currentChannel?.name);
|
|
4971
|
+
this.sessionController.setWindowData(restrictions, "restrictions");
|
|
4972
|
+
if (!currentChannel || prevReadAllowed || !config.read || currentChannel.name !== config.name) {
|
|
4973
|
+
return;
|
|
4974
|
+
}
|
|
4975
|
+
this.replaySubscribeCallback(config.name);
|
|
4976
|
+
}
|
|
4977
|
+
async getRestrictions(windowId) {
|
|
4978
|
+
optionalNonEmptyStringDecoder.runWithException(windowId);
|
|
4979
|
+
if (!windowId || windowId === this.windowsController.my().id) {
|
|
4980
|
+
return this.getMyRestrictions();
|
|
4981
|
+
}
|
|
4982
|
+
return this.bridge.send("channels", operations$4.getRestrictions, { windowId }, undefined, { includeOperationCheck: true });
|
|
4983
|
+
}
|
|
4984
|
+
async restrictAll(restrictions) {
|
|
4985
|
+
restrictionsConfigDecoder.runWithException(restrictions);
|
|
4986
|
+
const allChannelNames = this.getAllChannelNames();
|
|
4987
|
+
const forAnotherClient = restrictions.windowId && restrictions.windowId !== this.windowsController.my().id;
|
|
4988
|
+
if (forAnotherClient) {
|
|
4989
|
+
return this.bridge.send("channels", operations$4.restrictAll, { restrictions }, undefined, { includeOperationCheck: true });
|
|
4990
|
+
}
|
|
4991
|
+
const allRestrictions = {};
|
|
4992
|
+
allChannelNames.forEach((name) => {
|
|
4993
|
+
allRestrictions[name] = { ...restrictions, name };
|
|
4994
|
+
});
|
|
4995
|
+
const currentChannel = await this.getMy();
|
|
4996
|
+
const prevReadAllowed = this.checkPreviousReadAllowed(currentChannel?.name);
|
|
4997
|
+
this.sessionController.setWindowData(allRestrictions, "restrictions");
|
|
4998
|
+
if (!currentChannel || prevReadAllowed || !restrictions.read) {
|
|
4999
|
+
return;
|
|
5000
|
+
}
|
|
5001
|
+
this.replaySubscribeCallback(currentChannel.name);
|
|
5002
|
+
}
|
|
5003
|
+
isAllowedByRestrictions(channelName, action) {
|
|
5004
|
+
const { channels } = this.getMyRestrictions();
|
|
5005
|
+
if (!channels?.length) {
|
|
5006
|
+
return true;
|
|
5007
|
+
}
|
|
5008
|
+
const restriction = channels.find((restriction) => restriction.name === channelName);
|
|
5009
|
+
return restriction ? restriction[action] : true;
|
|
5010
|
+
}
|
|
5011
|
+
getMyRestrictions() {
|
|
5012
|
+
const sessionStorageData = this.sessionController.getWindowData();
|
|
5013
|
+
const restrictions = Object.values(sessionStorageData?.restrictions || {});
|
|
5014
|
+
return { channels: restrictions };
|
|
5015
|
+
}
|
|
5016
|
+
getWrappedCallbackWithPermissionCheck(callback) {
|
|
5017
|
+
const wrappedCallback = (data, context, updaterId) => {
|
|
5018
|
+
const canRead = this.isAllowedByRestrictions(context.name, "read");
|
|
5019
|
+
if (!canRead) {
|
|
5020
|
+
return;
|
|
5021
|
+
}
|
|
5022
|
+
callback(data, context, updaterId);
|
|
5023
|
+
};
|
|
5024
|
+
return wrappedCallback;
|
|
5025
|
+
}
|
|
5026
|
+
replaySubscribeCallback(channelName) {
|
|
5027
|
+
const contextName = this.createContextName(channelName);
|
|
5028
|
+
this.contexts.subscribe(contextName, (context, _, __, ___, extraData) => {
|
|
5029
|
+
this.registry.execute(this.SubsKey, context.data, context, extraData?.updaterId);
|
|
5030
|
+
}).then((unsub) => {
|
|
5031
|
+
if (unsub && typeof unsub === "function") {
|
|
5032
|
+
unsub();
|
|
5033
|
+
}
|
|
5034
|
+
}).catch(err => this.logger.error(err));
|
|
5035
|
+
}
|
|
5036
|
+
checkPreviousReadAllowed(channelName) {
|
|
5037
|
+
if (!channelName) {
|
|
5038
|
+
return true;
|
|
5039
|
+
}
|
|
5040
|
+
const prevRestrictions = this.sessionController.getWindowData().restrictions;
|
|
5041
|
+
if (!prevRestrictions?.[channelName]) {
|
|
5042
|
+
return true;
|
|
5043
|
+
}
|
|
5044
|
+
return prevRestrictions[channelName].read;
|
|
5045
|
+
}
|
|
4859
5046
|
}
|
|
4860
5047
|
|
|
4861
5048
|
const operations$3 = {
|
|
@@ -5926,7 +6113,7 @@ class IoC {
|
|
|
5926
6113
|
}
|
|
5927
6114
|
}
|
|
5928
6115
|
|
|
5929
|
-
var version$1 = "3.
|
|
6116
|
+
var version$1 = "3.3.1";
|
|
5930
6117
|
|
|
5931
6118
|
const createFactoryFunction = (coreFactoryFunction) => {
|
|
5932
6119
|
return async (userConfig) => {
|
|
@@ -8095,7 +8282,7 @@ function domainSession (domain, connection, logger, successMessages, errorMessag
|
|
|
8095
8282
|
resolve(successMsg);
|
|
8096
8283
|
},
|
|
8097
8284
|
error: (errorMsg) => {
|
|
8098
|
-
logger.warn(`
|
|
8285
|
+
logger.warn(`Gateway error - ${JSON.stringify(errorMsg)}`);
|
|
8099
8286
|
delete requestsMap[requestId];
|
|
8100
8287
|
errorMsg._tag = tag;
|
|
8101
8288
|
reject(errorMsg);
|
|
@@ -8884,7 +9071,7 @@ const ContextMessageReplaySpec = {
|
|
|
8884
9071
|
}
|
|
8885
9072
|
};
|
|
8886
9073
|
|
|
8887
|
-
var version = "6.
|
|
9074
|
+
var version = "6.3.1";
|
|
8888
9075
|
|
|
8889
9076
|
function prepareConfig (configuration, ext, glue42gd) {
|
|
8890
9077
|
let nodeStartingContext;
|
|
@@ -11322,7 +11509,7 @@ class GW3Bridge {
|
|
|
11322
11509
|
hadCallbacks &&
|
|
11323
11510
|
!contextData.hasCallbacks() &&
|
|
11324
11511
|
contextData.sentExplicitSubscription) {
|
|
11325
|
-
this.sendUnsubscribe(contextData);
|
|
11512
|
+
this.sendUnsubscribe(contextData).catch(() => { });
|
|
11326
11513
|
}
|
|
11327
11514
|
if (!contextData.isAnnounced &&
|
|
11328
11515
|
!contextData.hasCallbacks()) {
|