@interopio/desktop 6.16.3 → 6.18.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/changelog.md +13 -1
- package/desktop.d.ts +31 -6
- package/dist/desktop.browser.js +118 -40
- package/dist/desktop.browser.js.map +1 -1
- package/dist/desktop.browser.min.js +1 -1
- package/dist/desktop.browser.min.js.map +1 -1
- package/dist/desktop.es.js +118 -40
- package/dist/desktop.es.js.map +1 -1
- package/dist/desktop.umd.js +118 -40
- package/dist/desktop.umd.js.map +1 -1
- package/dist/desktop.umd.min.js +1 -1
- package/dist/desktop.umd.min.js.map +1 -1
- package/package.json +4 -4
package/dist/desktop.es.js
CHANGED
|
@@ -1218,6 +1218,13 @@ class WS {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
seen.add(value);
|
|
1220
1220
|
}
|
|
1221
|
+
if (value instanceof Error) {
|
|
1222
|
+
return {
|
|
1223
|
+
message: value.message,
|
|
1224
|
+
name: value.name,
|
|
1225
|
+
stack: value.stack
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1221
1228
|
return value;
|
|
1222
1229
|
};
|
|
1223
1230
|
reason = JSON.stringify(err, replacer);
|
|
@@ -1462,6 +1469,7 @@ class WebPlatformTransport {
|
|
|
1462
1469
|
this.notifyStatusChanged(true);
|
|
1463
1470
|
}
|
|
1464
1471
|
close() {
|
|
1472
|
+
this.logger.debug(`closing connection - clientId: ${this.myClientId}, windowId: ${this.identity?.windowId || "unknown"}, client connected: ${this.iAmConnected}`);
|
|
1465
1473
|
const message = {
|
|
1466
1474
|
glue42core: {
|
|
1467
1475
|
type: this.messages.gatewayDisconnect.name,
|
|
@@ -1534,7 +1542,7 @@ class WebPlatformTransport {
|
|
|
1534
1542
|
selfAssignedWindowId: this.selfAssignedWindowId
|
|
1535
1543
|
}
|
|
1536
1544
|
};
|
|
1537
|
-
this.logger.debug(
|
|
1545
|
+
this.logger.debug(`sending connection request - clientId: ${this.myClientId}`);
|
|
1538
1546
|
if (this.extContentConnecting) {
|
|
1539
1547
|
request.glue42core.clientType = "child";
|
|
1540
1548
|
request.glue42core.bridgeInstanceId = this.myClientId;
|
|
@@ -1561,6 +1569,7 @@ class WebPlatformTransport {
|
|
|
1561
1569
|
this.logger.debug("skipping generic message listener, because this is an internal client");
|
|
1562
1570
|
return;
|
|
1563
1571
|
}
|
|
1572
|
+
this.logger.debug("setting up window message listener");
|
|
1564
1573
|
window.addEventListener("message", (event) => {
|
|
1565
1574
|
const data = event.data?.glue42core;
|
|
1566
1575
|
if (!data || this.rejected) {
|
|
@@ -1585,6 +1594,7 @@ class WebPlatformTransport {
|
|
|
1585
1594
|
this.logger.debug("skipping unload event listener, because this is an internal client");
|
|
1586
1595
|
return;
|
|
1587
1596
|
}
|
|
1597
|
+
this.logger.debug("setting up unload event listeners");
|
|
1588
1598
|
window.addEventListener("beforeunload", () => {
|
|
1589
1599
|
if (this._connectionProtocolVersion) {
|
|
1590
1600
|
return;
|
|
@@ -1602,6 +1612,7 @@ class WebPlatformTransport {
|
|
|
1602
1612
|
if (this.extContentConnected) {
|
|
1603
1613
|
return;
|
|
1604
1614
|
}
|
|
1615
|
+
this.logger.debug(`signaling client disappearing for clientId: ${this.myClientId}`);
|
|
1605
1616
|
const message = {
|
|
1606
1617
|
glue42core: {
|
|
1607
1618
|
type: this.messages.clientUnload.name,
|
|
@@ -1736,6 +1747,7 @@ class WebPlatformTransport {
|
|
|
1736
1747
|
source.postMessage(message, event.origin);
|
|
1737
1748
|
}
|
|
1738
1749
|
setupPlatformUnloadListener() {
|
|
1750
|
+
this.logger.debug("setting up platform unload listener");
|
|
1739
1751
|
this.onMessage((msg) => {
|
|
1740
1752
|
if (msg.type === "platformUnload") {
|
|
1741
1753
|
this.logger.debug("detected a web platform unload");
|
|
@@ -1745,6 +1757,7 @@ class WebPlatformTransport {
|
|
|
1745
1757
|
});
|
|
1746
1758
|
}
|
|
1747
1759
|
handleManualUnload() {
|
|
1760
|
+
this.logger.debug("handling manual unload");
|
|
1748
1761
|
const message = {
|
|
1749
1762
|
glue42core: {
|
|
1750
1763
|
type: this.messages.clientUnload.name,
|
|
@@ -1763,6 +1776,7 @@ class WebPlatformTransport {
|
|
|
1763
1776
|
return;
|
|
1764
1777
|
}
|
|
1765
1778
|
notifyStatusChanged(status, reason) {
|
|
1779
|
+
this.logger.debug(`status changed - connected: ${status}, reason: ${reason || "none"}`);
|
|
1766
1780
|
this.iAmConnected = status;
|
|
1767
1781
|
this.registry.execute("onConnectedChanged", status, reason);
|
|
1768
1782
|
}
|
|
@@ -2732,7 +2746,7 @@ class Connection {
|
|
|
2732
2746
|
return authentication;
|
|
2733
2747
|
}
|
|
2734
2748
|
async logoutCore() {
|
|
2735
|
-
this.logger.debug("logging out...");
|
|
2749
|
+
this.logger.debug("core logging out...");
|
|
2736
2750
|
this.shouldTryLogin = false;
|
|
2737
2751
|
if (this.pingTimer) {
|
|
2738
2752
|
clearTimeout(this.pingTimer);
|
|
@@ -2963,7 +2977,7 @@ const ContextMessageReplaySpec = {
|
|
|
2963
2977
|
}
|
|
2964
2978
|
};
|
|
2965
2979
|
|
|
2966
|
-
var version$1 = "6.
|
|
2980
|
+
var version$1 = "6.8.1";
|
|
2967
2981
|
|
|
2968
2982
|
function prepareConfig$1 (configuration, ext, glue42gd) {
|
|
2969
2983
|
let nodeStartingContext;
|
|
@@ -6746,7 +6760,6 @@ const functionCheck = (input, propDescription) => {
|
|
|
6746
6760
|
};
|
|
6747
6761
|
const nonEmptyStringDecoder$1 = string$1().where((s) => s.length > 0, "Expected a non-empty string");
|
|
6748
6762
|
const nonNegativeNumberDecoder$1 = number$1().where((num) => num >= 0, "Expected a non-negative number or 0");
|
|
6749
|
-
const positiveNumberDecoder = number$1().where((num) => num > 0, "Expected a positive number");
|
|
6750
6763
|
const methodDefinitionDecoder = object$1({
|
|
6751
6764
|
name: nonEmptyStringDecoder$1,
|
|
6752
6765
|
objectTypes: optional$1(array$1(nonEmptyStringDecoder$1)),
|
|
@@ -6779,8 +6792,8 @@ const instanceDecoder = object$1({
|
|
|
6779
6792
|
});
|
|
6780
6793
|
const targetDecoder = union(constant$1("best"), constant$1("all"), constant$1("skipMine"), instanceDecoder, array$1(instanceDecoder));
|
|
6781
6794
|
const invokeOptionsDecoder = object$1({
|
|
6782
|
-
waitTimeoutMs: optional$1(
|
|
6783
|
-
methodResponseTimeoutMs: optional$1(
|
|
6795
|
+
waitTimeoutMs: optional$1(nonNegativeNumberDecoder$1),
|
|
6796
|
+
methodResponseTimeoutMs: optional$1(nonNegativeNumberDecoder$1)
|
|
6784
6797
|
});
|
|
6785
6798
|
|
|
6786
6799
|
var InvokeStatus;
|
|
@@ -13644,7 +13657,11 @@ function createDataSubscription(agm, applications, entitlements, skipIcons) {
|
|
|
13644
13657
|
resolveFunc = resolve;
|
|
13645
13658
|
rejectFunc = reject;
|
|
13646
13659
|
});
|
|
13647
|
-
agm.subscribe(OnEventMethodName, {
|
|
13660
|
+
agm.subscribe(OnEventMethodName, {
|
|
13661
|
+
arguments: { skipIcon: skipIcons },
|
|
13662
|
+
waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
|
|
13663
|
+
methodResponseTimeout: INTEROP_METHOD_WAIT_TIMEOUT_MS
|
|
13664
|
+
})
|
|
13648
13665
|
.then((s) => {
|
|
13649
13666
|
subscription = s;
|
|
13650
13667
|
subscription.onData((streamData) => {
|
|
@@ -16871,6 +16888,8 @@ class GDEnvironment {
|
|
|
16871
16888
|
arguments: {
|
|
16872
16889
|
withConfig: true
|
|
16873
16890
|
},
|
|
16891
|
+
waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
|
|
16892
|
+
methodResponseTimeout: INTEROP_METHOD_WAIT_TIMEOUT_MS,
|
|
16874
16893
|
onData: (streamData) => {
|
|
16875
16894
|
if (streamData.data.type === "Configuration") {
|
|
16876
16895
|
this._configuration = streamData.data;
|
|
@@ -18441,9 +18460,6 @@ class LayoutsAPIImpl {
|
|
|
18441
18460
|
if (!isUndefinedOrNull(options.context) && !isObject(options.context)) {
|
|
18442
18461
|
return reject(new Error("`context` must hold an object value."));
|
|
18443
18462
|
}
|
|
18444
|
-
if (!isUndefinedOrNull(options.timeout) && typeof options.timeout !== "number") {
|
|
18445
|
-
return reject(new Error("`timeout` must hold an number value."));
|
|
18446
|
-
}
|
|
18447
18463
|
options.context = (_c = options.context) !== null && _c !== void 0 ? _c : {};
|
|
18448
18464
|
const restoreOptions = {
|
|
18449
18465
|
activityToJoin: options.activityIdToJoin,
|
|
@@ -18458,11 +18474,9 @@ class LayoutsAPIImpl {
|
|
|
18458
18474
|
type: options.type,
|
|
18459
18475
|
name: options.name,
|
|
18460
18476
|
context: options.context,
|
|
18461
|
-
options: restoreOptions
|
|
18477
|
+
options: restoreOptions,
|
|
18478
|
+
timeout: INTEROP_METHOD_MAX_TIMEOUT_MS
|
|
18462
18479
|
};
|
|
18463
|
-
if (options.timeout) {
|
|
18464
|
-
arg.timeout = options.timeout;
|
|
18465
|
-
}
|
|
18466
18480
|
this.invokeMethodAndTrack("RestoreLayout", arg, resolve, reject, true);
|
|
18467
18481
|
});
|
|
18468
18482
|
}
|
|
@@ -18596,6 +18610,7 @@ class LayoutsAPIImpl {
|
|
|
18596
18610
|
const request = {
|
|
18597
18611
|
name,
|
|
18598
18612
|
type: "Global",
|
|
18613
|
+
timeout: INTEROP_METHOD_MAX_TIMEOUT_MS,
|
|
18599
18614
|
context,
|
|
18600
18615
|
...options
|
|
18601
18616
|
};
|
|
@@ -18744,7 +18759,7 @@ class LayoutsAPIImpl {
|
|
|
18744
18759
|
const err = Utils.typedError(error);
|
|
18745
18760
|
reject(err);
|
|
18746
18761
|
};
|
|
18747
|
-
const methodResponseTimeoutMs = 120 * 1000;
|
|
18762
|
+
const methodResponseTimeoutMs = ("timeout" in args && typeof args.timeout === "number") ? args.timeout : 120 * 1000;
|
|
18748
18763
|
if (!skipStreamEvent) {
|
|
18749
18764
|
this.stream.waitFor(token, methodResponseTimeoutMs)
|
|
18750
18765
|
.then(() => {
|
|
@@ -18833,7 +18848,7 @@ class ACSStream {
|
|
|
18833
18848
|
}
|
|
18834
18849
|
else {
|
|
18835
18850
|
this.logger.trace(`subscribing to "${this.StreamName}" stream`);
|
|
18836
|
-
this.agm.subscribe(this.StreamName, { waitTimeoutMs:
|
|
18851
|
+
this.agm.subscribe(this.StreamName, { waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS, methodResponseTimeout: INTEROP_METHOD_WAIT_TIMEOUT_MS })
|
|
18837
18852
|
.then((subs) => {
|
|
18838
18853
|
this.logger.trace(`subscribed to "${this.StreamName}" stream`);
|
|
18839
18854
|
subs.onData((args) => {
|
|
@@ -19514,12 +19529,17 @@ class ChannelsImpl {
|
|
|
19514
19529
|
validateFdc3Options(options);
|
|
19515
19530
|
}
|
|
19516
19531
|
const id = Utils.generateId();
|
|
19532
|
+
let handlerInvoked = false;
|
|
19533
|
+
const markHandlerInvoked = () => { handlerInvoked = true; };
|
|
19517
19534
|
const wrappedCallback = (options === null || options === void 0 ? void 0 : options.contextType)
|
|
19518
|
-
? this.getWrappedSubscribeCallbackWithFdc3Type(callback, id, options.contextType)
|
|
19519
|
-
: this.getWrappedSubscribeCallback(callback, id);
|
|
19535
|
+
? this.getWrappedSubscribeCallbackWithFdc3Type(callback, id, options.contextType, markHandlerInvoked)
|
|
19536
|
+
: this.getWrappedSubscribeCallback(callback, id, markHandlerInvoked);
|
|
19520
19537
|
let timeoutIndex;
|
|
19521
19538
|
if (this.lastUpdate) {
|
|
19522
19539
|
timeoutIndex = setTimeout(() => {
|
|
19540
|
+
if (handlerInvoked) {
|
|
19541
|
+
return;
|
|
19542
|
+
}
|
|
19523
19543
|
wrappedCallback(this.lastUpdate.context.data, this.lastUpdate.context, {}, this.lastUpdate.updaterId);
|
|
19524
19544
|
}, 0);
|
|
19525
19545
|
}
|
|
@@ -19541,9 +19561,10 @@ class ChannelsImpl {
|
|
|
19541
19561
|
validateFdc3Options(options);
|
|
19542
19562
|
}
|
|
19543
19563
|
const id = Utils.generateId();
|
|
19564
|
+
const markHandlerInvoked = () => { };
|
|
19544
19565
|
const wrappedCallback = (options === null || options === void 0 ? void 0 : options.contextType)
|
|
19545
|
-
? this.getWrappedSubscribeCallbackWithFdc3Type(callback, id, options.contextType)
|
|
19546
|
-
: this.getWrappedSubscribeCallback(callback, id);
|
|
19566
|
+
? this.getWrappedSubscribeCallbackWithFdc3Type(callback, id, options.contextType, markHandlerInvoked)
|
|
19567
|
+
: this.getWrappedSubscribeCallback(callback, id, markHandlerInvoked);
|
|
19547
19568
|
const unsub = await this.shared.subscribeFor(name, wrappedCallback);
|
|
19548
19569
|
return () => {
|
|
19549
19570
|
this.pendingRestrictionCallbacks.delete(id);
|
|
@@ -20079,8 +20100,9 @@ class ChannelsImpl {
|
|
|
20079
20100
|
const fdc3DataToPublish = { [`fdc3_${parsedType}`]: rest };
|
|
20080
20101
|
return this.shared.updateData(channelName, fdc3DataToPublish);
|
|
20081
20102
|
}
|
|
20082
|
-
getWrappedSubscribeCallback(callback, id) {
|
|
20103
|
+
getWrappedSubscribeCallback(callback, id, markHandlerInvoked) {
|
|
20083
20104
|
const wrappedCallback = async (_, context, delta, updaterId) => {
|
|
20105
|
+
markHandlerInvoked();
|
|
20084
20106
|
const restrictionByChannel = await this.getRestrictionsByChannel(context.name);
|
|
20085
20107
|
const channelData = this.getDataWithFdc3Encoding(context, delta);
|
|
20086
20108
|
if (restrictionByChannel.read) {
|
|
@@ -20091,9 +20113,10 @@ class ChannelsImpl {
|
|
|
20091
20113
|
};
|
|
20092
20114
|
return wrappedCallback;
|
|
20093
20115
|
}
|
|
20094
|
-
getWrappedSubscribeCallbackWithFdc3Type(callback, id, fdc3Type) {
|
|
20116
|
+
getWrappedSubscribeCallbackWithFdc3Type(callback, id, fdc3Type, markHandlerInvoked) {
|
|
20095
20117
|
const didReplay = { replayed: false };
|
|
20096
20118
|
const wrappedCallback = async (_, context, delta, updaterId) => {
|
|
20119
|
+
markHandlerInvoked();
|
|
20097
20120
|
const restrictionByChannel = await this.getRestrictionsByChannel(context.name);
|
|
20098
20121
|
const callbackWithTypesChecks = () => {
|
|
20099
20122
|
const { data, latest_fdc3_type } = context;
|
|
@@ -20451,7 +20474,7 @@ class Platform {
|
|
|
20451
20474
|
}
|
|
20452
20475
|
}
|
|
20453
20476
|
|
|
20454
|
-
var version = "6.
|
|
20477
|
+
var version = "6.18.0";
|
|
20455
20478
|
|
|
20456
20479
|
var prepareConfig = (options) => {
|
|
20457
20480
|
function getLibConfig(value, defaultMode, trueMode) {
|
|
@@ -21070,7 +21093,9 @@ class Notifications {
|
|
|
21070
21093
|
arguments: {
|
|
21071
21094
|
sendDeltaOnly: true,
|
|
21072
21095
|
statesVersion2: true
|
|
21073
|
-
}
|
|
21096
|
+
},
|
|
21097
|
+
waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
|
|
21098
|
+
methodResponseTimeout: INTEROP_METHOD_WAIT_TIMEOUT_MS
|
|
21074
21099
|
})
|
|
21075
21100
|
.then((sub) => {
|
|
21076
21101
|
this.subscriptionForNotifications = sub;
|
|
@@ -21102,7 +21127,9 @@ class Notifications {
|
|
|
21102
21127
|
.subscribe(this.NotificationsCounterStream, {
|
|
21103
21128
|
arguments: {
|
|
21104
21129
|
sendDeltaOnly: true
|
|
21105
|
-
}
|
|
21130
|
+
},
|
|
21131
|
+
waitTimeoutMs: INTEROP_METHOD_WAIT_TIMEOUT_MS,
|
|
21132
|
+
methodResponseTimeout: INTEROP_METHOD_WAIT_TIMEOUT_MS
|
|
21106
21133
|
})
|
|
21107
21134
|
.then((sub) => {
|
|
21108
21135
|
this.subscriptionForCounter = sub;
|
|
@@ -22854,6 +22881,32 @@ const clearNullUndefined = (obj) => {
|
|
|
22854
22881
|
}
|
|
22855
22882
|
});
|
|
22856
22883
|
};
|
|
22884
|
+
const validateAddIntentListenerRequest = (request) => {
|
|
22885
|
+
if ((typeof request !== "string" && typeof request !== "object") || (typeof request === "object" && typeof request.intent !== "string")) {
|
|
22886
|
+
throw new Error("Please provide the intent as a string or an object with an intent property!");
|
|
22887
|
+
}
|
|
22888
|
+
if (typeof request === "string") {
|
|
22889
|
+
return;
|
|
22890
|
+
}
|
|
22891
|
+
if (typeof request.contextTypes !== "undefined" && (!Array.isArray(request.contextTypes) || request.contextTypes.some(ctx => typeof ctx !== "string"))) {
|
|
22892
|
+
throw new Error("Please provide the 'contextTypes' as an array of strings!");
|
|
22893
|
+
}
|
|
22894
|
+
if (typeof request.resultType !== "undefined" && typeof request.resultType !== "string") {
|
|
22895
|
+
throw new Error("Please provide the 'resultType' as a string!");
|
|
22896
|
+
}
|
|
22897
|
+
if (typeof request.displayName !== "undefined" && typeof request.displayName !== "string") {
|
|
22898
|
+
throw new Error("Please provide the 'displayName' as a string!");
|
|
22899
|
+
}
|
|
22900
|
+
if (typeof request.icon !== "undefined" && typeof request.icon !== "string") {
|
|
22901
|
+
throw new Error("Please provide the 'icon' as a string!");
|
|
22902
|
+
}
|
|
22903
|
+
if (typeof request.description !== "undefined" && typeof request.description !== "string") {
|
|
22904
|
+
throw new Error("Please provide the 'description' as a string!");
|
|
22905
|
+
}
|
|
22906
|
+
if (typeof request.customConfig !== "undefined" && (typeof request.customConfig !== "object" || Array.isArray(request.customConfig))) {
|
|
22907
|
+
throw new Error("Please provide the 'customConfig' as an object!");
|
|
22908
|
+
}
|
|
22909
|
+
};
|
|
22857
22910
|
|
|
22858
22911
|
class Intents {
|
|
22859
22912
|
constructor(interop, windows, logger, options, prefsController, appsController) {
|
|
@@ -22958,7 +23011,8 @@ class Intents {
|
|
|
22958
23011
|
contextTypes: intentDef.contexts,
|
|
22959
23012
|
applicationIcon: app.icon,
|
|
22960
23013
|
type: "app",
|
|
22961
|
-
resultType: intentDef.resultType
|
|
23014
|
+
resultType: intentDef.resultType,
|
|
23015
|
+
customConfig: intentDef === null || intentDef === void 0 ? void 0 : intentDef.customConfig,
|
|
22962
23016
|
};
|
|
22963
23017
|
intent.handlers.push(handler);
|
|
22964
23018
|
}
|
|
@@ -23039,9 +23093,7 @@ class Intents {
|
|
|
23039
23093
|
return result;
|
|
23040
23094
|
}
|
|
23041
23095
|
async register(intent, handler) {
|
|
23042
|
-
|
|
23043
|
-
throw new Error("Please provide the intent as a string or an object with an intent property!");
|
|
23044
|
-
}
|
|
23096
|
+
validateAddIntentListenerRequest(intent);
|
|
23045
23097
|
if (typeof handler !== "function") {
|
|
23046
23098
|
throw new Error("Please provide the handler as a function!");
|
|
23047
23099
|
}
|
|
@@ -23744,7 +23796,8 @@ class Intents {
|
|
|
23744
23796
|
contextTypes: info.contextTypes || (appIntent === null || appIntent === void 0 ? void 0 : appIntent.contexts),
|
|
23745
23797
|
instanceTitle: title,
|
|
23746
23798
|
type: "instance",
|
|
23747
|
-
resultType: (appIntent === null || appIntent === void 0 ? void 0 : appIntent.resultType) || info.resultType
|
|
23799
|
+
resultType: (appIntent === null || appIntent === void 0 ? void 0 : appIntent.resultType) || info.resultType,
|
|
23800
|
+
customConfig: info === null || info === void 0 ? void 0 : info.customConfig
|
|
23748
23801
|
};
|
|
23749
23802
|
return handler;
|
|
23750
23803
|
}
|
|
@@ -23757,7 +23810,8 @@ class Intents {
|
|
|
23757
23810
|
contextTypes: intent.contexts,
|
|
23758
23811
|
applicationIcon: app.icon,
|
|
23759
23812
|
type: "app",
|
|
23760
|
-
resultType: intent.resultType
|
|
23813
|
+
resultType: intent.resultType,
|
|
23814
|
+
customConfig: intent === null || intent === void 0 ? void 0 : intent.customConfig
|
|
23761
23815
|
};
|
|
23762
23816
|
}
|
|
23763
23817
|
}
|
|
@@ -24391,9 +24445,10 @@ class InMemoryStoreImpl {
|
|
|
24391
24445
|
};
|
|
24392
24446
|
}
|
|
24393
24447
|
catch (error) {
|
|
24394
|
-
const
|
|
24448
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
24449
|
+
const msg = `Failed to import app definitions: ${errorMessage}`;
|
|
24395
24450
|
this.logger.error(msg, error);
|
|
24396
|
-
throw new Error(msg);
|
|
24451
|
+
throw new Error(msg, { cause: error });
|
|
24397
24452
|
}
|
|
24398
24453
|
}
|
|
24399
24454
|
async has(name) {
|
|
@@ -24404,18 +24459,40 @@ class InMemoryStoreImpl {
|
|
|
24404
24459
|
return result.returned.result !== undefined ? result.returned.result : false;
|
|
24405
24460
|
}
|
|
24406
24461
|
async remove(options) {
|
|
24407
|
-
if (
|
|
24462
|
+
if ((options === null || options === void 0 ? void 0 : options.name) === undefined) {
|
|
24408
24463
|
throw new Error("App name is required for removal");
|
|
24409
24464
|
}
|
|
24410
|
-
|
|
24465
|
+
const names = Array.isArray(options.name) ? options.name : [options.name];
|
|
24466
|
+
if (names.length === 0) {
|
|
24467
|
+
throw new Error("At least one app name is required for removal");
|
|
24468
|
+
}
|
|
24469
|
+
const invalidEntries = [];
|
|
24470
|
+
names.forEach((entry, index) => {
|
|
24471
|
+
if (typeof entry !== 'string') {
|
|
24472
|
+
invalidEntries.push(`index ${index}: expected string, got ${typeof entry}`);
|
|
24473
|
+
}
|
|
24474
|
+
else if (entry.trim() === '') {
|
|
24475
|
+
invalidEntries.push(`index ${index}: empty or whitespace-only string`);
|
|
24476
|
+
}
|
|
24477
|
+
});
|
|
24478
|
+
if (invalidEntries.length > 0) {
|
|
24479
|
+
throw new Error(`Invalid app name(s) for removal: ${invalidEntries.join('; ')}`);
|
|
24480
|
+
}
|
|
24481
|
+
const maxSampleSize = 10;
|
|
24482
|
+
const sampleNames = names.slice(0, maxSampleSize);
|
|
24483
|
+
const displayNames = Array.isArray(options.name)
|
|
24484
|
+
? `[${sampleNames.join(", ")}${names.length > maxSampleSize ? ", ..." : ""}] (total ${names.length})`
|
|
24485
|
+
: options.name;
|
|
24486
|
+
this.logger.debug(`Removing app definition(s): ${displayNames}`);
|
|
24411
24487
|
try {
|
|
24412
24488
|
await invokeAppsCommand(this.interop, "in-memory-remove", options);
|
|
24413
|
-
this.logger.debug(`Removed app definition: ${
|
|
24489
|
+
this.logger.debug(`Removed app definition(s): ${displayNames}`);
|
|
24414
24490
|
}
|
|
24415
24491
|
catch (error) {
|
|
24416
|
-
const
|
|
24492
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
24493
|
+
const msg = `Failed to remove app definition(s): ${displayNames}. ${errorMessage}`;
|
|
24417
24494
|
this.logger.error(msg, error);
|
|
24418
|
-
throw new Error(msg);
|
|
24495
|
+
throw new Error(msg, { cause: error });
|
|
24419
24496
|
}
|
|
24420
24497
|
}
|
|
24421
24498
|
async clear(options) {
|
|
@@ -24424,9 +24501,10 @@ class InMemoryStoreImpl {
|
|
|
24424
24501
|
await invokeAppsCommand(this.interop, "in-memory-clear", options);
|
|
24425
24502
|
}
|
|
24426
24503
|
catch (error) {
|
|
24427
|
-
const
|
|
24504
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
24505
|
+
const msg = `Failed to clear in-memory app definitions: ${errorMessage}`;
|
|
24428
24506
|
this.logger.error(msg, error);
|
|
24429
|
-
throw new Error(msg);
|
|
24507
|
+
throw new Error(msg, { cause: error });
|
|
24430
24508
|
}
|
|
24431
24509
|
}
|
|
24432
24510
|
}
|