@interopio/browser 4.1.6 → 4.2.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 +49 -15
- package/changelog.md +2 -0
- package/dist/browser.es.js +40 -20
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.umd.js +40 -20
- package/dist/browser.umd.js.map +1 -1
- package/dist/browser.umd.min.js +1 -1
- package/package.json +7 -7
package/browser.d.ts
CHANGED
|
@@ -121,7 +121,6 @@ export namespace IOConnectBrowser {
|
|
|
121
121
|
* Describes the configuration for the `IOBrowser()` factory function.
|
|
122
122
|
*/
|
|
123
123
|
export interface Config {
|
|
124
|
-
|
|
125
124
|
/**
|
|
126
125
|
* Configures the system logger. Used mostly during development.
|
|
127
126
|
*/
|
|
@@ -474,9 +473,22 @@ export namespace IOConnectBrowser {
|
|
|
474
473
|
}
|
|
475
474
|
}
|
|
476
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Settings for the system logger used by the library.
|
|
478
|
+
*/
|
|
477
479
|
export interface SystemLogger {
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Logging level for the system logger.
|
|
483
|
+
*/
|
|
478
484
|
level?: IOConnectCore.Logger.LogLevel;
|
|
479
|
-
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Implementation of a custom logger to be used as a system logger.
|
|
488
|
+
* This logger will also be used by any logger instances created via the Logger API.
|
|
489
|
+
* @since io.Connect Browser 4.2
|
|
490
|
+
*/
|
|
491
|
+
customLogger?: IOConnectCore.CustomLogger;
|
|
480
492
|
}
|
|
481
493
|
|
|
482
494
|
/**
|
|
@@ -848,7 +860,7 @@ export namespace IOConnectBrowser {
|
|
|
848
860
|
get(name: string, type: LayoutType): Promise<Layout | undefined>;
|
|
849
861
|
|
|
850
862
|
/**
|
|
851
|
-
* Retrieves the last restored Global Layout
|
|
863
|
+
* Retrieves the current Global Layout. This is either the last restored Global Layout, or the last saved Global Layout that has been set as the current Global Layout.
|
|
852
864
|
* @since io.Connect Browser 4.0
|
|
853
865
|
*/
|
|
854
866
|
getCurrentLayout(): Promise<Layout | undefined>;
|
|
@@ -1135,6 +1147,13 @@ export namespace IOConnectBrowser {
|
|
|
1135
1147
|
* Window or app instance IDs of the instances to be ignored when saving the Layout.
|
|
1136
1148
|
*/
|
|
1137
1149
|
ignoreInstances?: string[];
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* If `true`, will set the saved Layout as the current Global Layout.
|
|
1153
|
+
* @default true
|
|
1154
|
+
* @since io.Connect Browser 4.2
|
|
1155
|
+
*/
|
|
1156
|
+
setAsCurrent?: boolean;
|
|
1138
1157
|
}
|
|
1139
1158
|
|
|
1140
1159
|
/**
|
|
@@ -1541,7 +1560,7 @@ export namespace IOConnectBrowser {
|
|
|
1541
1560
|
/**
|
|
1542
1561
|
* Notifies when the current window joins or leaves a Channel. Returns an unsubscribe function.
|
|
1543
1562
|
* It's recommended to use the `onChannelsChanged()` method instead, which can handle Channel changes both in single and in multi Channel mode.
|
|
1544
|
-
* @param callback Callback function for handling the event. Receives as an argument the name of the Channel
|
|
1563
|
+
* @param callback Callback function for handling the event. Receives as an argument the name of the newly joined Channel. If the window leaves a Channel without joining a new one, the argument will be `undefined`.
|
|
1545
1564
|
*/
|
|
1546
1565
|
onChanged(callback: (channel: string) => void): UnsubscribeFunction;
|
|
1547
1566
|
|
|
@@ -1853,7 +1872,9 @@ export namespace IOConnectBrowser {
|
|
|
1853
1872
|
/** The instance of the application. */
|
|
1854
1873
|
myInstance: Instance;
|
|
1855
1874
|
|
|
1856
|
-
/**
|
|
1875
|
+
/**
|
|
1876
|
+
* Object that can be used for handling app definitions dynamically.
|
|
1877
|
+
*/
|
|
1857
1878
|
inMemory: InMemory;
|
|
1858
1879
|
|
|
1859
1880
|
/**
|
|
@@ -1911,25 +1932,31 @@ export namespace IOConnectBrowser {
|
|
|
1911
1932
|
onAppChanged(callback: (app: Application) => any): UnsubscribeFunction;
|
|
1912
1933
|
}
|
|
1913
1934
|
|
|
1914
|
-
/**
|
|
1935
|
+
/**
|
|
1936
|
+
* Object that can be used for handling app definitions dynamically. The described methods operate only on in-memory app definitions.
|
|
1937
|
+
*/
|
|
1915
1938
|
export interface InMemory {
|
|
1916
1939
|
/**
|
|
1917
|
-
* Imports the provided collection of
|
|
1918
|
-
* @param definitions A collection of
|
|
1919
|
-
* @param mode
|
|
1940
|
+
* Imports the provided collection of app definitions.
|
|
1941
|
+
* @param definitions A collection of app definition objects to be imported.
|
|
1942
|
+
* @param mode Mode for importing app definitions. Use `"replace"` (default) to replace all existing in-memory app definitions. Use `"merge"` to update the existing ones and add new ones.
|
|
1920
1943
|
*/
|
|
1921
1944
|
import(definitions: (Definition | FDC3DefinitionV1 | FDC3DefinitionV2)[], mode?: "replace" | "merge"): Promise<ImportResult>;
|
|
1922
1945
|
|
|
1923
1946
|
/**
|
|
1924
|
-
*
|
|
1925
|
-
* @param name The name of the definition to be removed.
|
|
1947
|
+
* Exports all available app definitions from the in-memory store.
|
|
1926
1948
|
*/
|
|
1927
|
-
remove(name: string): Promise<void>;
|
|
1928
|
-
|
|
1929
|
-
/** Exports all known application definitions */
|
|
1930
1949
|
export(): Promise<(Definition | FDC3DefinitionV1 | FDC3DefinitionV2)[]>;
|
|
1931
1950
|
|
|
1932
|
-
/**
|
|
1951
|
+
/**
|
|
1952
|
+
* Removes an app definition from the in-memory store.
|
|
1953
|
+
* @param name Name of the app to be removed.
|
|
1954
|
+
*/
|
|
1955
|
+
remove(name: string): Promise<void>;
|
|
1956
|
+
|
|
1957
|
+
/**
|
|
1958
|
+
* Removes all app definitions from the in-memory store.
|
|
1959
|
+
*/
|
|
1933
1960
|
clear(): Promise<void>;
|
|
1934
1961
|
}
|
|
1935
1962
|
|
|
@@ -2747,6 +2774,7 @@ export namespace IOConnectBrowser {
|
|
|
2747
2774
|
icon?: string;
|
|
2748
2775
|
description?: string;
|
|
2749
2776
|
resultType?: string;
|
|
2777
|
+
customConfig?: { [key: string]: any };
|
|
2750
2778
|
}
|
|
2751
2779
|
|
|
2752
2780
|
/**
|
|
@@ -2925,6 +2953,12 @@ export namespace IOConnectBrowser {
|
|
|
2925
2953
|
* or a string indicating a channel that returns a specific type, e.g. "channel<fdc3.instrument>"
|
|
2926
2954
|
*/
|
|
2927
2955
|
resultType?: string;
|
|
2956
|
+
|
|
2957
|
+
/**
|
|
2958
|
+
* Object containing custom configuration for the Intent handler provided via the app definition or dynamically.
|
|
2959
|
+
* @since io.Connect Browser 4.2
|
|
2960
|
+
*/
|
|
2961
|
+
customConfig?: { [key: string]: any };
|
|
2928
2962
|
}
|
|
2929
2963
|
|
|
2930
2964
|
/**
|
package/changelog.md
CHANGED
package/dist/browser.es.js
CHANGED
|
@@ -1804,6 +1804,9 @@ 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
|
+
const regexDecoder = anyJson$1().andThen((value) => {
|
|
1808
|
+
return value instanceof RegExp ? anyJson$1() : fail(`expected a regex, got a ${typeof value}`);
|
|
1809
|
+
});
|
|
1807
1810
|
|
|
1808
1811
|
const intentDefinitionDecoder$1 = object$1({
|
|
1809
1812
|
name: nonEmptyStringDecoder$3,
|
|
@@ -2130,7 +2133,8 @@ class FDC3Service {
|
|
|
2130
2133
|
const decoders$1 = {
|
|
2131
2134
|
common: {
|
|
2132
2135
|
nonEmptyStringDecoder: nonEmptyStringDecoder$3,
|
|
2133
|
-
nonNegativeNumberDecoder: nonNegativeNumberDecoder$3
|
|
2136
|
+
nonNegativeNumberDecoder: nonNegativeNumberDecoder$3,
|
|
2137
|
+
regexDecoder
|
|
2134
2138
|
},
|
|
2135
2139
|
fdc3: {
|
|
2136
2140
|
allDefinitionsDecoder,
|
|
@@ -2304,7 +2308,8 @@ const intentDefinitionDecoder = object$2({
|
|
|
2304
2308
|
name: nonEmptyStringDecoder$2,
|
|
2305
2309
|
displayName: optional$2(string$2()),
|
|
2306
2310
|
contexts: optional$2(array$2(string$2())),
|
|
2307
|
-
customConfig: optional$2(object$2())
|
|
2311
|
+
customConfig: optional$2(object$2()),
|
|
2312
|
+
resultType: optional$2(string$2())
|
|
2308
2313
|
});
|
|
2309
2314
|
const applicationDefinitionDecoder = object$2({
|
|
2310
2315
|
name: nonEmptyStringDecoder$2,
|
|
@@ -2319,11 +2324,6 @@ const applicationDefinitionDecoder = object$2({
|
|
|
2319
2324
|
hidden: optional$2(boolean$2()),
|
|
2320
2325
|
fdc3: optional$2(decoders.fdc3.v2DefinitionDecoder)
|
|
2321
2326
|
});
|
|
2322
|
-
const allApplicationDefinitionsDecoder = oneOf$1(applicationDefinitionDecoder, decoders.fdc3.v2DefinitionDecoder, decoders.fdc3.v1DefinitionDecoder);
|
|
2323
|
-
object$2({
|
|
2324
|
-
definitions: array$2(allApplicationDefinitionsDecoder),
|
|
2325
|
-
mode: oneOf$1(constant$2("replace"), constant$2("merge"))
|
|
2326
|
-
});
|
|
2327
2327
|
const appRemoveConfigDecoder = object$2({
|
|
2328
2328
|
name: nonEmptyStringDecoder$2
|
|
2329
2329
|
});
|
|
@@ -2337,7 +2337,7 @@ const applicationDataDecoder = object$2({
|
|
|
2337
2337
|
userProperties: optional$2(anyJson$2()),
|
|
2338
2338
|
title: optional$2(nonEmptyStringDecoder$2),
|
|
2339
2339
|
version: optional$2(nonEmptyStringDecoder$2),
|
|
2340
|
-
icon: optional$2(
|
|
2340
|
+
icon: optional$2(string$2()),
|
|
2341
2341
|
caption: optional$2(nonEmptyStringDecoder$2)
|
|
2342
2342
|
});
|
|
2343
2343
|
const baseApplicationDataDecoder = object$2({
|
|
@@ -2346,7 +2346,7 @@ const baseApplicationDataDecoder = object$2({
|
|
|
2346
2346
|
userProperties: anyJson$2(),
|
|
2347
2347
|
title: optional$2(nonEmptyStringDecoder$2),
|
|
2348
2348
|
version: optional$2(nonEmptyStringDecoder$2),
|
|
2349
|
-
icon: optional$2(
|
|
2349
|
+
icon: optional$2(string$2()),
|
|
2350
2350
|
caption: optional$2(nonEmptyStringDecoder$2)
|
|
2351
2351
|
});
|
|
2352
2352
|
const appDirectoryStateChangeDecoder = object$2({
|
|
@@ -2464,7 +2464,8 @@ const newLayoutOptionsDecoder = object$2({
|
|
|
2464
2464
|
context: optional$2(anyJson$2()),
|
|
2465
2465
|
metadata: optional$2(anyJson$2()),
|
|
2466
2466
|
instances: optional$2(array$2(nonEmptyStringDecoder$2)),
|
|
2467
|
-
ignoreInstances: optional$2(array$2(nonEmptyStringDecoder$2))
|
|
2467
|
+
ignoreInstances: optional$2(array$2(nonEmptyStringDecoder$2)),
|
|
2468
|
+
setAsCurrent: optional$2(boolean$2())
|
|
2468
2469
|
});
|
|
2469
2470
|
const restoreOptionsDecoder = object$2({
|
|
2470
2471
|
name: nonEmptyStringDecoder$2,
|
|
@@ -2537,7 +2538,8 @@ const intentHandlerDecoder = object$2({
|
|
|
2537
2538
|
contextTypes: optional$2(array$2(nonEmptyStringDecoder$2)),
|
|
2538
2539
|
instanceId: optional$2(string$2()),
|
|
2539
2540
|
instanceTitle: optional$2(string$2()),
|
|
2540
|
-
resultType: optional$2(string$2())
|
|
2541
|
+
resultType: optional$2(string$2()),
|
|
2542
|
+
customConfig: optional$2(object$2())
|
|
2541
2543
|
});
|
|
2542
2544
|
object$2({
|
|
2543
2545
|
applicationName: string$2(),
|
|
@@ -2668,7 +2670,8 @@ const AddIntentListenerRequestDecoder = object$2({
|
|
|
2668
2670
|
displayName: optional$2(string$2()),
|
|
2669
2671
|
icon: optional$2(string$2()),
|
|
2670
2672
|
description: optional$2(string$2()),
|
|
2671
|
-
resultType: optional$2(string$2())
|
|
2673
|
+
resultType: optional$2(string$2()),
|
|
2674
|
+
customConfig: optional$2(object$2())
|
|
2672
2675
|
});
|
|
2673
2676
|
const AddIntentListenerDecoder = oneOf$1(nonEmptyStringDecoder$2, AddIntentListenerRequestDecoder);
|
|
2674
2677
|
const intentInfoDecoder = object$2({
|
|
@@ -3252,6 +3255,7 @@ const parseConfig = (config = {}) => {
|
|
|
3252
3255
|
...config,
|
|
3253
3256
|
isPlatformInternal,
|
|
3254
3257
|
logger: config.systemLogger?.level ?? "info",
|
|
3258
|
+
customLogger: config.systemLogger?.customLogger,
|
|
3255
3259
|
widget: deepmerge$1(defaultWidgetConfig, decodedWidgetConfigResult.result ?? {}),
|
|
3256
3260
|
modals: deepmerge$1(defaultModalsConfig, decodedModalsConfigResult.result ?? {}),
|
|
3257
3261
|
intentResolver: deepmerge$1(defaultIntentResolverConfig, decodedIntentResolverConfigResult.result ?? {}),
|
|
@@ -5425,7 +5429,8 @@ class IntentsController {
|
|
|
5425
5429
|
applicationTitle: app.title,
|
|
5426
5430
|
contextTypes: intent.contexts,
|
|
5427
5431
|
displayName: intent.displayName,
|
|
5428
|
-
resultType: intent.resultType
|
|
5432
|
+
resultType: intent.resultType,
|
|
5433
|
+
customConfig: intent.customConfig
|
|
5429
5434
|
};
|
|
5430
5435
|
return handler;
|
|
5431
5436
|
}
|
|
@@ -5447,7 +5452,8 @@ class IntentsController {
|
|
|
5447
5452
|
contextTypes: info?.contextTypes || appIntent?.contexts,
|
|
5448
5453
|
instanceTitle: title,
|
|
5449
5454
|
displayName: info?.displayName || appIntent?.displayName,
|
|
5450
|
-
resultType: info?.resultType || appIntent?.resultType
|
|
5455
|
+
resultType: info?.resultType || appIntent?.resultType,
|
|
5456
|
+
customConfig: info?.customConfig
|
|
5451
5457
|
};
|
|
5452
5458
|
return handler;
|
|
5453
5459
|
}
|
|
@@ -7738,7 +7744,7 @@ class IoC {
|
|
|
7738
7744
|
}
|
|
7739
7745
|
}
|
|
7740
7746
|
|
|
7741
|
-
var version$1 = "4.
|
|
7747
|
+
var version$1 = "4.2.0";
|
|
7742
7748
|
|
|
7743
7749
|
const setupGlobalSystem = (io, bridge) => {
|
|
7744
7750
|
return {
|
|
@@ -9033,6 +9039,13 @@ class WS {
|
|
|
9033
9039
|
}
|
|
9034
9040
|
seen.add(value);
|
|
9035
9041
|
}
|
|
9042
|
+
if (value instanceof Error) {
|
|
9043
|
+
return {
|
|
9044
|
+
message: value.message,
|
|
9045
|
+
name: value.name,
|
|
9046
|
+
stack: value.stack
|
|
9047
|
+
};
|
|
9048
|
+
}
|
|
9036
9049
|
return value;
|
|
9037
9050
|
};
|
|
9038
9051
|
reason = JSON.stringify(err, replacer);
|
|
@@ -9277,6 +9290,7 @@ class WebPlatformTransport {
|
|
|
9277
9290
|
this.notifyStatusChanged(true);
|
|
9278
9291
|
}
|
|
9279
9292
|
close() {
|
|
9293
|
+
this.logger.debug(`closing connection - clientId: ${this.myClientId}, windowId: ${this.identity?.windowId || "unknown"}, client connected: ${this.iAmConnected}`);
|
|
9280
9294
|
const message = {
|
|
9281
9295
|
glue42core: {
|
|
9282
9296
|
type: this.messages.gatewayDisconnect.name,
|
|
@@ -9349,7 +9363,7 @@ class WebPlatformTransport {
|
|
|
9349
9363
|
selfAssignedWindowId: this.selfAssignedWindowId
|
|
9350
9364
|
}
|
|
9351
9365
|
};
|
|
9352
|
-
this.logger.debug(
|
|
9366
|
+
this.logger.debug(`sending connection request - clientId: ${this.myClientId}`);
|
|
9353
9367
|
if (this.extContentConnecting) {
|
|
9354
9368
|
request.glue42core.clientType = "child";
|
|
9355
9369
|
request.glue42core.bridgeInstanceId = this.myClientId;
|
|
@@ -9376,6 +9390,7 @@ class WebPlatformTransport {
|
|
|
9376
9390
|
this.logger.debug("skipping generic message listener, because this is an internal client");
|
|
9377
9391
|
return;
|
|
9378
9392
|
}
|
|
9393
|
+
this.logger.debug("setting up window message listener");
|
|
9379
9394
|
window.addEventListener("message", (event) => {
|
|
9380
9395
|
const data = event.data?.glue42core;
|
|
9381
9396
|
if (!data || this.rejected) {
|
|
@@ -9400,6 +9415,7 @@ class WebPlatformTransport {
|
|
|
9400
9415
|
this.logger.debug("skipping unload event listener, because this is an internal client");
|
|
9401
9416
|
return;
|
|
9402
9417
|
}
|
|
9418
|
+
this.logger.debug("setting up unload event listeners");
|
|
9403
9419
|
window.addEventListener("beforeunload", () => {
|
|
9404
9420
|
if (this._connectionProtocolVersion) {
|
|
9405
9421
|
return;
|
|
@@ -9417,6 +9433,7 @@ class WebPlatformTransport {
|
|
|
9417
9433
|
if (this.extContentConnected) {
|
|
9418
9434
|
return;
|
|
9419
9435
|
}
|
|
9436
|
+
this.logger.debug(`signaling client disappearing for clientId: ${this.myClientId}`);
|
|
9420
9437
|
const message = {
|
|
9421
9438
|
glue42core: {
|
|
9422
9439
|
type: this.messages.clientUnload.name,
|
|
@@ -9551,6 +9568,7 @@ class WebPlatformTransport {
|
|
|
9551
9568
|
source.postMessage(message, event.origin);
|
|
9552
9569
|
}
|
|
9553
9570
|
setupPlatformUnloadListener() {
|
|
9571
|
+
this.logger.debug("setting up platform unload listener");
|
|
9554
9572
|
this.onMessage((msg) => {
|
|
9555
9573
|
if (msg.type === "platformUnload") {
|
|
9556
9574
|
this.logger.debug("detected a web platform unload");
|
|
@@ -9560,6 +9578,7 @@ class WebPlatformTransport {
|
|
|
9560
9578
|
});
|
|
9561
9579
|
}
|
|
9562
9580
|
handleManualUnload() {
|
|
9581
|
+
this.logger.debug("handling manual unload");
|
|
9563
9582
|
const message = {
|
|
9564
9583
|
glue42core: {
|
|
9565
9584
|
type: this.messages.clientUnload.name,
|
|
@@ -9578,6 +9597,7 @@ class WebPlatformTransport {
|
|
|
9578
9597
|
return;
|
|
9579
9598
|
}
|
|
9580
9599
|
notifyStatusChanged(status, reason) {
|
|
9600
|
+
this.logger.debug(`status changed - connected: ${status}, reason: ${reason || "none"}`);
|
|
9581
9601
|
this.iAmConnected = status;
|
|
9582
9602
|
this.registry.execute("onConnectedChanged", status, reason);
|
|
9583
9603
|
}
|
|
@@ -10547,7 +10567,7 @@ class Connection {
|
|
|
10547
10567
|
return authentication;
|
|
10548
10568
|
}
|
|
10549
10569
|
async logoutCore() {
|
|
10550
|
-
this.logger.debug("logging out...");
|
|
10570
|
+
this.logger.debug("core logging out...");
|
|
10551
10571
|
this.shouldTryLogin = false;
|
|
10552
10572
|
if (this.pingTimer) {
|
|
10553
10573
|
clearTimeout(this.pingTimer);
|
|
@@ -10778,7 +10798,7 @@ const ContextMessageReplaySpec = {
|
|
|
10778
10798
|
}
|
|
10779
10799
|
};
|
|
10780
10800
|
|
|
10781
|
-
var version = "6.
|
|
10801
|
+
var version = "6.8.0";
|
|
10782
10802
|
|
|
10783
10803
|
function prepareConfig (configuration, ext, glue42gd) {
|
|
10784
10804
|
let nodeStartingContext;
|
|
@@ -14549,7 +14569,7 @@ Decoder.valueAt;
|
|
|
14549
14569
|
/** See `Decoder.succeed` */
|
|
14550
14570
|
Decoder.succeed;
|
|
14551
14571
|
/** See `Decoder.fail` */
|
|
14552
|
-
var fail = Decoder.fail;
|
|
14572
|
+
var fail$1 = Decoder.fail;
|
|
14553
14573
|
/** See `Decoder.lazy` */
|
|
14554
14574
|
Decoder.lazy;
|
|
14555
14575
|
|
|
@@ -14557,7 +14577,7 @@ const functionCheck = (input, propDescription) => {
|
|
|
14557
14577
|
const providedType = typeof input;
|
|
14558
14578
|
return providedType === "function" ?
|
|
14559
14579
|
anyJson() :
|
|
14560
|
-
fail(`The provided argument as ${propDescription} should be of type function, provided: ${typeof providedType}`);
|
|
14580
|
+
fail$1(`The provided argument as ${propDescription} should be of type function, provided: ${typeof providedType}`);
|
|
14561
14581
|
};
|
|
14562
14582
|
const nonEmptyStringDecoder = string().where((s) => s.length > 0, "Expected a non-empty string");
|
|
14563
14583
|
const nonNegativeNumberDecoder = number().where((num) => num >= 0, "Expected a non-negative number or 0");
|