@openfin/core 40.82.19 → 40.82.21
Sign up to get free protection for your applications and to get access to all the features.
- package/out/mock-alpha.d.ts +110 -10
- package/out/mock-beta.d.ts +110 -10
- package/out/mock-public.d.ts +110 -10
- package/out/mock.d.ts +113 -10
- package/out/mock.js +999 -971
- package/package.json +1 -1
package/out/mock.js
CHANGED
@@ -1055,781 +1055,117 @@ class AsyncRetryableLazy {
|
|
1055
1055
|
}
|
1056
1056
|
lazy.AsyncRetryableLazy = AsyncRetryableLazy;
|
1057
1057
|
|
1058
|
-
var
|
1059
|
-
|
1060
|
-
var apiExposer$1 = {};
|
1061
|
-
|
1062
|
-
var apiConsumer = {};
|
1063
|
-
|
1064
|
-
Object.defineProperty(apiConsumer, "__esModule", { value: true });
|
1065
|
-
apiConsumer.ApiConsumer = void 0;
|
1066
|
-
/**
|
1067
|
-
* Consumer for apis exposed with {@see ApiExposer}.
|
1068
|
-
*
|
1069
|
-
* A strategy that matches the strategy used to expose a target API must be provided.
|
1070
|
-
*/
|
1071
|
-
class ApiConsumer {
|
1072
|
-
// eslint-disable-next-line
|
1073
|
-
constructor(strategy) {
|
1074
|
-
this.strategy = strategy;
|
1075
|
-
/**
|
1076
|
-
* Consumes an api exposed using a given transport strategy, and generates a client
|
1077
|
-
* for easy, type safe consumption of that client.
|
1078
|
-
* @param options Strategy specific consumption options.
|
1079
|
-
* @returns An api client matching the given type.
|
1080
|
-
*/
|
1081
|
-
this.consume = async (options) => {
|
1082
|
-
const exposedProperties = await this.strategy.getExposedFunctions(options);
|
1083
|
-
return exposedProperties.reduce((client, prop) => ({
|
1084
|
-
...client,
|
1085
|
-
[prop.key]: this.strategy.createFunction(prop, options)
|
1086
|
-
}), {});
|
1087
|
-
};
|
1088
|
-
}
|
1089
|
-
}
|
1090
|
-
apiConsumer.ApiConsumer = ApiConsumer;
|
1091
|
-
|
1092
|
-
var apiExposer = {};
|
1093
|
-
|
1094
|
-
var decorators = {};
|
1095
|
-
|
1096
|
-
Object.defineProperty(decorators, "__esModule", { value: true });
|
1097
|
-
decorators.expose = decorators.getExposedProperties = void 0;
|
1098
|
-
const exposedProperties = Symbol('exposedProperties');
|
1099
|
-
const getExposedProperties = (target) => {
|
1100
|
-
return target[exposedProperties] || target.prototype[exposedProperties] || [];
|
1101
|
-
};
|
1102
|
-
decorators.getExposedProperties = getExposedProperties;
|
1103
|
-
/**
|
1104
|
-
* Indicates that a class member function can be exposed using {@link ApiExposer}.
|
1105
|
-
* @param options Options specific to the strategy used in {@link ApiExposer}
|
1106
|
-
*/
|
1107
|
-
// Returns any as decorator typing is weird.
|
1108
|
-
const expose = (options) => (target, key, descriptor) => {
|
1109
|
-
target[exposedProperties] = target[exposedProperties] || [];
|
1110
|
-
target[exposedProperties].push({ key, descriptor, options });
|
1111
|
-
};
|
1112
|
-
decorators.expose = expose;
|
1058
|
+
var main = {};
|
1113
1059
|
|
1114
|
-
Object.defineProperty(
|
1115
|
-
|
1116
|
-
const
|
1117
|
-
|
1118
|
-
* Exposes api services on the transport of choice.
|
1119
|
-
*/
|
1120
|
-
class ApiExposer {
|
1060
|
+
Object.defineProperty(main, "__esModule", { value: true });
|
1061
|
+
main.WebContents = void 0;
|
1062
|
+
const base_1$j = base;
|
1063
|
+
class WebContents extends base_1$j.EmitterBase {
|
1121
1064
|
/**
|
1122
|
-
* @param
|
1065
|
+
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
1066
|
+
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
1123
1067
|
*/
|
1124
|
-
|
1125
|
-
|
1126
|
-
this.
|
1127
|
-
|
1128
|
-
* Exposes an instance of a given api on
|
1129
|
-
* @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
|
1130
|
-
* @param instanceOptions Transport strategy specific options to use when exposing.
|
1131
|
-
*/
|
1132
|
-
this.exposeInstance = async (instance, instanceOptions) => {
|
1133
|
-
const exposableProps = (0, decorators_1.getExposedProperties)(instance);
|
1134
|
-
const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
|
1135
|
-
const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
|
1136
|
-
key,
|
1137
|
-
options,
|
1138
|
-
meta: instanceOptions
|
1139
|
-
});
|
1140
|
-
return {
|
1141
|
-
key,
|
1142
|
-
options: customConsumptionOptions
|
1143
|
-
};
|
1144
|
-
}));
|
1145
|
-
await this.strategy.exposeMeta(instanceOptions, exposedProps);
|
1146
|
-
};
|
1068
|
+
constructor(wire, identity, entityType) {
|
1069
|
+
super(wire, entityType, identity.uuid, identity.name);
|
1070
|
+
this.identity = identity;
|
1071
|
+
this.entityType = entityType;
|
1147
1072
|
}
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1073
|
+
/**
|
1074
|
+
* Gets a base64 encoded image of all or part of the WebContents.
|
1075
|
+
* @param options Options for the capturePage call.
|
1076
|
+
*
|
1077
|
+
* @example
|
1078
|
+
*
|
1079
|
+
* View:
|
1080
|
+
* ```js
|
1081
|
+
* const view = fin.View.getCurrentSync();
|
1082
|
+
*
|
1083
|
+
* // PNG image of a full visible View
|
1084
|
+
* console.log(await view.capturePage());
|
1085
|
+
*
|
1086
|
+
* // Low-quality JPEG image of a defined visible area of the view
|
1087
|
+
* const options = {
|
1088
|
+
* area: {
|
1089
|
+
* height: 100,
|
1090
|
+
* width: 100,
|
1091
|
+
* x: 10,
|
1092
|
+
* y: 10,
|
1093
|
+
* },
|
1094
|
+
* format: 'jpg',
|
1095
|
+
* quality: 20
|
1096
|
+
* }
|
1097
|
+
* console.log(await view.capturePage(options));
|
1098
|
+
* ```
|
1099
|
+
*
|
1100
|
+
* Window:
|
1101
|
+
* ```js
|
1102
|
+
* const wnd = await fin.Window.getCurrent();
|
1103
|
+
*
|
1104
|
+
* // PNG image of a full visible window
|
1105
|
+
* console.log(await wnd.capturePage());
|
1106
|
+
*
|
1107
|
+
* // Low-quality JPEG image of a defined visible area of the window
|
1108
|
+
* const options = {
|
1109
|
+
* area: {
|
1110
|
+
* height: 100,
|
1111
|
+
* width: 100,
|
1112
|
+
* x: 10,
|
1113
|
+
* y: 10,
|
1114
|
+
* },
|
1115
|
+
* format: 'jpg',
|
1116
|
+
* quality: 20
|
1117
|
+
* }
|
1118
|
+
* console.log(await wnd.capturePage(options));
|
1119
|
+
* ```
|
1120
|
+
*
|
1121
|
+
* @remarks
|
1122
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
1123
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
1124
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
1125
|
+
*/
|
1126
|
+
capturePage(options) {
|
1127
|
+
return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
|
1173
1128
|
}
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
(
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
}));
|
1215
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
1216
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1217
|
-
};
|
1218
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
1219
|
-
__exportStar(channelsConsumer, exports);
|
1220
|
-
__exportStar(channelsExposer, exports);
|
1221
|
-
} (openfinChannels));
|
1222
|
-
|
1223
|
-
(function (exports) {
|
1224
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
1225
|
-
if (k2 === undefined) k2 = k;
|
1226
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
1227
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
1228
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
1229
|
-
}
|
1230
|
-
Object.defineProperty(o, k2, desc);
|
1231
|
-
}) : (function(o, m, k, k2) {
|
1232
|
-
if (k2 === undefined) k2 = k;
|
1233
|
-
o[k2] = m[k];
|
1234
|
-
}));
|
1235
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
1236
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1237
|
-
};
|
1238
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
1239
|
-
__exportStar(openfinChannels, exports);
|
1240
|
-
} (strategies));
|
1241
|
-
|
1242
|
-
(function (exports) {
|
1243
|
-
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
1244
|
-
if (k2 === undefined) k2 = k;
|
1245
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
1246
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
1247
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
1248
|
-
}
|
1249
|
-
Object.defineProperty(o, k2, desc);
|
1250
|
-
}) : (function(o, m, k, k2) {
|
1251
|
-
if (k2 === undefined) k2 = k;
|
1252
|
-
o[k2] = m[k];
|
1253
|
-
}));
|
1254
|
-
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
1255
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1256
|
-
};
|
1257
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
1258
|
-
__exportStar(apiConsumer, exports);
|
1259
|
-
__exportStar(apiExposer, exports);
|
1260
|
-
__exportStar(strategies, exports);
|
1261
|
-
__exportStar(decorators, exports);
|
1262
|
-
} (apiExposer$1));
|
1263
|
-
|
1264
|
-
var channelApiRelay = {};
|
1265
|
-
|
1266
|
-
Object.defineProperty(channelApiRelay, "__esModule", { value: true });
|
1267
|
-
channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
|
1268
|
-
const EXPECTED_ERRORS = [
|
1269
|
-
'no longer connected',
|
1270
|
-
'RTCDataChannel closed unexpectedly',
|
1271
|
-
'The client you are trying to dispatch from is disconnected from the target provider',
|
1272
|
-
];
|
1273
|
-
// Checks possible error messages that we want to trap, client error message can originate
|
1274
|
-
// from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
|
1275
|
-
const isDisconnectedError = (errorMsg) => {
|
1276
|
-
return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
|
1277
|
-
};
|
1278
|
-
/**
|
1279
|
-
* @internal
|
1280
|
-
* Create a channel relay for a given channel exposition, allowing a single provider to route
|
1281
|
-
* actions to the designated clients.
|
1282
|
-
*
|
1283
|
-
* Designed to be used in conjunction with @expose
|
1284
|
-
*
|
1285
|
-
* @param channelProvider The channel provider to relay the actions on.
|
1286
|
-
* @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
|
1287
|
-
*/
|
1288
|
-
const relayChannelClientApi = async (channelProvider, relayId) => {
|
1289
|
-
channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
|
1290
|
-
return channelProvider.dispatch(target, action, payload);
|
1291
|
-
});
|
1292
|
-
await Promise.resolve();
|
1293
|
-
};
|
1294
|
-
channelApiRelay.relayChannelClientApi = relayChannelClientApi;
|
1295
|
-
const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
|
1296
|
-
try {
|
1297
|
-
return await client.dispatch(`relay:${relayId}`, {
|
1298
|
-
action,
|
1299
|
-
payload,
|
1300
|
-
target
|
1301
|
-
});
|
1302
|
-
}
|
1303
|
-
catch (e) {
|
1304
|
-
if (isDisconnectedError(e.message) && relayErrorMsg) {
|
1305
|
-
throw new Error(relayErrorMsg);
|
1306
|
-
}
|
1307
|
-
throw e;
|
1308
|
-
}
|
1309
|
-
};
|
1310
|
-
channelApiRelay.createRelayedDispatch = createRelayedDispatch;
|
1311
|
-
|
1312
|
-
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
1313
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
1314
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1315
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1316
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1317
|
-
};
|
1318
|
-
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
1319
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1320
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1321
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1322
|
-
};
|
1323
|
-
var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
|
1324
|
-
Object.defineProperty(layoutEntities, "__esModule", { value: true });
|
1325
|
-
layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
|
1326
|
-
const api_exposer_1 = apiExposer$1;
|
1327
|
-
const channel_api_relay_1 = channelApiRelay;
|
1328
|
-
/*
|
1329
|
-
This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
|
1330
|
-
intertwined, and share members via parent abstract class LayoutNode. To prevent circular
|
1331
|
-
refs, we define and export all the classes here.
|
1332
|
-
*/
|
1333
|
-
/**
|
1334
|
-
* @ignore
|
1335
|
-
* @internal
|
1336
|
-
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
1337
|
-
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
1338
|
-
*/
|
1339
|
-
class LayoutNode {
|
1340
|
-
/**
|
1341
|
-
* @internal
|
1342
|
-
* @ignore
|
1343
|
-
*/
|
1344
|
-
constructor(client, entityId) {
|
1345
|
-
/**
|
1346
|
-
* @ignore
|
1347
|
-
* @internal
|
1348
|
-
* ApiClient for {@link LayoutEntitiesController}
|
1349
|
-
*/
|
1350
|
-
_LayoutNode_client.set(this, void 0);
|
1351
|
-
/**
|
1352
|
-
* Checks if the TabStack or ColumnOrRow is the root content item
|
1353
|
-
*
|
1354
|
-
* @example
|
1355
|
-
* ```js
|
1356
|
-
* if (!fin.me.isView) {
|
1357
|
-
* throw new Error('Not running in a platform View.');
|
1358
|
-
* }
|
1359
|
-
*
|
1360
|
-
* const stack = await fin.me.getCurrentStack();
|
1361
|
-
* const isRoot = await stack.isRoot();
|
1362
|
-
* // The TabStack is root: false
|
1363
|
-
* console.log(`The TabStack is root: ${isRoot}`);
|
1364
|
-
*
|
1365
|
-
* // Retrieves the parent ColumnOrRow
|
1366
|
-
* const parent = await stack.getParent();
|
1367
|
-
* const parentIsRoot = await parent.isRoot();
|
1368
|
-
* // The parent ColumnOrRow is root: true
|
1369
|
-
* console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
|
1370
|
-
* ```
|
1371
|
-
*/
|
1372
|
-
this.isRoot = () => __classPrivateFieldGet$d(this, _LayoutNode_client, "f").isRoot(this.entityId);
|
1373
|
-
/**
|
1374
|
-
* Checks if the TabStack or ColumnOrRow exists
|
1375
|
-
*
|
1376
|
-
* @example
|
1377
|
-
* ```js
|
1378
|
-
* if (!fin.me.isView) {
|
1379
|
-
* throw new Error('Not running in a platform View.');
|
1380
|
-
* }
|
1381
|
-
*
|
1382
|
-
* const stack = await fin.me.getCurrentStack();
|
1383
|
-
* // Retrieves the parent ColumnOrRow
|
1384
|
-
* const columnOrRow = await stack.getParent();
|
1385
|
-
* let exists = await stack.exists();
|
1386
|
-
* // or
|
1387
|
-
* let exists = await columnOrRow.exists();
|
1388
|
-
* // The entity exists: true
|
1389
|
-
* console.log(`The entity exists: ${exists}`);
|
1390
|
-
* ```
|
1391
|
-
*/
|
1392
|
-
this.exists = () => __classPrivateFieldGet$d(this, _LayoutNode_client, "f").exists(this.entityId);
|
1393
|
-
/**
|
1394
|
-
* Retrieves the parent of the TabStack or ColumnOrRow
|
1395
|
-
*
|
1396
|
-
* @example
|
1397
|
-
* ```js
|
1398
|
-
* if (!fin.me.isView) {
|
1399
|
-
* throw new Error('Not running in a platform View.');
|
1400
|
-
* }
|
1401
|
-
*
|
1402
|
-
* const stack = await fin.me.getCurrentStack();
|
1403
|
-
* // Retrieves the parent ColumnOrRow
|
1404
|
-
* const columnOrRow = await stack.getParent();
|
1405
|
-
*
|
1406
|
-
* // undefined if entity is the root item
|
1407
|
-
* let parent = await columnOrRow.getParent();
|
1408
|
-
* // or
|
1409
|
-
* let parent = await stack.getParent();
|
1410
|
-
* ```
|
1411
|
-
*/
|
1412
|
-
this.getParent = async () => {
|
1413
|
-
const parent = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").getParent(this.entityId);
|
1414
|
-
if (!parent) {
|
1415
|
-
return undefined;
|
1416
|
-
}
|
1417
|
-
return LayoutNode.getEntity(parent, __classPrivateFieldGet$d(this, _LayoutNode_client, "f"));
|
1418
|
-
};
|
1419
|
-
/**
|
1420
|
-
* Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
|
1421
|
-
*
|
1422
|
-
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
1423
|
-
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
1424
|
-
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
1425
|
-
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
1426
|
-
*
|
1427
|
-
* @param views The views that will populate the new TabStack.
|
1428
|
-
* @param options Additional options that control new TabStack creation.
|
1429
|
-
* @returns The newly-created TabStack.
|
1430
|
-
*
|
1431
|
-
* @example
|
1432
|
-
* ```js
|
1433
|
-
* if (!fin.me.isView) {
|
1434
|
-
* throw new Error('Not running in a platform View.');
|
1435
|
-
* }
|
1436
|
-
*
|
1437
|
-
* const stack = await fin.me.getCurrentStack();
|
1438
|
-
* const columnOrRow = await stack.getParent();
|
1439
|
-
*
|
1440
|
-
* // Create view references by supplying a 'name' and 'url'
|
1441
|
-
* const views = [
|
1442
|
-
* // if 'name' is undefined, one will be generated
|
1443
|
-
* // if 'url' is undefined, it will default the view URL to 'about:blank'
|
1444
|
-
* { name: 'google-view', url: 'http://google.com/'},
|
1445
|
-
* { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
|
1446
|
-
* ];
|
1447
|
-
*
|
1448
|
-
* // Create a view beforehand to be included in the new tab stack
|
1449
|
-
* const outsideView = await fin.View.create({
|
1450
|
-
* name: 'outside-bloomberg-view',
|
1451
|
-
* url: 'https://bloomberg.com/',
|
1452
|
-
* target: fin.me.identity,
|
1453
|
-
* });
|
1454
|
-
*
|
1455
|
-
* // Views to add can be identities, or the reference views mentioned above
|
1456
|
-
* const viewsToAdd = [outsideView.identity, ...views];
|
1457
|
-
*
|
1458
|
-
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
1459
|
-
* let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
|
1460
|
-
* // Or
|
1461
|
-
* let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
|
1462
|
-
* console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
|
1463
|
-
*
|
1464
|
-
* ```
|
1465
|
-
* @experimental
|
1466
|
-
*/
|
1467
|
-
this.createAdjacentStack = async (views, options) => {
|
1468
|
-
const entityId = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
1469
|
-
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$d(this, _LayoutNode_client, "f"));
|
1470
|
-
};
|
1471
|
-
/**
|
1472
|
-
* Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
|
1473
|
-
*
|
1474
|
-
* @param edge Edge whose adjacent TabStacks will be returned.
|
1475
|
-
*
|
1476
|
-
* @example
|
1477
|
-
* ```js
|
1478
|
-
* if (!fin.me.isView) {
|
1479
|
-
* throw new Error('Not running in a platform View.');
|
1480
|
-
* }
|
1481
|
-
*
|
1482
|
-
* const stack = await fin.me.getCurrentStack();
|
1483
|
-
* const columnOrRow = await stack.getParent();
|
1484
|
-
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
1485
|
-
* let rightStacks = await columnOrRow.getAdjacentStacks('right');
|
1486
|
-
* let leftStacks = await columnOrRow.getAdjacentStacks('left');
|
1487
|
-
* // or
|
1488
|
-
* let rightStacks = await stack.getAdjacentStacks('right');
|
1489
|
-
* let leftStacks = await stack.getAdjacentStacks('left');
|
1490
|
-
*
|
1491
|
-
* console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
|
1492
|
-
*
|
1493
|
-
* ```
|
1494
|
-
* @experimental
|
1495
|
-
*/
|
1496
|
-
this.getAdjacentStacks = async (edge) => {
|
1497
|
-
const adjacentStacks = await __classPrivateFieldGet$d(this, _LayoutNode_client, "f").getAdjacentStacks({
|
1498
|
-
targetId: this.entityId,
|
1499
|
-
edge
|
1500
|
-
});
|
1501
|
-
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
1502
|
-
type: 'stack',
|
1503
|
-
entityId: stack.entityId
|
1504
|
-
}, __classPrivateFieldGet$d(this, _LayoutNode_client, "f")));
|
1505
|
-
};
|
1506
|
-
__classPrivateFieldSet$c(this, _LayoutNode_client, client, "f");
|
1507
|
-
this.entityId = entityId;
|
1508
|
-
}
|
1509
|
-
}
|
1510
|
-
layoutEntities.LayoutNode = LayoutNode;
|
1511
|
-
_LayoutNode_client = new WeakMap();
|
1512
|
-
/**
|
1513
|
-
* @ignore
|
1514
|
-
* @internal
|
1515
|
-
* Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
|
1516
|
-
* @param client
|
1517
|
-
* @param controllerId
|
1518
|
-
* @param identity
|
1519
|
-
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
1520
|
-
*/
|
1521
|
-
LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
|
1522
|
-
const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that does not exist or has been destroyed.');
|
1523
|
-
const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
|
1524
|
-
return consumer.consume({ id: controllerId });
|
1525
|
-
};
|
1526
|
-
LayoutNode.getEntity = (definition, client) => {
|
1527
|
-
const { entityId, type } = definition;
|
1528
|
-
switch (type) {
|
1529
|
-
case 'column':
|
1530
|
-
case 'row':
|
1531
|
-
return new ColumnOrRow(client, entityId, type);
|
1532
|
-
case 'stack':
|
1533
|
-
return new TabStack(client, entityId);
|
1534
|
-
default:
|
1535
|
-
throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
|
1536
|
-
}
|
1537
|
-
};
|
1538
|
-
/**
|
1539
|
-
* A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
|
1540
|
-
*/
|
1541
|
-
class TabStack extends LayoutNode {
|
1542
|
-
/** @internal */
|
1543
|
-
constructor(client, entityId) {
|
1544
|
-
super(client, entityId);
|
1545
|
-
/**
|
1546
|
-
* @internal
|
1547
|
-
* ApiClient for {@link LayoutEntitiesController}
|
1548
|
-
*/
|
1549
|
-
_TabStack_client.set(this, void 0);
|
1550
|
-
/**
|
1551
|
-
* Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
|
1552
|
-
*/
|
1553
|
-
this.type = 'stack';
|
1554
|
-
/**
|
1555
|
-
* Retrieves a list of all views belonging to this {@link TabStack}.
|
1556
|
-
*
|
1557
|
-
* Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
|
1558
|
-
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
1559
|
-
* If that happens and then getViews() is called, it will return the identities in a different order than
|
1560
|
-
* than the currently rendered tab order.
|
1561
|
-
*
|
1562
|
-
*
|
1563
|
-
* @throws If the {@link TabStack} has been destroyed.
|
1564
|
-
* @example
|
1565
|
-
* ```js
|
1566
|
-
* if (!fin.me.isView) {
|
1567
|
-
* throw new Error('Not running in a platform View.');
|
1568
|
-
* }
|
1569
|
-
*
|
1570
|
-
* const stack = await fin.me.getCurrentStack();
|
1571
|
-
* // Alternatively, you can wrap any view and get the stack from there
|
1572
|
-
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
1573
|
-
* // const stack = await viewFromSomewhere.getCurrentStack();
|
1574
|
-
* const views = await stack.getViews();
|
1575
|
-
* console.log(`Stack contains ${views.length} view(s)`);
|
1576
|
-
* ```
|
1577
|
-
* @experimental
|
1578
|
-
*/
|
1579
|
-
this.getViews = () => __classPrivateFieldGet$d(this, _TabStack_client, "f").getStackViews(this.entityId);
|
1580
|
-
/**
|
1581
|
-
* Adds or creates a view in this {@link TabStack}.
|
1582
|
-
*
|
1583
|
-
* @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
1584
|
-
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
1585
|
-
*
|
1586
|
-
* @param view The identity of an existing view to add, or options to create a view.
|
1587
|
-
* @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
1588
|
-
* @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
|
1589
|
-
* @throws If the view does not exist or fails to create.
|
1590
|
-
* @throws If the {@link TabStack} has been destroyed.
|
1591
|
-
* @example
|
1592
|
-
* ```js
|
1593
|
-
* if (!fin.me.isView) {
|
1594
|
-
* throw new Error('Not running in a platform View.');
|
1595
|
-
* }
|
1596
|
-
*
|
1597
|
-
* const stack = await fin.me.getCurrentStack();
|
1598
|
-
* // Alternatively, you can wrap any view and get the stack from there
|
1599
|
-
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
1600
|
-
* // const stack = await viewFromSomewhere.getCurrentStack();
|
1601
|
-
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
1602
|
-
* console.log('Identity of the google view just added', { googleViewIdentity });
|
1603
|
-
* // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
|
1604
|
-
* const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
|
1605
|
-
* console.log('Identity of the apple view just added', { appleViewIdentity });
|
1606
|
-
* ```
|
1607
|
-
* @experimental
|
1608
|
-
*/
|
1609
|
-
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$d(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
1610
|
-
/**
|
1611
|
-
* Removes a view from this {@link TabStack}.
|
1612
|
-
*
|
1613
|
-
* @remarks Throws an exception if the view identity does not exist or was already destroyed.
|
1614
|
-
*
|
1615
|
-
* @param view - Identity of the view to remove.
|
1616
|
-
* @throws If the view does not exist or does not belong to the stack.
|
1617
|
-
* @throws If the {@link TabStack} has been destroyed.
|
1618
|
-
*
|
1619
|
-
* @example
|
1620
|
-
* ```js
|
1621
|
-
* if (!fin.me.isView) {
|
1622
|
-
* throw new Error('Not running in a platform View.');
|
1623
|
-
* }
|
1624
|
-
*
|
1625
|
-
* const stack = await fin.me.getCurrentStack();
|
1626
|
-
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
1627
|
-
*
|
1628
|
-
* await stack.removeView(googleViewIdentity);
|
1629
|
-
*
|
1630
|
-
* try {
|
1631
|
-
* await stack.removeView(googleViewIdentity);
|
1632
|
-
* } catch (error) {
|
1633
|
-
* // Tried to remove a view ('google-view') which does not belong to the stack.
|
1634
|
-
* console.log(error);
|
1635
|
-
* }
|
1636
|
-
* ```
|
1637
|
-
*/
|
1638
|
-
this.removeView = async (view) => {
|
1639
|
-
await __classPrivateFieldGet$d(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
1640
|
-
};
|
1641
|
-
/**
|
1642
|
-
* Sets the active view of the {@link TabStack} without focusing it.
|
1643
|
-
* @param view - Identity of the view to activate.
|
1644
|
-
* @returns Promise which resolves with void once the view has been activated.
|
1645
|
-
* @throws If the {@link TabStack} has been destroyed.
|
1646
|
-
* @throws If the view does not exist.
|
1647
|
-
* @example
|
1648
|
-
* Change the active tab of a known View's TabStack:
|
1649
|
-
* ```js
|
1650
|
-
* const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
|
1651
|
-
* const stack = await targetView.getCurrentStack();
|
1652
|
-
* await stack.setActiveView(targetView.identity);
|
1653
|
-
* ```
|
1654
|
-
*
|
1655
|
-
* Set the current View as active within its TabStack:
|
1656
|
-
* ```js
|
1657
|
-
* const stack = await fin.me.getCurrentStack();
|
1658
|
-
* await stack.setActiveView(fin.me.identity);
|
1659
|
-
* ```
|
1660
|
-
* @experimental
|
1661
|
-
*/
|
1662
|
-
this.setActiveView = async (view) => {
|
1663
|
-
await __classPrivateFieldGet$d(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
1664
|
-
};
|
1665
|
-
__classPrivateFieldSet$c(this, _TabStack_client, client, "f");
|
1666
|
-
}
|
1667
|
-
}
|
1668
|
-
layoutEntities.TabStack = TabStack;
|
1669
|
-
_TabStack_client = new WeakMap();
|
1670
|
-
/**
|
1671
|
-
* A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
|
1672
|
-
*/
|
1673
|
-
class ColumnOrRow extends LayoutNode {
|
1674
|
-
/**
|
1675
|
-
* @internal
|
1676
|
-
*/
|
1677
|
-
constructor(client, entityId, type) {
|
1678
|
-
super(client, entityId);
|
1679
|
-
/**
|
1680
|
-
* @ignore
|
1681
|
-
* @internal
|
1682
|
-
* ApiClient for {@link LayoutEntitiesController}
|
1683
|
-
*/
|
1684
|
-
_ColumnOrRow_client.set(this, void 0);
|
1685
|
-
/**
|
1686
|
-
* Retrieves the content array of the ColumnOrRow
|
1687
|
-
*
|
1688
|
-
* @example
|
1689
|
-
* ```js
|
1690
|
-
* if (!fin.me.isView) {
|
1691
|
-
* throw new Error('Not running in a platform View.');
|
1692
|
-
* }
|
1693
|
-
*
|
1694
|
-
* const stack = await fin.me.getCurrentStack();
|
1695
|
-
* // Retrieves the parent ColumnOrRow
|
1696
|
-
* const columnOrRow = await stack.getParent();
|
1697
|
-
*
|
1698
|
-
* // returns [TabStack]
|
1699
|
-
* const contentArray = await columnOrRow.getContent();
|
1700
|
-
* console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
|
1701
|
-
* ```
|
1702
|
-
*/
|
1703
|
-
this.getContent = async () => {
|
1704
|
-
const contentItemEntities = await __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
1705
|
-
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$d(this, _ColumnOrRow_client, "f")));
|
1706
|
-
};
|
1707
|
-
__classPrivateFieldSet$c(this, _ColumnOrRow_client, client, "f");
|
1708
|
-
this.type = type;
|
1709
|
-
}
|
1710
|
-
}
|
1711
|
-
layoutEntities.ColumnOrRow = ColumnOrRow;
|
1712
|
-
_ColumnOrRow_client = new WeakMap();
|
1713
|
-
|
1714
|
-
var layout_constants = {};
|
1715
|
-
|
1716
|
-
Object.defineProperty(layout_constants, "__esModule", { value: true });
|
1717
|
-
layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
|
1718
|
-
layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
|
1719
|
-
// TODO: eventually export this somehow
|
1720
|
-
layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
|
1721
|
-
|
1722
|
-
var main = {};
|
1723
|
-
|
1724
|
-
Object.defineProperty(main, "__esModule", { value: true });
|
1725
|
-
main.WebContents = void 0;
|
1726
|
-
const base_1$j = base;
|
1727
|
-
class WebContents extends base_1$j.EmitterBase {
|
1728
|
-
/**
|
1729
|
-
* @param identity The identity of the {@link OpenFin.WebContentsEvents WebContents}.
|
1730
|
-
* @param entityType The type of the {@link OpenFin.WebContentsEvents WebContents}.
|
1731
|
-
*/
|
1732
|
-
constructor(wire, identity, entityType) {
|
1733
|
-
super(wire, entityType, identity.uuid, identity.name);
|
1734
|
-
this.identity = identity;
|
1735
|
-
this.entityType = entityType;
|
1736
|
-
}
|
1737
|
-
/**
|
1738
|
-
* Gets a base64 encoded image of all or part of the WebContents.
|
1739
|
-
* @param options Options for the capturePage call.
|
1740
|
-
*
|
1741
|
-
* @example
|
1742
|
-
*
|
1743
|
-
* View:
|
1744
|
-
* ```js
|
1745
|
-
* const view = fin.View.getCurrentSync();
|
1746
|
-
*
|
1747
|
-
* // PNG image of a full visible View
|
1748
|
-
* console.log(await view.capturePage());
|
1749
|
-
*
|
1750
|
-
* // Low-quality JPEG image of a defined visible area of the view
|
1751
|
-
* const options = {
|
1752
|
-
* area: {
|
1753
|
-
* height: 100,
|
1754
|
-
* width: 100,
|
1755
|
-
* x: 10,
|
1756
|
-
* y: 10,
|
1757
|
-
* },
|
1758
|
-
* format: 'jpg',
|
1759
|
-
* quality: 20
|
1760
|
-
* }
|
1761
|
-
* console.log(await view.capturePage(options));
|
1762
|
-
* ```
|
1763
|
-
*
|
1764
|
-
* Window:
|
1765
|
-
* ```js
|
1766
|
-
* const wnd = await fin.Window.getCurrent();
|
1767
|
-
*
|
1768
|
-
* // PNG image of a full visible window
|
1769
|
-
* console.log(await wnd.capturePage());
|
1770
|
-
*
|
1771
|
-
* // Low-quality JPEG image of a defined visible area of the window
|
1772
|
-
* const options = {
|
1773
|
-
* area: {
|
1774
|
-
* height: 100,
|
1775
|
-
* width: 100,
|
1776
|
-
* x: 10,
|
1777
|
-
* y: 10,
|
1778
|
-
* },
|
1779
|
-
* format: 'jpg',
|
1780
|
-
* quality: 20
|
1781
|
-
* }
|
1782
|
-
* console.log(await wnd.capturePage(options));
|
1783
|
-
* ```
|
1784
|
-
*
|
1785
|
-
* @remarks
|
1786
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
1787
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
1788
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
1789
|
-
*/
|
1790
|
-
capturePage(options) {
|
1791
|
-
return this.wire.sendAction('capture-page', { options, ...this.identity }).then(({ payload }) => payload.data);
|
1792
|
-
}
|
1793
|
-
/**
|
1794
|
-
* Executes Javascript on the WebContents, restricted to contents you own or contents owned by
|
1795
|
-
* applications you have created.
|
1796
|
-
* @param code JavaScript code to be executed on the view.
|
1797
|
-
*
|
1798
|
-
* @example
|
1799
|
-
* View:
|
1800
|
-
* ```js
|
1801
|
-
* async function executeJavaScript(code) {
|
1802
|
-
* const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
|
1803
|
-
* return await view.executeJavaScript(code);
|
1804
|
-
* }
|
1805
|
-
*
|
1806
|
-
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
1807
|
-
* ```
|
1808
|
-
*
|
1809
|
-
* Window:
|
1810
|
-
* ```js
|
1811
|
-
* async function executeJavaScript(code) {
|
1812
|
-
* const app = await fin.Application.start({
|
1813
|
-
* name: 'myApp',
|
1814
|
-
* uuid: 'app-1',
|
1815
|
-
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
|
1816
|
-
* autoShow: true
|
1817
|
-
* });
|
1818
|
-
* const win = await app.getWindow();
|
1819
|
-
* return await win.executeJavaScript(code);
|
1820
|
-
* }
|
1821
|
-
*
|
1822
|
-
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
1823
|
-
* ```
|
1824
|
-
* @remarks
|
1825
|
-
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
1826
|
-
* We do not expose an explicit superclass for this functionality, but it does have its own
|
1827
|
-
* {@link OpenFin.WebContentsEvents event namespace}.
|
1828
|
-
*/
|
1829
|
-
executeJavaScript(code) {
|
1830
|
-
return this.wire
|
1831
|
-
.sendAction('execute-javascript-in-window', { ...this.identity, code })
|
1832
|
-
.then(({ payload }) => payload.data);
|
1129
|
+
/**
|
1130
|
+
* Executes Javascript on the WebContents, restricted to contents you own or contents owned by
|
1131
|
+
* applications you have created.
|
1132
|
+
* @param code JavaScript code to be executed on the view.
|
1133
|
+
*
|
1134
|
+
* @example
|
1135
|
+
* View:
|
1136
|
+
* ```js
|
1137
|
+
* async function executeJavaScript(code) {
|
1138
|
+
* const view = await fin.View.wrap({uuid: 'uuid', name: 'view name'});
|
1139
|
+
* return await view.executeJavaScript(code);
|
1140
|
+
* }
|
1141
|
+
*
|
1142
|
+
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
1143
|
+
* ```
|
1144
|
+
*
|
1145
|
+
* Window:
|
1146
|
+
* ```js
|
1147
|
+
* async function executeJavaScript(code) {
|
1148
|
+
* const app = await fin.Application.start({
|
1149
|
+
* name: 'myApp',
|
1150
|
+
* uuid: 'app-1',
|
1151
|
+
* url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Window.executeJavaScript.html',
|
1152
|
+
* autoShow: true
|
1153
|
+
* });
|
1154
|
+
* const win = await app.getWindow();
|
1155
|
+
* return await win.executeJavaScript(code);
|
1156
|
+
* }
|
1157
|
+
*
|
1158
|
+
* executeJavaScript(`console.log('Hello, Openfin')`).then(() => console.log('Javascript excuted')).catch(err => console.log(err));
|
1159
|
+
* ```
|
1160
|
+
* @remarks
|
1161
|
+
* `WebContents` refers to shared functionality between {@link OpenFin.Window} and {@link OpenFin.View}.
|
1162
|
+
* We do not expose an explicit superclass for this functionality, but it does have its own
|
1163
|
+
* {@link OpenFin.WebContentsEvents event namespace}.
|
1164
|
+
*/
|
1165
|
+
executeJavaScript(code) {
|
1166
|
+
return this.wire
|
1167
|
+
.sendAction('execute-javascript-in-window', { ...this.identity, code })
|
1168
|
+
.then(({ payload }) => payload.data);
|
1833
1169
|
}
|
1834
1170
|
/**
|
1835
1171
|
* Returns the zoom level of the WebContents.
|
@@ -2795,18 +2131,11 @@ var hasRequiredInstance$2;
|
|
2795
2131
|
function requireInstance$2 () {
|
2796
2132
|
if (hasRequiredInstance$2) return Instance$5;
|
2797
2133
|
hasRequiredInstance$2 = 1;
|
2798
|
-
var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
2799
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
2800
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
2801
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
2802
|
-
};
|
2803
2134
|
var _View_providerChannelClient;
|
2804
2135
|
Object.defineProperty(Instance$5, "__esModule", { value: true });
|
2805
2136
|
Instance$5.View = void 0;
|
2806
2137
|
const transport_errors_1 = transportErrors;
|
2807
2138
|
const lazy_1 = lazy;
|
2808
|
-
const layout_entities_1 = layoutEntities;
|
2809
|
-
const layout_constants_1 = layout_constants;
|
2810
2139
|
const main_1 = main;
|
2811
2140
|
const window_1 = requireWindow();
|
2812
2141
|
/**
|
@@ -3124,7 +2453,7 @@ function requireInstance$2 () {
|
|
3124
2453
|
return ack.payload.data;
|
3125
2454
|
};
|
3126
2455
|
/**
|
3127
|
-
* Retrieves the
|
2456
|
+
* Retrieves the OpenFin.Layout instance for the Window the View is attached to.
|
3128
2457
|
*
|
3129
2458
|
* @example
|
3130
2459
|
* ```js
|
@@ -3140,29 +2469,7 @@ function requireInstance$2 () {
|
|
3140
2469
|
this.wire.sendAction('view-get-parent-layout', { ...this.identity }).catch(() => {
|
3141
2470
|
// don't expose
|
3142
2471
|
});
|
3143
|
-
|
3144
|
-
let layoutWindowIdentity = layoutWindow.identity;
|
3145
|
-
// TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
|
3146
|
-
if (layoutWindowIdentity.identity) {
|
3147
|
-
layoutWindowIdentity = layoutWindowIdentity.identity;
|
3148
|
-
}
|
3149
|
-
try {
|
3150
|
-
const providerChannelClient = await __classPrivateFieldGet(this, _View_providerChannelClient, "f").getValue();
|
3151
|
-
const client = await layout_entities_1.LayoutNode.newLayoutEntitiesClient(providerChannelClient, layout_constants_1.LAYOUT_CONTROLLER_ID, layoutWindowIdentity);
|
3152
|
-
const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(this.identity);
|
3153
|
-
return this.fin.Platform.Layout.wrap(layoutIdentity);
|
3154
|
-
}
|
3155
|
-
catch (e) {
|
3156
|
-
const allowedErrors = [
|
3157
|
-
'No action registered at target for',
|
3158
|
-
'getLayoutIdentityForViewOrThrow is not a function'
|
3159
|
-
];
|
3160
|
-
if (!allowedErrors.some((m) => e.message.includes(m))) {
|
3161
|
-
throw e;
|
3162
|
-
}
|
3163
|
-
// fallback logic for missing endpoint
|
3164
|
-
return this.fin.Platform.Layout.wrap(layoutWindowIdentity);
|
3165
|
-
}
|
2472
|
+
return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
|
3166
2473
|
};
|
3167
2474
|
/**
|
3168
2475
|
* Gets the View's options.
|
@@ -8312,12 +7619,12 @@ class ChannelError extends Error {
|
|
8312
7619
|
}
|
8313
7620
|
channelError.ChannelError = ChannelError;
|
8314
7621
|
|
8315
|
-
var __classPrivateFieldGet$
|
7622
|
+
var __classPrivateFieldGet$d = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8316
7623
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8317
7624
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8318
7625
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8319
7626
|
};
|
8320
|
-
var __classPrivateFieldSet$
|
7627
|
+
var __classPrivateFieldSet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8321
7628
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8322
7629
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8323
7630
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -8361,7 +7668,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8361
7668
|
static closeChannelByEndpointId(id) {
|
8362
7669
|
const channel = channelClientsByEndpointId.get(id);
|
8363
7670
|
if (channel) {
|
8364
|
-
__classPrivateFieldGet$
|
7671
|
+
__classPrivateFieldGet$d(channel, _ChannelClient_close, "f").call(channel);
|
8365
7672
|
}
|
8366
7673
|
}
|
8367
7674
|
/**
|
@@ -8372,7 +7679,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8372
7679
|
for (const channelClient of channelClientsByEndpointId.values()) {
|
8373
7680
|
if (channelClient.providerIdentity.channelId === eventPayload.channelId) {
|
8374
7681
|
channelClient.disconnectListener(eventPayload);
|
8375
|
-
__classPrivateFieldGet$
|
7682
|
+
__classPrivateFieldGet$d(channelClient, _ChannelClient_close, "f").call(channelClient);
|
8376
7683
|
}
|
8377
7684
|
}
|
8378
7685
|
}
|
@@ -8387,12 +7694,12 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8387
7694
|
this.processAction = (action, payload, senderIdentity) => super.processAction(action, payload, senderIdentity);
|
8388
7695
|
_ChannelClient_close.set(this, () => {
|
8389
7696
|
channelClientsByEndpointId.delete(this.endpointId);
|
8390
|
-
__classPrivateFieldGet$
|
7697
|
+
__classPrivateFieldGet$d(this, _ChannelClient_strategy, "f").close();
|
8391
7698
|
});
|
8392
|
-
__classPrivateFieldSet$
|
7699
|
+
__classPrivateFieldSet$c(this, _ChannelClient_protectedObj, new channel_1$1.ProtectedItems(routingInfo, close), "f");
|
8393
7700
|
this.disconnectListener = () => undefined;
|
8394
7701
|
this.endpointId = routingInfo.endpointId;
|
8395
|
-
__classPrivateFieldSet$
|
7702
|
+
__classPrivateFieldSet$c(this, _ChannelClient_strategy, strategy, "f");
|
8396
7703
|
channelClientsByEndpointId.set(this.endpointId, this);
|
8397
7704
|
strategy.receive(this.processAction);
|
8398
7705
|
}
|
@@ -8400,7 +7707,7 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8400
7707
|
* a read-only provider identity
|
8401
7708
|
*/
|
8402
7709
|
get providerIdentity() {
|
8403
|
-
const protectedObj = __classPrivateFieldGet$
|
7710
|
+
const protectedObj = __classPrivateFieldGet$d(this, _ChannelClient_protectedObj, "f");
|
8404
7711
|
return protectedObj.providerIdentity;
|
8405
7712
|
}
|
8406
7713
|
/**
|
@@ -8429,9 +7736,9 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8429
7736
|
* ```
|
8430
7737
|
*/
|
8431
7738
|
async dispatch(action, payload) {
|
8432
|
-
if (__classPrivateFieldGet$
|
7739
|
+
if (__classPrivateFieldGet$d(this, _ChannelClient_strategy, "f").isEndpointConnected(this.providerIdentity.channelId)) {
|
8433
7740
|
const callSites = transport_errors_1$2.RuntimeError.getCallSite();
|
8434
|
-
return __classPrivateFieldGet$
|
7741
|
+
return __classPrivateFieldGet$d(this, _ChannelClient_strategy, "f").send(this.providerIdentity.channelId, action, payload).catch((e) => {
|
8435
7742
|
throw new channel_error_1$1.ChannelError(e, action, payload, callSites);
|
8436
7743
|
});
|
8437
7744
|
}
|
@@ -8483,10 +7790,10 @@ class ChannelClient extends channel_1$1.ChannelBase {
|
|
8483
7790
|
*/
|
8484
7791
|
async disconnect() {
|
8485
7792
|
await this.sendDisconnectAction();
|
8486
|
-
__classPrivateFieldGet$
|
7793
|
+
__classPrivateFieldGet$d(this, _ChannelClient_close, "f").call(this);
|
8487
7794
|
}
|
8488
7795
|
async sendDisconnectAction() {
|
8489
|
-
const protectedObj = __classPrivateFieldGet$
|
7796
|
+
const protectedObj = __classPrivateFieldGet$d(this, _ChannelClient_protectedObj, "f");
|
8490
7797
|
await protectedObj.close();
|
8491
7798
|
}
|
8492
7799
|
/**
|
@@ -8519,13 +7826,13 @@ exhaustive.exhaustiveCheck = exhaustiveCheck;
|
|
8519
7826
|
|
8520
7827
|
var strategy$3 = {};
|
8521
7828
|
|
8522
|
-
var __classPrivateFieldSet$
|
7829
|
+
var __classPrivateFieldSet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8523
7830
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8524
7831
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8525
7832
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
8526
7833
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
8527
7834
|
};
|
8528
|
-
var __classPrivateFieldGet$
|
7835
|
+
var __classPrivateFieldGet$c = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8529
7836
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8530
7837
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8531
7838
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -8550,7 +7857,7 @@ class ClassicStrategy {
|
|
8550
7857
|
// connection problems occur
|
8551
7858
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map());
|
8552
7859
|
this.send = async (endpointId, action, payload) => {
|
8553
|
-
const to = __classPrivateFieldGet$
|
7860
|
+
const to = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
8554
7861
|
if (!to) {
|
8555
7862
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
8556
7863
|
}
|
@@ -8562,13 +7869,13 @@ class ClassicStrategy {
|
|
8562
7869
|
}
|
8563
7870
|
delete cleanId.isLocalEndpointId;
|
8564
7871
|
// grab the promise before awaiting it to save in our pending messages map
|
8565
|
-
const p = __classPrivateFieldGet$
|
7872
|
+
const p = __classPrivateFieldGet$c(this, _ClassicStrategy_wire, "f").sendAction('send-channel-message', {
|
8566
7873
|
...cleanId,
|
8567
7874
|
providerIdentity: this.providerIdentity,
|
8568
7875
|
action,
|
8569
7876
|
payload
|
8570
7877
|
});
|
8571
|
-
__classPrivateFieldGet$
|
7878
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
8572
7879
|
const raw = await p
|
8573
7880
|
.catch((error) => {
|
8574
7881
|
if ('cause' in error) {
|
@@ -8578,16 +7885,16 @@ class ClassicStrategy {
|
|
8578
7885
|
})
|
8579
7886
|
.finally(() => {
|
8580
7887
|
// clean up the pending promise
|
8581
|
-
__classPrivateFieldGet$
|
7888
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
8582
7889
|
});
|
8583
7890
|
return raw.payload.data.result;
|
8584
7891
|
};
|
8585
7892
|
this.close = async () => {
|
8586
7893
|
this.messageReceiver.removeEndpoint(this.providerIdentity.channelId, this.endpointId);
|
8587
|
-
[...__classPrivateFieldGet$
|
8588
|
-
__classPrivateFieldSet$
|
7894
|
+
[...__classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").keys()].forEach((id) => this.closeEndpoint(id));
|
7895
|
+
__classPrivateFieldSet$b(this, _ClassicStrategy_endpointIdentityMap, new Map(), "f");
|
8589
7896
|
};
|
8590
|
-
__classPrivateFieldSet$
|
7897
|
+
__classPrivateFieldSet$b(this, _ClassicStrategy_wire, wire, "f");
|
8591
7898
|
}
|
8592
7899
|
onEndpointDisconnect(endpointId, listener) {
|
8593
7900
|
// Never fires for 'classic'.
|
@@ -8596,20 +7903,20 @@ class ClassicStrategy {
|
|
8596
7903
|
this.messageReceiver.addEndpoint(listener, this.providerIdentity.channelId, this.endpointId);
|
8597
7904
|
}
|
8598
7905
|
async closeEndpoint(endpointId) {
|
8599
|
-
const id = __classPrivateFieldGet$
|
8600
|
-
__classPrivateFieldGet$
|
8601
|
-
const pendingSet = __classPrivateFieldGet$
|
7906
|
+
const id = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
7907
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
7908
|
+
const pendingSet = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
8602
7909
|
pendingSet?.forEach((p) => {
|
8603
7910
|
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
8604
7911
|
p.cancel(new Error(errorMsg));
|
8605
7912
|
});
|
8606
7913
|
}
|
8607
7914
|
isEndpointConnected(endpointId) {
|
8608
|
-
return __classPrivateFieldGet$
|
7915
|
+
return __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").has(endpointId);
|
8609
7916
|
}
|
8610
7917
|
addEndpoint(endpointId, payload) {
|
8611
|
-
__classPrivateFieldGet$
|
8612
|
-
__classPrivateFieldGet$
|
7918
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").set(endpointId, payload.endpointIdentity);
|
7919
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
8613
7920
|
}
|
8614
7921
|
isValidEndpointPayload(payload) {
|
8615
7922
|
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
@@ -8644,12 +7951,12 @@ function errorToPOJO(error) {
|
|
8644
7951
|
}
|
8645
7952
|
errors.errorToPOJO = errorToPOJO;
|
8646
7953
|
|
8647
|
-
var __classPrivateFieldGet$
|
7954
|
+
var __classPrivateFieldGet$b = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8648
7955
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8649
7956
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8650
7957
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8651
7958
|
};
|
8652
|
-
var __classPrivateFieldSet$
|
7959
|
+
var __classPrivateFieldSet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8653
7960
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8654
7961
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8655
7962
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -8684,8 +7991,8 @@ class RTCEndpoint {
|
|
8684
7991
|
if (this.rtc.rtcClient.connectionState !== 'connected') {
|
8685
7992
|
this.rtc.rtcClient.removeEventListener('connectionstatechange', this.connectionStateChangeHandler);
|
8686
7993
|
this.close();
|
8687
|
-
if (__classPrivateFieldGet$
|
8688
|
-
__classPrivateFieldGet$
|
7994
|
+
if (__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f")) {
|
7995
|
+
__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
8689
7996
|
}
|
8690
7997
|
}
|
8691
7998
|
};
|
@@ -8733,9 +8040,9 @@ class RTCEndpoint {
|
|
8733
8040
|
data = new TextDecoder().decode(e.data);
|
8734
8041
|
}
|
8735
8042
|
const { messageId, action, payload } = JSON.parse(data);
|
8736
|
-
if (__classPrivateFieldGet$
|
8043
|
+
if (__classPrivateFieldGet$b(this, _RTCEndpoint_processAction, "f")) {
|
8737
8044
|
try {
|
8738
|
-
const res = await __classPrivateFieldGet$
|
8045
|
+
const res = await __classPrivateFieldGet$b(this, _RTCEndpoint_processAction, "f").call(this, action, payload, endpointIdentity);
|
8739
8046
|
this.rtc.channels.response.send(JSON.stringify({
|
8740
8047
|
messageId,
|
8741
8048
|
payload: res,
|
@@ -8769,25 +8076,25 @@ class RTCEndpoint {
|
|
8769
8076
|
datachannel.onclose = (e) => {
|
8770
8077
|
[...this.responseMap.values()].forEach((promise) => promise.reject(new Error('RTCDataChannel closed unexpectedly, this is most commonly caused by message size. Note: RTC Channels have a message size limit of ~255kB.')));
|
8771
8078
|
this.close();
|
8772
|
-
if (__classPrivateFieldGet$
|
8773
|
-
__classPrivateFieldGet$
|
8079
|
+
if (__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f")) {
|
8080
|
+
__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f").call(this);
|
8774
8081
|
}
|
8775
8082
|
};
|
8776
8083
|
});
|
8777
8084
|
}
|
8778
8085
|
onDisconnect(listener) {
|
8779
|
-
if (!__classPrivateFieldGet$
|
8780
|
-
__classPrivateFieldSet$
|
8086
|
+
if (!__classPrivateFieldGet$b(this, _RTCEndpoint_disconnectListener, "f")) {
|
8087
|
+
__classPrivateFieldSet$a(this, _RTCEndpoint_disconnectListener, listener, "f");
|
8781
8088
|
}
|
8782
8089
|
else {
|
8783
8090
|
throw new Error('RTCEndpoint disconnectListener cannot be set twice.');
|
8784
8091
|
}
|
8785
8092
|
}
|
8786
8093
|
receive(listener) {
|
8787
|
-
if (__classPrivateFieldGet$
|
8094
|
+
if (__classPrivateFieldGet$b(this, _RTCEndpoint_processAction, "f")) {
|
8788
8095
|
throw new Error('You have already set a listener for this RTC Endpoint.');
|
8789
8096
|
}
|
8790
|
-
__classPrivateFieldSet$
|
8097
|
+
__classPrivateFieldSet$a(this, _RTCEndpoint_processAction, listener, "f");
|
8791
8098
|
}
|
8792
8099
|
get connected() {
|
8793
8100
|
return this.rtc.rtcClient.connectionState === 'connected';
|
@@ -8798,12 +8105,12 @@ _RTCEndpoint_processAction = new WeakMap(), _RTCEndpoint_disconnectListener = ne
|
|
8798
8105
|
|
8799
8106
|
var strategy$1 = {};
|
8800
8107
|
|
8801
|
-
var __classPrivateFieldGet$
|
8108
|
+
var __classPrivateFieldGet$a = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8802
8109
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
8803
8110
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
8804
8111
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
8805
8112
|
};
|
8806
|
-
var __classPrivateFieldSet$
|
8113
|
+
var __classPrivateFieldSet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
8807
8114
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
8808
8115
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
8809
8116
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -8824,11 +8131,11 @@ class EndpointStrategy {
|
|
8824
8131
|
return this.getEndpointById(endpointId).send(action, payload);
|
8825
8132
|
};
|
8826
8133
|
this.close = async () => {
|
8827
|
-
if (__classPrivateFieldGet$
|
8828
|
-
__classPrivateFieldGet$
|
8829
|
-
__classPrivateFieldSet$
|
8134
|
+
if (__classPrivateFieldGet$a(this, _EndpointStrategy_connected, "f")) {
|
8135
|
+
__classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.close());
|
8136
|
+
__classPrivateFieldSet$9(this, _EndpointStrategy_endpointMap, new Map(), "f");
|
8830
8137
|
}
|
8831
|
-
__classPrivateFieldSet$
|
8138
|
+
__classPrivateFieldSet$9(this, _EndpointStrategy_connected, false, "f");
|
8832
8139
|
};
|
8833
8140
|
this.isValidEndpointPayload = validateEndpoint;
|
8834
8141
|
}
|
@@ -8836,39 +8143,39 @@ class EndpointStrategy {
|
|
8836
8143
|
this.getEndpointById(endpointId).onDisconnect(listener);
|
8837
8144
|
}
|
8838
8145
|
receive(listener) {
|
8839
|
-
if (__classPrivateFieldGet$
|
8146
|
+
if (__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f")) {
|
8840
8147
|
throw new Error(`You have already set a listener for this ${this.StrategyName} Strategy`);
|
8841
8148
|
}
|
8842
|
-
__classPrivateFieldSet$
|
8149
|
+
__classPrivateFieldSet$9(this, _EndpointStrategy_processAction, listener, "f");
|
8843
8150
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
8844
|
-
__classPrivateFieldGet$
|
8151
|
+
__classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").forEach((endpoint) => endpoint.receive(__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f")));
|
8845
8152
|
}
|
8846
8153
|
getEndpointById(endpointId) {
|
8847
|
-
const endpoint = __classPrivateFieldGet$
|
8154
|
+
const endpoint = __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").get(endpointId);
|
8848
8155
|
if (!endpoint) {
|
8849
8156
|
throw new Error(`Client with endpoint id ${endpointId} is not connected`);
|
8850
8157
|
}
|
8851
8158
|
return endpoint;
|
8852
8159
|
}
|
8853
8160
|
get connected() {
|
8854
|
-
return __classPrivateFieldGet$
|
8161
|
+
return __classPrivateFieldGet$a(this, _EndpointStrategy_connected, "f");
|
8855
8162
|
}
|
8856
8163
|
isEndpointConnected(endpointId) {
|
8857
|
-
return __classPrivateFieldGet$
|
8164
|
+
return __classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").has(endpointId);
|
8858
8165
|
}
|
8859
8166
|
addEndpoint(endpointId, payload) {
|
8860
|
-
if (!__classPrivateFieldGet$
|
8167
|
+
if (!__classPrivateFieldGet$a(this, _EndpointStrategy_connected, "f")) {
|
8861
8168
|
console.warn(`Adding endpoint to disconnected ${this.StrategyName} Strategy`);
|
8862
8169
|
return;
|
8863
8170
|
}
|
8864
8171
|
const clientStrat = new this.EndpointType(payload);
|
8865
|
-
if (__classPrivateFieldGet$
|
8866
|
-
clientStrat.receive(__classPrivateFieldGet$
|
8172
|
+
if (__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f")) {
|
8173
|
+
clientStrat.receive(__classPrivateFieldGet$a(this, _EndpointStrategy_processAction, "f"));
|
8867
8174
|
}
|
8868
|
-
__classPrivateFieldGet$
|
8175
|
+
__classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").set(endpointId, clientStrat);
|
8869
8176
|
}
|
8870
8177
|
async closeEndpoint(endpointId) {
|
8871
|
-
__classPrivateFieldGet$
|
8178
|
+
__classPrivateFieldGet$a(this, _EndpointStrategy_endpointMap, "f").delete(endpointId);
|
8872
8179
|
}
|
8873
8180
|
}
|
8874
8181
|
strategy$1.EndpointStrategy = EndpointStrategy;
|
@@ -9050,12 +8357,12 @@ function runtimeUuidMeetsMinimumRuntimeVersion(runtimeUuid, minVersion) {
|
|
9050
8357
|
}
|
9051
8358
|
runtimeVersioning.runtimeUuidMeetsMinimumRuntimeVersion = runtimeUuidMeetsMinimumRuntimeVersion;
|
9052
8359
|
|
9053
|
-
var __classPrivateFieldGet$
|
8360
|
+
var __classPrivateFieldGet$9 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9054
8361
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9055
8362
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
9056
8363
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
9057
8364
|
};
|
9058
|
-
var __classPrivateFieldSet$
|
8365
|
+
var __classPrivateFieldSet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
9059
8366
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
9060
8367
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9061
8368
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
@@ -9099,18 +8406,18 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9099
8406
|
* a read-only array containing all the identities of connecting clients.
|
9100
8407
|
*/
|
9101
8408
|
get connections() {
|
9102
|
-
return [...__classPrivateFieldGet$
|
8409
|
+
return [...__classPrivateFieldGet$9(this, _ChannelProvider_connections, "f")];
|
9103
8410
|
}
|
9104
8411
|
static handleClientDisconnection(channel, payload) {
|
9105
8412
|
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
9106
8413
|
if (removeById) {
|
9107
|
-
__classPrivateFieldGet$
|
8414
|
+
__classPrivateFieldGet$9(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
|
9108
8415
|
}
|
9109
8416
|
else {
|
9110
8417
|
const multipleRemoves = channel.connections.filter((identity) => {
|
9111
8418
|
return identity.uuid === payload.uuid && identity.name === payload.name;
|
9112
8419
|
});
|
9113
|
-
multipleRemoves.forEach(__classPrivateFieldGet$
|
8420
|
+
multipleRemoves.forEach(__classPrivateFieldGet$9(channel, _ChannelProvider_removeEndpoint, "f"));
|
9114
8421
|
}
|
9115
8422
|
channel.disconnectListener(payload);
|
9116
8423
|
}
|
@@ -9127,8 +8434,8 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9127
8434
|
_ChannelProvider_strategy.set(this, void 0);
|
9128
8435
|
_ChannelProvider_removeEndpoint.set(this, (identity) => {
|
9129
8436
|
const remainingConnections = this.connections.filter((clientIdentity) => clientIdentity.endpointId !== identity.endpointId);
|
9130
|
-
__classPrivateFieldGet$
|
9131
|
-
__classPrivateFieldSet$
|
8437
|
+
__classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").closeEndpoint(identity.endpointId);
|
8438
|
+
__classPrivateFieldSet$8(this, _ChannelProvider_connections, remainingConnections, "f");
|
9132
8439
|
});
|
9133
8440
|
// Must be bound.
|
9134
8441
|
this.processAction = async (action, payload, senderIdentity) => {
|
@@ -9142,17 +8449,17 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9142
8449
|
return super.processAction(action, payload, senderIdentity);
|
9143
8450
|
};
|
9144
8451
|
_ChannelProvider_close.set(this, () => {
|
9145
|
-
__classPrivateFieldGet$
|
8452
|
+
__classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").close();
|
9146
8453
|
const remove = ChannelProvider.removalMap.get(this);
|
9147
8454
|
if (remove) {
|
9148
8455
|
remove();
|
9149
8456
|
}
|
9150
8457
|
});
|
9151
|
-
__classPrivateFieldSet$
|
8458
|
+
__classPrivateFieldSet$8(this, _ChannelProvider_protectedObj, new channel_1.ProtectedItems(providerIdentity, close), "f");
|
9152
8459
|
this.connectListener = () => undefined;
|
9153
8460
|
this.disconnectListener = () => undefined;
|
9154
|
-
__classPrivateFieldSet$
|
9155
|
-
__classPrivateFieldSet$
|
8461
|
+
__classPrivateFieldSet$8(this, _ChannelProvider_connections, [], "f");
|
8462
|
+
__classPrivateFieldSet$8(this, _ChannelProvider_strategy, strategy, "f");
|
9156
8463
|
strategy.receive(this.processAction);
|
9157
8464
|
}
|
9158
8465
|
/**
|
@@ -9183,16 +8490,16 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9183
8490
|
*/
|
9184
8491
|
dispatch(to, action, payload) {
|
9185
8492
|
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
9186
|
-
if (endpointId && __classPrivateFieldGet$
|
8493
|
+
if (endpointId && __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
9187
8494
|
const callSites = transport_errors_1$1.RuntimeError.getCallSite();
|
9188
|
-
return __classPrivateFieldGet$
|
8495
|
+
return __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload).catch((e) => {
|
9189
8496
|
throw new channel_error_1.ChannelError(e, action, payload, callSites);
|
9190
8497
|
});
|
9191
8498
|
}
|
9192
8499
|
return Promise.reject(new Error(`Client connection with identity uuid: ${to.uuid} / name: ${to.name} / endpointId: ${endpointId} no longer connected.`));
|
9193
8500
|
}
|
9194
8501
|
async processConnection(senderId, payload) {
|
9195
|
-
__classPrivateFieldGet$
|
8502
|
+
__classPrivateFieldGet$9(this, _ChannelProvider_connections, "f").push(senderId);
|
9196
8503
|
return this.connectListener(senderId, payload);
|
9197
8504
|
}
|
9198
8505
|
/**
|
@@ -9215,7 +8522,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9215
8522
|
* ```
|
9216
8523
|
*/
|
9217
8524
|
publish(action, payload) {
|
9218
|
-
return this.connections.map((to) => __classPrivateFieldGet$
|
8525
|
+
return this.connections.map((to) => __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(to.endpointId, action, payload));
|
9219
8526
|
}
|
9220
8527
|
/**
|
9221
8528
|
* Register a listener that is called on every new client connection.
|
@@ -9289,11 +8596,11 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9289
8596
|
* ```
|
9290
8597
|
*/
|
9291
8598
|
async destroy() {
|
9292
|
-
const protectedObj = __classPrivateFieldGet$
|
8599
|
+
const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
|
9293
8600
|
protectedObj.providerIdentity;
|
9294
|
-
__classPrivateFieldSet$
|
8601
|
+
__classPrivateFieldSet$8(this, _ChannelProvider_connections, [], "f");
|
9295
8602
|
await protectedObj.close();
|
9296
|
-
__classPrivateFieldGet$
|
8603
|
+
__classPrivateFieldGet$9(this, _ChannelProvider_close, "f").call(this);
|
9297
8604
|
}
|
9298
8605
|
/**
|
9299
8606
|
* Returns an array with info on every Client connected to the Provider
|
@@ -9363,7 +8670,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
9363
8670
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
9364
8671
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
9365
8672
|
if (matchingConnections.length >= 2) {
|
9366
|
-
const protectedObj = __classPrivateFieldGet$
|
8673
|
+
const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
|
9367
8674
|
const { uuid, name } = clientIdentity;
|
9368
8675
|
const providerUuid = protectedObj?.providerIdentity.uuid;
|
9369
8676
|
const providerName = protectedObj?.providerIdentity.name;
|
@@ -9575,13 +8882,13 @@ class CombinedStrategy {
|
|
9575
8882
|
}
|
9576
8883
|
strategy.default = CombinedStrategy;
|
9577
8884
|
|
9578
|
-
var __classPrivateFieldSet$
|
8885
|
+
var __classPrivateFieldSet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
9579
8886
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
9580
8887
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9581
8888
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
9582
8889
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
9583
8890
|
};
|
9584
|
-
var __classPrivateFieldGet$
|
8891
|
+
var __classPrivateFieldGet$8 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9585
8892
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9586
8893
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
9587
8894
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -9630,8 +8937,8 @@ class ConnectionManager extends base_1$f.Base {
|
|
9630
8937
|
};
|
9631
8938
|
this.providerMap = new Map();
|
9632
8939
|
this.protocolManager = new protocol_manager_1.ProtocolManager(this.wire.environment.type === 'node' ? ['classic'] : ['rtc', 'classic']);
|
9633
|
-
__classPrivateFieldSet$
|
9634
|
-
__classPrivateFieldSet$
|
8940
|
+
__classPrivateFieldSet$7(this, _ConnectionManager_messageReceiver, new message_receiver_1.MessageReceiver(wire), "f");
|
8941
|
+
__classPrivateFieldSet$7(this, _ConnectionManager_rtcConnectionManager, new ice_manager_1.RTCICEManager(wire), "f");
|
9635
8942
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
9636
8943
|
}
|
9637
8944
|
createProvider(options, providerIdentity) {
|
@@ -9642,7 +8949,7 @@ class ConnectionManager extends base_1$f.Base {
|
|
9642
8949
|
case 'rtc':
|
9643
8950
|
return new strategy_2.RTCStrategy();
|
9644
8951
|
case 'classic':
|
9645
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
8952
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f"),
|
9646
8953
|
// Providers do not have an endpointId, use channelId as endpointId in the strategy.
|
9647
8954
|
providerIdentity.channelId, providerIdentity);
|
9648
8955
|
default:
|
@@ -9678,7 +8985,7 @@ class ConnectionManager extends base_1$f.Base {
|
|
9678
8985
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
9679
8986
|
switch (type) {
|
9680
8987
|
case 'rtc': {
|
9681
|
-
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$
|
8988
|
+
const { rtcClient, channels, offer, rtcConnectionId, channelsOpened } = await __classPrivateFieldGet$8(this, _ConnectionManager_rtcConnectionManager, "f").startClientOffer();
|
9682
8989
|
rtcPacket = { rtcClient, channels, channelsOpened };
|
9683
8990
|
return {
|
9684
8991
|
type: 'rtc',
|
@@ -9705,18 +9012,18 @@ class ConnectionManager extends base_1$f.Base {
|
|
9705
9012
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
9706
9013
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
9707
9014
|
// clients that are in the same context as the newly-connected client.
|
9708
|
-
__classPrivateFieldGet$
|
9015
|
+
__classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
9709
9016
|
}
|
9710
9017
|
const answer = routingInfo.answer ?? {
|
9711
9018
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
9712
9019
|
};
|
9713
9020
|
const createStrategyFromAnswer = async (protocol) => {
|
9714
9021
|
if (protocol.type === 'rtc' && rtcPacket) {
|
9715
|
-
await __classPrivateFieldGet$
|
9022
|
+
await __classPrivateFieldGet$8(this, _ConnectionManager_rtcConnectionManager, "f").finishClientOffer(rtcPacket.rtcClient, protocol.payload.answer, rtcPacket.channelsOpened);
|
9716
9023
|
return new strategy_2.RTCStrategy();
|
9717
9024
|
}
|
9718
9025
|
if (protocol.type === 'classic') {
|
9719
|
-
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$
|
9026
|
+
return new strategy_1.ClassicStrategy(this.wire, __classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f"), routingInfo.endpointId, routingInfo);
|
9720
9027
|
}
|
9721
9028
|
return null;
|
9722
9029
|
};
|
@@ -9784,7 +9091,7 @@ class ConnectionManager extends base_1$f.Base {
|
|
9784
9091
|
clientAnswer = await overlappingProtocols.reduce(async (accumP, protocolToUse) => {
|
9785
9092
|
const answer = await accumP;
|
9786
9093
|
if (protocolToUse.type === 'rtc') {
|
9787
|
-
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$
|
9094
|
+
const { answer: rtcAnswer, rtcClient, channels } = await __classPrivateFieldGet$8(this, _ConnectionManager_rtcConnectionManager, "f").createProviderAnswer(protocolToUse.payload.rtcConnectionId, protocolToUse.payload.offer);
|
9788
9095
|
answer.supportedProtocols.push({
|
9789
9096
|
type: 'rtc',
|
9790
9097
|
version: strategy_2.RTCInfo.version,
|
@@ -9832,13 +9139,13 @@ _ConnectionManager_messageReceiver = new WeakMap(), _ConnectionManager_rtcConnec
|
|
9832
9139
|
*
|
9833
9140
|
* @packageDocumentation
|
9834
9141
|
*/
|
9835
|
-
var __classPrivateFieldSet$
|
9142
|
+
var __classPrivateFieldSet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
9836
9143
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
9837
9144
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9838
9145
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
9839
9146
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
9840
9147
|
};
|
9841
|
-
var __classPrivateFieldGet$
|
9148
|
+
var __classPrivateFieldGet$7 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9842
9149
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9843
9150
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
9844
9151
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -9895,11 +9202,11 @@ class Channel extends base_1$e.EmitterBase {
|
|
9895
9202
|
client_1.ChannelClient.handleProviderDisconnect(eventPayload);
|
9896
9203
|
}),
|
9897
9204
|
this.on('connected', (...args) => {
|
9898
|
-
__classPrivateFieldGet$
|
9205
|
+
__classPrivateFieldGet$7(this, _Channel_internalEmitter, "f").emit('connected', ...args);
|
9899
9206
|
})
|
9900
9207
|
]).catch(() => new Error('error setting up channel connection listeners'));
|
9901
9208
|
}));
|
9902
|
-
__classPrivateFieldSet$
|
9209
|
+
__classPrivateFieldSet$6(this, _Channel_connectionManager, new connection_manager_1.ConnectionManager(wire), "f");
|
9903
9210
|
}
|
9904
9211
|
/**
|
9905
9212
|
*
|
@@ -9974,7 +9281,7 @@ class Channel extends base_1$e.EmitterBase {
|
|
9974
9281
|
resolve(true);
|
9975
9282
|
}
|
9976
9283
|
};
|
9977
|
-
__classPrivateFieldGet$
|
9284
|
+
__classPrivateFieldGet$7(this, _Channel_internalEmitter, "f").on('connected', connectedListener);
|
9978
9285
|
});
|
9979
9286
|
try {
|
9980
9287
|
if (retryInfo.count > 0) {
|
@@ -10006,7 +9313,7 @@ class Channel extends base_1$e.EmitterBase {
|
|
10006
9313
|
finally {
|
10007
9314
|
retryInfo.count += 1;
|
10008
9315
|
// in case of other errors, remove our listener
|
10009
|
-
__classPrivateFieldGet$
|
9316
|
+
__classPrivateFieldGet$7(this, _Channel_internalEmitter, "f").removeListener('connected', connectedListener);
|
10010
9317
|
}
|
10011
9318
|
} while (shouldWait); // If we're waiting we retry the above loop
|
10012
9319
|
// Should wait was false, no channel was found.
|
@@ -10065,12 +9372,12 @@ class Channel extends base_1$e.EmitterBase {
|
|
10065
9372
|
async connect(channelName, options = {}) {
|
10066
9373
|
// Make sure we don't connect before listeners are set up
|
10067
9374
|
// This also errors if we're not in OpenFin, ensuring we don't run unnecessary code
|
10068
|
-
await __classPrivateFieldGet$
|
9375
|
+
await __classPrivateFieldGet$7(this, _Channel_readyToConnect, "f").getValue();
|
10069
9376
|
if (!channelName || typeof channelName !== 'string') {
|
10070
9377
|
throw new Error('Please provide a channelName string to connect to a channel.');
|
10071
9378
|
}
|
10072
9379
|
const opts = { wait: true, ...this.wire.environment.getDefaultChannelOptions().connect, ...options };
|
10073
|
-
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$
|
9380
|
+
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet$7(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
10074
9381
|
let connectionUrl;
|
10075
9382
|
if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
|
10076
9383
|
connectionUrl = (await this.fin.me.getInfo()).url;
|
@@ -10082,7 +9389,7 @@ class Channel extends base_1$e.EmitterBase {
|
|
10082
9389
|
connectionUrl
|
10083
9390
|
};
|
10084
9391
|
const routingInfo = await this.safeConnect(channelName, opts.wait, connectPayload);
|
10085
|
-
const strategy = await __classPrivateFieldGet$
|
9392
|
+
const strategy = await __classPrivateFieldGet$7(this, _Channel_connectionManager, "f").createClientStrategy(rtcPacket, routingInfo);
|
10086
9393
|
const channel = new client_1.ChannelClient(routingInfo, () => client_1.ChannelClient.wireClose(this.wire, routingInfo, routingInfo.endpointId), strategy);
|
10087
9394
|
// It is the client's responsibility to handle endpoint disconnection to the provider.
|
10088
9395
|
// If the endpoint dies, the client will force a disconnection through the core.
|
@@ -10151,7 +9458,7 @@ class Channel extends base_1$e.EmitterBase {
|
|
10151
9458
|
throw new Error('Please provide a channelName to create a channel');
|
10152
9459
|
}
|
10153
9460
|
const { payload: { data: providerIdentity } } = await this.wire.sendAction('create-channel', { channelName });
|
10154
|
-
const channel = __classPrivateFieldGet$
|
9461
|
+
const channel = __classPrivateFieldGet$7(this, _Channel_connectionManager, "f").createProvider(options, providerIdentity);
|
10155
9462
|
// TODO: fix typing (internal)
|
10156
9463
|
// @ts-expect-error
|
10157
9464
|
this.on('client-disconnected', (eventPayload) => {
|
@@ -11042,13 +10349,13 @@ var Factory$3 = {};
|
|
11042
10349
|
|
11043
10350
|
var Instance$2 = {};
|
11044
10351
|
|
11045
|
-
var __classPrivateFieldSet$
|
10352
|
+
var __classPrivateFieldSet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
11046
10353
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
11047
10354
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
11048
10355
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
11049
10356
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
11050
10357
|
};
|
11051
|
-
var __classPrivateFieldGet$
|
10358
|
+
var __classPrivateFieldGet$6 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11052
10359
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
11053
10360
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
11054
10361
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
@@ -11085,24 +10392,24 @@ class Platform extends base_1$6.EmitterBase {
|
|
11085
10392
|
this.wire.sendAction('platform-get-client', this.identity).catch((e) => {
|
11086
10393
|
// don't expose
|
11087
10394
|
});
|
11088
|
-
if (!Platform.clientMap.has(__classPrivateFieldGet$
|
11089
|
-
const clientPromise = __classPrivateFieldGet$
|
11090
|
-
Platform.clientMap.set(__classPrivateFieldGet$
|
10395
|
+
if (!Platform.clientMap.has(__classPrivateFieldGet$6(this, _Platform_channelName, "f"))) {
|
10396
|
+
const clientPromise = __classPrivateFieldGet$6(this, _Platform_connectToProvider, "f").call(this);
|
10397
|
+
Platform.clientMap.set(__classPrivateFieldGet$6(this, _Platform_channelName, "f"), clientPromise);
|
11091
10398
|
}
|
11092
10399
|
// we set it above
|
11093
10400
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
11094
|
-
return Platform.clientMap.get(__classPrivateFieldGet$
|
10401
|
+
return Platform.clientMap.get(__classPrivateFieldGet$6(this, _Platform_channelName, "f"));
|
11095
10402
|
};
|
11096
10403
|
_Platform_connectToProvider.set(this, async () => {
|
11097
10404
|
try {
|
11098
|
-
const client = await this._channel.connect(__classPrivateFieldGet$
|
10405
|
+
const client = await this._channel.connect(__classPrivateFieldGet$6(this, _Platform_channelName, "f"), { wait: false });
|
11099
10406
|
client.onDisconnection(() => {
|
11100
|
-
Platform.clientMap.delete(__classPrivateFieldGet$
|
10407
|
+
Platform.clientMap.delete(__classPrivateFieldGet$6(this, _Platform_channelName, "f"));
|
11101
10408
|
});
|
11102
10409
|
return client;
|
11103
10410
|
}
|
11104
10411
|
catch (e) {
|
11105
|
-
Platform.clientMap.delete(__classPrivateFieldGet$
|
10412
|
+
Platform.clientMap.delete(__classPrivateFieldGet$6(this, _Platform_channelName, "f"));
|
11106
10413
|
throw new Error('The targeted Platform is not currently running. Listen for application-started event for the given Uuid.');
|
11107
10414
|
}
|
11108
10415
|
});
|
@@ -11115,7 +10422,7 @@ class Platform extends base_1$6.EmitterBase {
|
|
11115
10422
|
if (errorMsg) {
|
11116
10423
|
throw new Error(errorMsg);
|
11117
10424
|
}
|
11118
|
-
__classPrivateFieldSet$
|
10425
|
+
__classPrivateFieldSet$5(this, _Platform_channelName, channelName, "f");
|
11119
10426
|
this._channel = this.fin.InterApplicationBus.Channel;
|
11120
10427
|
this.identity = { uuid: identity.uuid };
|
11121
10428
|
this.Layout = this.fin.Platform.Layout;
|
@@ -11834,88 +11141,752 @@ class Platform extends base_1$6.EmitterBase {
|
|
11834
11141
|
* ```
|
11835
11142
|
* @experimental
|
11836
11143
|
*/
|
11837
|
-
async getWindowContext(target) {
|
11838
|
-
this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
|
11144
|
+
async getWindowContext(target) {
|
11145
|
+
this.wire.sendAction('platform-get-window-context', this.identity).catch((e) => {
|
11146
|
+
// don't expose
|
11147
|
+
});
|
11148
|
+
const client = await this.getClient();
|
11149
|
+
const { entityType } = target ? await this.fin.System.getEntityInfo(target.uuid, target.name) : this.fin.me;
|
11150
|
+
return client.dispatch('get-window-context', {
|
11151
|
+
target: target || { uuid: this.fin.me.uuid, name: this.fin.me.name },
|
11152
|
+
entityType
|
11153
|
+
});
|
11154
|
+
}
|
11155
|
+
/**
|
11156
|
+
* Closes a window. If enableBeforeUnload is enabled in the Platform options, any beforeunload handler set on Views will fire
|
11157
|
+
* This behavior can be disabled by setting skipBeforeUnload to false in the options parameter.
|
11158
|
+
* @param winId
|
11159
|
+
* @param options
|
11160
|
+
*
|
11161
|
+
* @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
|
11162
|
+
* it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
|
11163
|
+
*
|
11164
|
+
* @example
|
11165
|
+
*
|
11166
|
+
* ```js
|
11167
|
+
* // Close the current Window inside a Window context
|
11168
|
+
* const platform = await fin.Platform.getCurrent();
|
11169
|
+
* platform.closeWindow(fin.me.identity);
|
11170
|
+
*
|
11171
|
+
* // Close the Window from inside a View context
|
11172
|
+
* const platform = await fin.Platform.getCurrent();
|
11173
|
+
* const parentWindow = await fin.me.getCurrentWindow();
|
11174
|
+
* platform.closeWindow(parentWindow.identity);
|
11175
|
+
*
|
11176
|
+
* // Close the Window and do not fire the before unload handler on Views
|
11177
|
+
* const platform = await fin.Platform.getCurrent();
|
11178
|
+
* platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
|
11179
|
+
* ```
|
11180
|
+
* @experimental
|
11181
|
+
*/
|
11182
|
+
async closeWindow(windowId, options = { skipBeforeUnload: false }) {
|
11183
|
+
this.wire.sendAction('platform-close-window', this.identity).catch((e) => {
|
11839
11184
|
// don't expose
|
11840
11185
|
});
|
11841
11186
|
const client = await this.getClient();
|
11842
|
-
|
11843
|
-
|
11844
|
-
|
11845
|
-
|
11187
|
+
return client.dispatch('close-window', { windowId, options });
|
11188
|
+
}
|
11189
|
+
}
|
11190
|
+
Instance$2.Platform = Platform;
|
11191
|
+
_Platform_channelName = new WeakMap(), _Platform_connectToProvider = new WeakMap();
|
11192
|
+
/**
|
11193
|
+
* @internal
|
11194
|
+
* Reuse clients to avoid overwriting already-registered client in provider
|
11195
|
+
* This ensures that only channel client is created per channel name per `fin` instance
|
11196
|
+
*/
|
11197
|
+
Platform.clientMap = new Map();
|
11198
|
+
|
11199
|
+
var layout = {};
|
11200
|
+
|
11201
|
+
var Factory$2 = {};
|
11202
|
+
|
11203
|
+
var Instance$1 = {};
|
11204
|
+
|
11205
|
+
var commonUtils = {};
|
11206
|
+
|
11207
|
+
Object.defineProperty(commonUtils, "__esModule", { value: true });
|
11208
|
+
commonUtils.overrideFromComposables = commonUtils.isValidPresetType = void 0;
|
11209
|
+
function isValidPresetType(type) {
|
11210
|
+
switch (type) {
|
11211
|
+
case 'columns':
|
11212
|
+
case 'grid':
|
11213
|
+
case 'rows':
|
11214
|
+
case 'tabs':
|
11215
|
+
return true;
|
11216
|
+
default:
|
11217
|
+
return false;
|
11218
|
+
}
|
11219
|
+
}
|
11220
|
+
commonUtils.isValidPresetType = isValidPresetType;
|
11221
|
+
function overrideFromComposables(...overrides) {
|
11222
|
+
return (base) => overrides.reduceRight((p, c) => (b) => c(p(b)), (x) => x)(base);
|
11223
|
+
}
|
11224
|
+
commonUtils.overrideFromComposables = overrideFromComposables;
|
11225
|
+
commonUtils.default = { isValidPresetType };
|
11226
|
+
|
11227
|
+
var layoutEntities = {};
|
11228
|
+
|
11229
|
+
var apiExposer$1 = {};
|
11230
|
+
|
11231
|
+
var apiConsumer = {};
|
11232
|
+
|
11233
|
+
Object.defineProperty(apiConsumer, "__esModule", { value: true });
|
11234
|
+
apiConsumer.ApiConsumer = void 0;
|
11235
|
+
/**
|
11236
|
+
* Consumer for apis exposed with {@see ApiExposer}.
|
11237
|
+
*
|
11238
|
+
* A strategy that matches the strategy used to expose a target API must be provided.
|
11239
|
+
*/
|
11240
|
+
class ApiConsumer {
|
11241
|
+
// eslint-disable-next-line
|
11242
|
+
constructor(strategy) {
|
11243
|
+
this.strategy = strategy;
|
11244
|
+
/**
|
11245
|
+
* Consumes an api exposed using a given transport strategy, and generates a client
|
11246
|
+
* for easy, type safe consumption of that client.
|
11247
|
+
* @param options Strategy specific consumption options.
|
11248
|
+
* @returns An api client matching the given type.
|
11249
|
+
*/
|
11250
|
+
this.consume = async (options) => {
|
11251
|
+
const exposedProperties = await this.strategy.getExposedFunctions(options);
|
11252
|
+
return exposedProperties.reduce((client, prop) => ({
|
11253
|
+
...client,
|
11254
|
+
[prop.key]: this.strategy.createFunction(prop, options)
|
11255
|
+
}), {});
|
11256
|
+
};
|
11257
|
+
}
|
11258
|
+
}
|
11259
|
+
apiConsumer.ApiConsumer = ApiConsumer;
|
11260
|
+
|
11261
|
+
var apiExposer = {};
|
11262
|
+
|
11263
|
+
var decorators = {};
|
11264
|
+
|
11265
|
+
Object.defineProperty(decorators, "__esModule", { value: true });
|
11266
|
+
decorators.expose = decorators.getExposedProperties = void 0;
|
11267
|
+
const exposedProperties = Symbol('exposedProperties');
|
11268
|
+
const getExposedProperties = (target) => {
|
11269
|
+
return target[exposedProperties] || target.prototype[exposedProperties] || [];
|
11270
|
+
};
|
11271
|
+
decorators.getExposedProperties = getExposedProperties;
|
11272
|
+
/**
|
11273
|
+
* Indicates that a class member function can be exposed using {@link ApiExposer}.
|
11274
|
+
* @param options Options specific to the strategy used in {@link ApiExposer}
|
11275
|
+
*/
|
11276
|
+
// Returns any as decorator typing is weird.
|
11277
|
+
const expose = (options) => (target, key, descriptor) => {
|
11278
|
+
target[exposedProperties] = target[exposedProperties] || [];
|
11279
|
+
target[exposedProperties].push({ key, descriptor, options });
|
11280
|
+
};
|
11281
|
+
decorators.expose = expose;
|
11282
|
+
|
11283
|
+
Object.defineProperty(apiExposer, "__esModule", { value: true });
|
11284
|
+
apiExposer.ApiExposer = void 0;
|
11285
|
+
const decorators_1 = decorators;
|
11286
|
+
/**
|
11287
|
+
* Exposes api services on the transport of choice.
|
11288
|
+
*/
|
11289
|
+
class ApiExposer {
|
11290
|
+
/**
|
11291
|
+
* @param strategy The expose strategy to use to expose instances.
|
11292
|
+
*/
|
11293
|
+
// eslint-disable-next-line
|
11294
|
+
constructor(strategy) {
|
11295
|
+
this.strategy = strategy;
|
11296
|
+
/**
|
11297
|
+
* Exposes an instance of a given api on
|
11298
|
+
* @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
|
11299
|
+
* @param instanceOptions Transport strategy specific options to use when exposing.
|
11300
|
+
*/
|
11301
|
+
this.exposeInstance = async (instance, instanceOptions) => {
|
11302
|
+
const exposableProps = (0, decorators_1.getExposedProperties)(instance);
|
11303
|
+
const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
|
11304
|
+
const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
|
11305
|
+
key,
|
11306
|
+
options,
|
11307
|
+
meta: instanceOptions
|
11308
|
+
});
|
11309
|
+
return {
|
11310
|
+
key,
|
11311
|
+
options: customConsumptionOptions
|
11312
|
+
};
|
11313
|
+
}));
|
11314
|
+
await this.strategy.exposeMeta(instanceOptions, exposedProps);
|
11315
|
+
};
|
11316
|
+
}
|
11317
|
+
;
|
11318
|
+
}
|
11319
|
+
apiExposer.ApiExposer = ApiExposer;
|
11320
|
+
|
11321
|
+
var strategies = {};
|
11322
|
+
|
11323
|
+
var openfinChannels = {};
|
11324
|
+
|
11325
|
+
var channelsConsumer = {};
|
11326
|
+
|
11327
|
+
Object.defineProperty(channelsConsumer, "__esModule", { value: true });
|
11328
|
+
channelsConsumer.ChannelsConsumer = void 0;
|
11329
|
+
class ChannelsConsumer {
|
11330
|
+
// eslint-disable-next-line
|
11331
|
+
constructor(channel) {
|
11332
|
+
this.channel = channel;
|
11333
|
+
this.getExposedFunctions = async (options) => {
|
11334
|
+
const { id } = options;
|
11335
|
+
const { props } = await this.channel.dispatch(`api-meta:${id}`);
|
11336
|
+
return props;
|
11337
|
+
};
|
11338
|
+
this.createFunction = (prop) => (...args) => {
|
11339
|
+
const { action } = prop.options;
|
11340
|
+
return this.channel.dispatch(action, { args });
|
11341
|
+
};
|
11342
|
+
}
|
11343
|
+
;
|
11344
|
+
}
|
11345
|
+
channelsConsumer.ChannelsConsumer = ChannelsConsumer;
|
11346
|
+
|
11347
|
+
var channelsExposer = {};
|
11348
|
+
|
11349
|
+
Object.defineProperty(channelsExposer, "__esModule", { value: true });
|
11350
|
+
channelsExposer.ChannelsExposer = void 0;
|
11351
|
+
class ChannelsExposer {
|
11352
|
+
// eslint-disable-next-line
|
11353
|
+
constructor(channelProviderOrClient) {
|
11354
|
+
this.channelProviderOrClient = channelProviderOrClient;
|
11355
|
+
this.exposeFunction = async (target, config) => {
|
11356
|
+
const { key, options, meta } = config;
|
11357
|
+
const { id } = meta;
|
11358
|
+
const action = `${id}.${options?.action || key}`;
|
11359
|
+
await this.channelProviderOrClient.register(action, async ({ args }) => {
|
11360
|
+
return target(...args);
|
11361
|
+
});
|
11362
|
+
return { action };
|
11363
|
+
};
|
11364
|
+
this.exposeMeta = async ({ id }, props) => {
|
11365
|
+
const action = `api-meta:${id}`;
|
11366
|
+
await this.channelProviderOrClient.register(action, () => ({ props }));
|
11367
|
+
};
|
11368
|
+
}
|
11369
|
+
}
|
11370
|
+
channelsExposer.ChannelsExposer = ChannelsExposer;
|
11371
|
+
|
11372
|
+
(function (exports) {
|
11373
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
11374
|
+
if (k2 === undefined) k2 = k;
|
11375
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
11376
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
11377
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
11378
|
+
}
|
11379
|
+
Object.defineProperty(o, k2, desc);
|
11380
|
+
}) : (function(o, m, k, k2) {
|
11381
|
+
if (k2 === undefined) k2 = k;
|
11382
|
+
o[k2] = m[k];
|
11383
|
+
}));
|
11384
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
11385
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11386
|
+
};
|
11387
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
11388
|
+
__exportStar(channelsConsumer, exports);
|
11389
|
+
__exportStar(channelsExposer, exports);
|
11390
|
+
} (openfinChannels));
|
11391
|
+
|
11392
|
+
(function (exports) {
|
11393
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
11394
|
+
if (k2 === undefined) k2 = k;
|
11395
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
11396
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
11397
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
11398
|
+
}
|
11399
|
+
Object.defineProperty(o, k2, desc);
|
11400
|
+
}) : (function(o, m, k, k2) {
|
11401
|
+
if (k2 === undefined) k2 = k;
|
11402
|
+
o[k2] = m[k];
|
11403
|
+
}));
|
11404
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
11405
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11406
|
+
};
|
11407
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
11408
|
+
__exportStar(openfinChannels, exports);
|
11409
|
+
} (strategies));
|
11410
|
+
|
11411
|
+
(function (exports) {
|
11412
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
11413
|
+
if (k2 === undefined) k2 = k;
|
11414
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
11415
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
11416
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
11417
|
+
}
|
11418
|
+
Object.defineProperty(o, k2, desc);
|
11419
|
+
}) : (function(o, m, k, k2) {
|
11420
|
+
if (k2 === undefined) k2 = k;
|
11421
|
+
o[k2] = m[k];
|
11422
|
+
}));
|
11423
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
11424
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
11425
|
+
};
|
11426
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
11427
|
+
__exportStar(apiConsumer, exports);
|
11428
|
+
__exportStar(apiExposer, exports);
|
11429
|
+
__exportStar(strategies, exports);
|
11430
|
+
__exportStar(decorators, exports);
|
11431
|
+
} (apiExposer$1));
|
11432
|
+
|
11433
|
+
var channelApiRelay = {};
|
11434
|
+
|
11435
|
+
Object.defineProperty(channelApiRelay, "__esModule", { value: true });
|
11436
|
+
channelApiRelay.createRelayedDispatch = channelApiRelay.relayChannelClientApi = void 0;
|
11437
|
+
const EXPECTED_ERRORS = [
|
11438
|
+
'no longer connected',
|
11439
|
+
'RTCDataChannel closed unexpectedly',
|
11440
|
+
'The client you are trying to dispatch from is disconnected from the target provider',
|
11441
|
+
];
|
11442
|
+
// Checks possible error messages that we want to trap, client error message can originate
|
11443
|
+
// from ChannelProvider::dispatch OR ClassicStrategy::closeEndpoint OR RTCEndPoint::dataChannel::onclose
|
11444
|
+
const isDisconnectedError = (errorMsg) => {
|
11445
|
+
return EXPECTED_ERRORS.some(e => errorMsg.includes(e));
|
11446
|
+
};
|
11447
|
+
/**
|
11448
|
+
* @internal
|
11449
|
+
* Create a channel relay for a given channel exposition, allowing a single provider to route
|
11450
|
+
* actions to the designated clients.
|
11451
|
+
*
|
11452
|
+
* Designed to be used in conjunction with @expose
|
11453
|
+
*
|
11454
|
+
* @param channelProvider The channel provider to relay the actions on.
|
11455
|
+
* @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
|
11456
|
+
*/
|
11457
|
+
const relayChannelClientApi = async (channelProvider, relayId) => {
|
11458
|
+
channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
|
11459
|
+
return channelProvider.dispatch(target, action, payload);
|
11460
|
+
});
|
11461
|
+
await Promise.resolve();
|
11462
|
+
};
|
11463
|
+
channelApiRelay.relayChannelClientApi = relayChannelClientApi;
|
11464
|
+
const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
|
11465
|
+
try {
|
11466
|
+
return await client.dispatch(`relay:${relayId}`, {
|
11467
|
+
action,
|
11468
|
+
payload,
|
11469
|
+
target
|
11846
11470
|
});
|
11847
11471
|
}
|
11472
|
+
catch (e) {
|
11473
|
+
if (isDisconnectedError(e.message) && relayErrorMsg) {
|
11474
|
+
throw new Error(relayErrorMsg);
|
11475
|
+
}
|
11476
|
+
throw e;
|
11477
|
+
}
|
11478
|
+
};
|
11479
|
+
channelApiRelay.createRelayedDispatch = createRelayedDispatch;
|
11480
|
+
|
11481
|
+
var __classPrivateFieldSet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
11482
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
11483
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
11484
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
11485
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
11486
|
+
};
|
11487
|
+
var __classPrivateFieldGet$5 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11488
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
11489
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
11490
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11491
|
+
};
|
11492
|
+
var _LayoutNode_client, _TabStack_client, _ColumnOrRow_client;
|
11493
|
+
Object.defineProperty(layoutEntities, "__esModule", { value: true });
|
11494
|
+
layoutEntities.ColumnOrRow = layoutEntities.TabStack = layoutEntities.LayoutNode = void 0;
|
11495
|
+
const api_exposer_1 = apiExposer$1;
|
11496
|
+
const channel_api_relay_1 = channelApiRelay;
|
11497
|
+
/*
|
11498
|
+
This file includes LayoutNode, ColumnOrRow and TabStack classes, which are all closely
|
11499
|
+
intertwined, and share members via parent abstract class LayoutNode. To prevent circular
|
11500
|
+
refs, we define and export all the classes here.
|
11501
|
+
*/
|
11502
|
+
/**
|
11503
|
+
* @ignore
|
11504
|
+
* @internal
|
11505
|
+
* Supplies an ApiClient for {@link LayoutEntitiesController} and helper methods
|
11506
|
+
* for the entities {@link TabStack} AND {@link ColumnOrRow} to use.
|
11507
|
+
*/
|
11508
|
+
class LayoutNode {
|
11848
11509
|
/**
|
11849
|
-
*
|
11850
|
-
*
|
11851
|
-
* @param winId
|
11852
|
-
* @param options
|
11853
|
-
*
|
11854
|
-
* @remarks This method works by setting a `close-requested` handler on the Platform Window. If you have your own `close-requested` handler set on the Platform Window as well,
|
11855
|
-
* it is recommended to move that logic over to the [PlatformProvider.closeWindow]{@link PlatformProvider#closeWindow} override to ensure it runs when the Window closes.
|
11856
|
-
*
|
11857
|
-
* @example
|
11858
|
-
*
|
11859
|
-
* ```js
|
11860
|
-
* // Close the current Window inside a Window context
|
11861
|
-
* const platform = await fin.Platform.getCurrent();
|
11862
|
-
* platform.closeWindow(fin.me.identity);
|
11863
|
-
*
|
11864
|
-
* // Close the Window from inside a View context
|
11865
|
-
* const platform = await fin.Platform.getCurrent();
|
11866
|
-
* const parentWindow = await fin.me.getCurrentWindow();
|
11867
|
-
* platform.closeWindow(parentWindow.identity);
|
11868
|
-
*
|
11869
|
-
* // Close the Window and do not fire the before unload handler on Views
|
11870
|
-
* const platform = await fin.Platform.getCurrent();
|
11871
|
-
* platform.closeWindow(fin.me.identity, { skipBeforeUnload: true });
|
11872
|
-
* ```
|
11873
|
-
* @experimental
|
11510
|
+
* @internal
|
11511
|
+
* @ignore
|
11874
11512
|
*/
|
11875
|
-
|
11876
|
-
|
11877
|
-
|
11878
|
-
|
11879
|
-
|
11880
|
-
|
11513
|
+
constructor(client, entityId) {
|
11514
|
+
/**
|
11515
|
+
* @ignore
|
11516
|
+
* @internal
|
11517
|
+
* ApiClient for {@link LayoutEntitiesController}
|
11518
|
+
*/
|
11519
|
+
_LayoutNode_client.set(this, void 0);
|
11520
|
+
/**
|
11521
|
+
* Checks if the TabStack or ColumnOrRow is the root content item
|
11522
|
+
*
|
11523
|
+
* @example
|
11524
|
+
* ```js
|
11525
|
+
* if (!fin.me.isView) {
|
11526
|
+
* throw new Error('Not running in a platform View.');
|
11527
|
+
* }
|
11528
|
+
*
|
11529
|
+
* const stack = await fin.me.getCurrentStack();
|
11530
|
+
* const isRoot = await stack.isRoot();
|
11531
|
+
* // The TabStack is root: false
|
11532
|
+
* console.log(`The TabStack is root: ${isRoot}`);
|
11533
|
+
*
|
11534
|
+
* // Retrieves the parent ColumnOrRow
|
11535
|
+
* const parent = await stack.getParent();
|
11536
|
+
* const parentIsRoot = await parent.isRoot();
|
11537
|
+
* // The parent ColumnOrRow is root: true
|
11538
|
+
* console.log(`The parent ColumnOrRow is root: ${parentIsRoot}`);
|
11539
|
+
* ```
|
11540
|
+
*/
|
11541
|
+
this.isRoot = () => __classPrivateFieldGet$5(this, _LayoutNode_client, "f").isRoot(this.entityId);
|
11542
|
+
/**
|
11543
|
+
* Checks if the TabStack or ColumnOrRow exists
|
11544
|
+
*
|
11545
|
+
* @example
|
11546
|
+
* ```js
|
11547
|
+
* if (!fin.me.isView) {
|
11548
|
+
* throw new Error('Not running in a platform View.');
|
11549
|
+
* }
|
11550
|
+
*
|
11551
|
+
* const stack = await fin.me.getCurrentStack();
|
11552
|
+
* // Retrieves the parent ColumnOrRow
|
11553
|
+
* const columnOrRow = await stack.getParent();
|
11554
|
+
* let exists = await stack.exists();
|
11555
|
+
* // or
|
11556
|
+
* let exists = await columnOrRow.exists();
|
11557
|
+
* // The entity exists: true
|
11558
|
+
* console.log(`The entity exists: ${exists}`);
|
11559
|
+
* ```
|
11560
|
+
*/
|
11561
|
+
this.exists = () => __classPrivateFieldGet$5(this, _LayoutNode_client, "f").exists(this.entityId);
|
11562
|
+
/**
|
11563
|
+
* Retrieves the parent of the TabStack or ColumnOrRow
|
11564
|
+
*
|
11565
|
+
* @example
|
11566
|
+
* ```js
|
11567
|
+
* if (!fin.me.isView) {
|
11568
|
+
* throw new Error('Not running in a platform View.');
|
11569
|
+
* }
|
11570
|
+
*
|
11571
|
+
* const stack = await fin.me.getCurrentStack();
|
11572
|
+
* // Retrieves the parent ColumnOrRow
|
11573
|
+
* const columnOrRow = await stack.getParent();
|
11574
|
+
*
|
11575
|
+
* // undefined if entity is the root item
|
11576
|
+
* let parent = await columnOrRow.getParent();
|
11577
|
+
* // or
|
11578
|
+
* let parent = await stack.getParent();
|
11579
|
+
* ```
|
11580
|
+
*/
|
11581
|
+
this.getParent = async () => {
|
11582
|
+
const parent = await __classPrivateFieldGet$5(this, _LayoutNode_client, "f").getParent(this.entityId);
|
11583
|
+
if (!parent) {
|
11584
|
+
return undefined;
|
11585
|
+
}
|
11586
|
+
return LayoutNode.getEntity(parent, __classPrivateFieldGet$5(this, _LayoutNode_client, "f"));
|
11587
|
+
};
|
11588
|
+
/**
|
11589
|
+
* Creates a new TabStack adjacent to the given TabStack or ColumnOrRow. Inputs can be new views to create, or existing views.
|
11590
|
+
*
|
11591
|
+
* Known Issue: If the number of views to add overflows the tab-container, the added views will be set as active
|
11592
|
+
* during each render, and then placed at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
11593
|
+
* This means the views you pass to createAdjacentStack() may not render in the order given by the array.
|
11594
|
+
* Until fixed, this problem can be avoided only if your window is wide enough to fit creating all the views in the tabstack.
|
11595
|
+
*
|
11596
|
+
* @param views The views that will populate the new TabStack.
|
11597
|
+
* @param options Additional options that control new TabStack creation.
|
11598
|
+
* @returns The newly-created TabStack.
|
11599
|
+
*
|
11600
|
+
* @example
|
11601
|
+
* ```js
|
11602
|
+
* if (!fin.me.isView) {
|
11603
|
+
* throw new Error('Not running in a platform View.');
|
11604
|
+
* }
|
11605
|
+
*
|
11606
|
+
* const stack = await fin.me.getCurrentStack();
|
11607
|
+
* const columnOrRow = await stack.getParent();
|
11608
|
+
*
|
11609
|
+
* // Create view references by supplying a 'name' and 'url'
|
11610
|
+
* const views = [
|
11611
|
+
* // if 'name' is undefined, one will be generated
|
11612
|
+
* // if 'url' is undefined, it will default the view URL to 'about:blank'
|
11613
|
+
* { name: 'google-view', url: 'http://google.com/'},
|
11614
|
+
* { name: 'of-developers-view', url: 'http://developers.openfin.co/'},
|
11615
|
+
* ];
|
11616
|
+
*
|
11617
|
+
* // Create a view beforehand to be included in the new tab stack
|
11618
|
+
* const outsideView = await fin.View.create({
|
11619
|
+
* name: 'outside-bloomberg-view',
|
11620
|
+
* url: 'https://bloomberg.com/',
|
11621
|
+
* target: fin.me.identity,
|
11622
|
+
* });
|
11623
|
+
*
|
11624
|
+
* // Views to add can be identities, or the reference views mentioned above
|
11625
|
+
* const viewsToAdd = [outsideView.identity, ...views];
|
11626
|
+
*
|
11627
|
+
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
11628
|
+
* let stackFrom = await columnOrRow.createAdjacentStack(viewsToAdd, { position: 'right' });
|
11629
|
+
* // Or
|
11630
|
+
* let newStack = await stack.createAdjacentStack(viewsToAdd, { position: 'right' });
|
11631
|
+
* console.log(`A new TabStack created to the right has ${newStack.length} views in it`);
|
11632
|
+
*
|
11633
|
+
* ```
|
11634
|
+
* @experimental
|
11635
|
+
*/
|
11636
|
+
this.createAdjacentStack = async (views, options) => {
|
11637
|
+
const entityId = await __classPrivateFieldGet$5(this, _LayoutNode_client, "f").createAdjacentStack(this.entityId, views, options);
|
11638
|
+
return LayoutNode.getEntity({ entityId, type: 'stack' }, __classPrivateFieldGet$5(this, _LayoutNode_client, "f"));
|
11639
|
+
};
|
11640
|
+
/**
|
11641
|
+
* Retrieves the adjacent TabStacks of the given TabStack or ColumnOrRow.
|
11642
|
+
*
|
11643
|
+
* @param edge Edge whose adjacent TabStacks will be returned.
|
11644
|
+
*
|
11645
|
+
* @example
|
11646
|
+
* ```js
|
11647
|
+
* if (!fin.me.isView) {
|
11648
|
+
* throw new Error('Not running in a platform View.');
|
11649
|
+
* }
|
11650
|
+
*
|
11651
|
+
* const stack = await fin.me.getCurrentStack();
|
11652
|
+
* const columnOrRow = await stack.getParent();
|
11653
|
+
* // Possible position inputs: 'right' | 'left' | 'top' | 'bottom'
|
11654
|
+
* let rightStacks = await columnOrRow.getAdjacentStacks('right');
|
11655
|
+
* let leftStacks = await columnOrRow.getAdjacentStacks('left');
|
11656
|
+
* // or
|
11657
|
+
* let rightStacks = await stack.getAdjacentStacks('right');
|
11658
|
+
* let leftStacks = await stack.getAdjacentStacks('left');
|
11659
|
+
*
|
11660
|
+
* console.log(`The entity has ${rightStacks.length} stacks to the right, and ${leftStacks.length} stacks to the left`);
|
11661
|
+
*
|
11662
|
+
* ```
|
11663
|
+
* @experimental
|
11664
|
+
*/
|
11665
|
+
this.getAdjacentStacks = async (edge) => {
|
11666
|
+
const adjacentStacks = await __classPrivateFieldGet$5(this, _LayoutNode_client, "f").getAdjacentStacks({
|
11667
|
+
targetId: this.entityId,
|
11668
|
+
edge
|
11669
|
+
});
|
11670
|
+
return adjacentStacks.map((stack) => LayoutNode.getEntity({
|
11671
|
+
type: 'stack',
|
11672
|
+
entityId: stack.entityId
|
11673
|
+
}, __classPrivateFieldGet$5(this, _LayoutNode_client, "f")));
|
11674
|
+
};
|
11675
|
+
__classPrivateFieldSet$4(this, _LayoutNode_client, client, "f");
|
11676
|
+
this.entityId = entityId;
|
11881
11677
|
}
|
11882
11678
|
}
|
11883
|
-
|
11884
|
-
|
11679
|
+
layoutEntities.LayoutNode = LayoutNode;
|
11680
|
+
_LayoutNode_client = new WeakMap();
|
11885
11681
|
/**
|
11682
|
+
* @ignore
|
11886
11683
|
* @internal
|
11887
|
-
*
|
11888
|
-
*
|
11684
|
+
* Encapsulates Api consumption of {@link LayoutEntitiesClient} with a relayed dispatch
|
11685
|
+
* @param client
|
11686
|
+
* @param controllerId
|
11687
|
+
* @param identity
|
11688
|
+
* @returns a new instance of {@link LayoutEntitiesClient} with bound to the controllerId
|
11889
11689
|
*/
|
11890
|
-
|
11891
|
-
|
11892
|
-
|
11893
|
-
|
11894
|
-
|
11895
|
-
|
11896
|
-
|
11897
|
-
|
11898
|
-
var commonUtils = {};
|
11899
|
-
|
11900
|
-
Object.defineProperty(commonUtils, "__esModule", { value: true });
|
11901
|
-
commonUtils.overrideFromComposables = commonUtils.isValidPresetType = void 0;
|
11902
|
-
function isValidPresetType(type) {
|
11690
|
+
LayoutNode.newLayoutEntitiesClient = async (client, controllerId, identity) => {
|
11691
|
+
const dispatch = (0, channel_api_relay_1.createRelayedDispatch)(client, identity, 'layout-relay', 'You are trying to interact with a layout component on a window that does not exist or has been destroyed.');
|
11692
|
+
const consumer = new api_exposer_1.ApiConsumer(new api_exposer_1.ChannelsConsumer({ dispatch }));
|
11693
|
+
return consumer.consume({ id: controllerId });
|
11694
|
+
};
|
11695
|
+
LayoutNode.getEntity = (definition, client) => {
|
11696
|
+
const { entityId, type } = definition;
|
11903
11697
|
switch (type) {
|
11904
|
-
case '
|
11905
|
-
case '
|
11906
|
-
|
11907
|
-
case '
|
11908
|
-
return
|
11698
|
+
case 'column':
|
11699
|
+
case 'row':
|
11700
|
+
return new ColumnOrRow(client, entityId, type);
|
11701
|
+
case 'stack':
|
11702
|
+
return new TabStack(client, entityId);
|
11909
11703
|
default:
|
11910
|
-
|
11704
|
+
throw new Error(`Unrecognised Layout Entity encountered ('${JSON.stringify(definition)})`);
|
11705
|
+
}
|
11706
|
+
};
|
11707
|
+
/**
|
11708
|
+
* A TabStack is used to manage the state of a stack of tabs within an OpenFin Layout.
|
11709
|
+
*/
|
11710
|
+
class TabStack extends LayoutNode {
|
11711
|
+
/** @internal */
|
11712
|
+
constructor(client, entityId) {
|
11713
|
+
super(client, entityId);
|
11714
|
+
/**
|
11715
|
+
* @internal
|
11716
|
+
* ApiClient for {@link LayoutEntitiesController}
|
11717
|
+
*/
|
11718
|
+
_TabStack_client.set(this, void 0);
|
11719
|
+
/**
|
11720
|
+
* Type of the content item. Always stack, but useful for distinguishing between a {@link TabStack} and {@link ColumnOrRow}.
|
11721
|
+
*/
|
11722
|
+
this.type = 'stack';
|
11723
|
+
/**
|
11724
|
+
* Retrieves a list of all views belonging to this {@link TabStack}.
|
11725
|
+
*
|
11726
|
+
* Known Issue: If adding a view overflows the tab-container width, the added view will be set as active
|
11727
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
11728
|
+
* If that happens and then getViews() is called, it will return the identities in a different order than
|
11729
|
+
* than the currently rendered tab order.
|
11730
|
+
*
|
11731
|
+
*
|
11732
|
+
* @throws If the {@link TabStack} has been destroyed.
|
11733
|
+
* @example
|
11734
|
+
* ```js
|
11735
|
+
* if (!fin.me.isView) {
|
11736
|
+
* throw new Error('Not running in a platform View.');
|
11737
|
+
* }
|
11738
|
+
*
|
11739
|
+
* const stack = await fin.me.getCurrentStack();
|
11740
|
+
* // Alternatively, you can wrap any view and get the stack from there
|
11741
|
+
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
11742
|
+
* // const stack = await viewFromSomewhere.getCurrentStack();
|
11743
|
+
* const views = await stack.getViews();
|
11744
|
+
* console.log(`Stack contains ${views.length} view(s)`);
|
11745
|
+
* ```
|
11746
|
+
* @experimental
|
11747
|
+
*/
|
11748
|
+
this.getViews = () => __classPrivateFieldGet$5(this, _TabStack_client, "f").getStackViews(this.entityId);
|
11749
|
+
/**
|
11750
|
+
* Adds or creates a view in this {@link TabStack}.
|
11751
|
+
*
|
11752
|
+
* @remarks Known Issue: If adding a view overflows the tab-container, the added view will be set as active
|
11753
|
+
* and rendered at the front of the tab-stack, while the underlying order of tabs will remain unchanged.
|
11754
|
+
*
|
11755
|
+
* @param view The identity of an existing view to add, or options to create a view.
|
11756
|
+
* @param options Optional view options: index number used to insert the view into the stack at that index. Defaults to 0 (front of the stack)
|
11757
|
+
* @returns Resolves with the {@link OpenFin.Identity identity} of the added view.
|
11758
|
+
* @throws If the view does not exist or fails to create.
|
11759
|
+
* @throws If the {@link TabStack} has been destroyed.
|
11760
|
+
* @example
|
11761
|
+
* ```js
|
11762
|
+
* if (!fin.me.isView) {
|
11763
|
+
* throw new Error('Not running in a platform View.');
|
11764
|
+
* }
|
11765
|
+
*
|
11766
|
+
* const stack = await fin.me.getCurrentStack();
|
11767
|
+
* // Alternatively, you can wrap any view and get the stack from there
|
11768
|
+
* // const viewFromSomewhere = fin.View.wrapSync(someView.identity);
|
11769
|
+
* // const stack = await viewFromSomewhere.getCurrentStack();
|
11770
|
+
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
11771
|
+
* console.log('Identity of the google view just added', { googleViewIdentity });
|
11772
|
+
* // pass in { index: number } to set the index in the stack. Here 1 means, end of the stack (defaults to 0)
|
11773
|
+
* const appleViewIdentity = await stack.addView({ name: 'apple-view', url: 'http://apple.com/' }, { index: 1 });
|
11774
|
+
* console.log('Identity of the apple view just added', { appleViewIdentity });
|
11775
|
+
* ```
|
11776
|
+
* @experimental
|
11777
|
+
*/
|
11778
|
+
this.addView = async (view, options = { index: 0 }) => __classPrivateFieldGet$5(this, _TabStack_client, "f").addViewToStack(this.entityId, view, options);
|
11779
|
+
/**
|
11780
|
+
* Removes a view from this {@link TabStack}.
|
11781
|
+
*
|
11782
|
+
* @remarks Throws an exception if the view identity does not exist or was already destroyed.
|
11783
|
+
*
|
11784
|
+
* @param view - Identity of the view to remove.
|
11785
|
+
* @throws If the view does not exist or does not belong to the stack.
|
11786
|
+
* @throws If the {@link TabStack} has been destroyed.
|
11787
|
+
*
|
11788
|
+
* @example
|
11789
|
+
* ```js
|
11790
|
+
* if (!fin.me.isView) {
|
11791
|
+
* throw new Error('Not running in a platform View.');
|
11792
|
+
* }
|
11793
|
+
*
|
11794
|
+
* const stack = await fin.me.getCurrentStack();
|
11795
|
+
* const googleViewIdentity = await stack.addView({ name: 'google-view', url: 'http://google.com/' });
|
11796
|
+
*
|
11797
|
+
* await stack.removeView(googleViewIdentity);
|
11798
|
+
*
|
11799
|
+
* try {
|
11800
|
+
* await stack.removeView(googleViewIdentity);
|
11801
|
+
* } catch (error) {
|
11802
|
+
* // Tried to remove a view ('google-view') which does not belong to the stack.
|
11803
|
+
* console.log(error);
|
11804
|
+
* }
|
11805
|
+
* ```
|
11806
|
+
*/
|
11807
|
+
this.removeView = async (view) => {
|
11808
|
+
await __classPrivateFieldGet$5(this, _TabStack_client, "f").removeViewFromStack(this.entityId, view);
|
11809
|
+
};
|
11810
|
+
/**
|
11811
|
+
* Sets the active view of the {@link TabStack} without focusing it.
|
11812
|
+
* @param view - Identity of the view to activate.
|
11813
|
+
* @returns Promise which resolves with void once the view has been activated.
|
11814
|
+
* @throws If the {@link TabStack} has been destroyed.
|
11815
|
+
* @throws If the view does not exist.
|
11816
|
+
* @example
|
11817
|
+
* Change the active tab of a known View's TabStack:
|
11818
|
+
* ```js
|
11819
|
+
* const targetView = fin.View.wrapSync({ uuid: 'uuid', name: 'view-name' });
|
11820
|
+
* const stack = await targetView.getCurrentStack();
|
11821
|
+
* await stack.setActiveView(targetView.identity);
|
11822
|
+
* ```
|
11823
|
+
*
|
11824
|
+
* Set the current View as active within its TabStack:
|
11825
|
+
* ```js
|
11826
|
+
* const stack = await fin.me.getCurrentStack();
|
11827
|
+
* await stack.setActiveView(fin.me.identity);
|
11828
|
+
* ```
|
11829
|
+
* @experimental
|
11830
|
+
*/
|
11831
|
+
this.setActiveView = async (view) => {
|
11832
|
+
await __classPrivateFieldGet$5(this, _TabStack_client, "f").setStackActiveView(this.entityId, view);
|
11833
|
+
};
|
11834
|
+
__classPrivateFieldSet$4(this, _TabStack_client, client, "f");
|
11911
11835
|
}
|
11912
11836
|
}
|
11913
|
-
|
11914
|
-
|
11915
|
-
|
11837
|
+
layoutEntities.TabStack = TabStack;
|
11838
|
+
_TabStack_client = new WeakMap();
|
11839
|
+
/**
|
11840
|
+
* A ColumnOrRow is used to manage the state of Column and Rows within an OpenFin Layout.
|
11841
|
+
*/
|
11842
|
+
class ColumnOrRow extends LayoutNode {
|
11843
|
+
/**
|
11844
|
+
* @internal
|
11845
|
+
*/
|
11846
|
+
constructor(client, entityId, type) {
|
11847
|
+
super(client, entityId);
|
11848
|
+
/**
|
11849
|
+
* @ignore
|
11850
|
+
* @internal
|
11851
|
+
* ApiClient for {@link LayoutEntitiesController}
|
11852
|
+
*/
|
11853
|
+
_ColumnOrRow_client.set(this, void 0);
|
11854
|
+
/**
|
11855
|
+
* Retrieves the content array of the ColumnOrRow
|
11856
|
+
*
|
11857
|
+
* @example
|
11858
|
+
* ```js
|
11859
|
+
* if (!fin.me.isView) {
|
11860
|
+
* throw new Error('Not running in a platform View.');
|
11861
|
+
* }
|
11862
|
+
*
|
11863
|
+
* const stack = await fin.me.getCurrentStack();
|
11864
|
+
* // Retrieves the parent ColumnOrRow
|
11865
|
+
* const columnOrRow = await stack.getParent();
|
11866
|
+
*
|
11867
|
+
* // returns [TabStack]
|
11868
|
+
* const contentArray = await columnOrRow.getContent();
|
11869
|
+
* console.log(`The ColumnOrRow has ${contentArray.length} item(s)`);
|
11870
|
+
* ```
|
11871
|
+
*/
|
11872
|
+
this.getContent = async () => {
|
11873
|
+
const contentItemEntities = await __classPrivateFieldGet$5(this, _ColumnOrRow_client, "f").getContent(this.entityId);
|
11874
|
+
return contentItemEntities.map((entity) => LayoutNode.getEntity(entity, __classPrivateFieldGet$5(this, _ColumnOrRow_client, "f")));
|
11875
|
+
};
|
11876
|
+
__classPrivateFieldSet$4(this, _ColumnOrRow_client, client, "f");
|
11877
|
+
this.type = type;
|
11878
|
+
}
|
11916
11879
|
}
|
11917
|
-
|
11918
|
-
|
11880
|
+
layoutEntities.ColumnOrRow = ColumnOrRow;
|
11881
|
+
_ColumnOrRow_client = new WeakMap();
|
11882
|
+
|
11883
|
+
var layout_constants = {};
|
11884
|
+
|
11885
|
+
Object.defineProperty(layout_constants, "__esModule", { value: true });
|
11886
|
+
layout_constants.DEFAULT_LAYOUT_KEY = layout_constants.LAYOUT_CONTROLLER_ID = void 0;
|
11887
|
+
layout_constants.LAYOUT_CONTROLLER_ID = 'layout-entities';
|
11888
|
+
// TODO: eventually export this somehow
|
11889
|
+
layout_constants.DEFAULT_LAYOUT_KEY = '__default__';
|
11919
11890
|
|
11920
11891
|
var __classPrivateFieldGet$4 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
11921
11892
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
@@ -12064,6 +12035,12 @@ const layout_constants_1$1 = layout_constants;
|
|
12064
12035
|
* ```
|
12065
12036
|
*/
|
12066
12037
|
class Layout extends base_1$5.Base {
|
12038
|
+
/**
|
12039
|
+
* @internal
|
12040
|
+
*/
|
12041
|
+
static getClient(layout) {
|
12042
|
+
return __classPrivateFieldGet$4(layout, _Layout_layoutClient, "f").getValue();
|
12043
|
+
}
|
12067
12044
|
/**
|
12068
12045
|
* @internal
|
12069
12046
|
*/
|
@@ -12288,6 +12265,16 @@ class Layout extends base_1$5.Base {
|
|
12288
12265
|
const root = await client.getRoot('layoutName' in this.identity ? this.identity : undefined);
|
12289
12266
|
return layout_entities_1.LayoutNode.getEntity(root, client);
|
12290
12267
|
}
|
12268
|
+
/**
|
12269
|
+
* Retrieves the OpenFin.TabStack instance which the View belongs to.
|
12270
|
+
*
|
12271
|
+
* @example
|
12272
|
+
* ```js
|
12273
|
+
* const viewIdentity = { uuid: 'uuid', name: 'view-name' };
|
12274
|
+
* const stack = await fin.View.wrapSync(viewIdentity).getStackByViewIdentity(viewIdentity);
|
12275
|
+
* console.log(await stack.getViews());
|
12276
|
+
* ```
|
12277
|
+
*/
|
12291
12278
|
async getStackByViewIdentity(identity) {
|
12292
12279
|
this.wire.sendAction('layout-get-stack-by-view').catch(() => {
|
12293
12280
|
// don't expose
|
@@ -12521,6 +12508,44 @@ class LayoutModule extends base_1$4.Base {
|
|
12521
12508
|
const { uuid, name } = this.fin.me;
|
12522
12509
|
return this.wrapSync({ uuid, name });
|
12523
12510
|
}
|
12511
|
+
/**
|
12512
|
+
* Retrieves the OpenFin.Layout instance for the Window the View is attached to.
|
12513
|
+
*
|
12514
|
+
* @example
|
12515
|
+
* ```js
|
12516
|
+
* const viewIdentity = { uuid: 'uuid', name: 'view-name' };
|
12517
|
+
* const layout = await fin.Platform.Layout.getLayoutByViewIdentity(viewIdentity);
|
12518
|
+
* console.log(await layout.getCurrentViews());
|
12519
|
+
* ```
|
12520
|
+
*/
|
12521
|
+
async getLayoutByViewIdentity(viewIdentity) {
|
12522
|
+
this.wire.sendAction('layout-get-by-view-identity').catch(() => {
|
12523
|
+
// don't expose
|
12524
|
+
});
|
12525
|
+
const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
|
12526
|
+
let layoutWindowIdentity = winIdentity;
|
12527
|
+
// TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
|
12528
|
+
if (layoutWindowIdentity.identity) {
|
12529
|
+
layoutWindowIdentity = layoutWindowIdentity.identity;
|
12530
|
+
}
|
12531
|
+
try {
|
12532
|
+
const layoutWindow = this.wrapSync(layoutWindowIdentity);
|
12533
|
+
const client = await Instance_1$2.Layout.getClient(layoutWindow);
|
12534
|
+
const layoutIdentity = await client.getLayoutIdentityForViewOrThrow(viewIdentity);
|
12535
|
+
return this.wrapSync(layoutIdentity);
|
12536
|
+
}
|
12537
|
+
catch (e) {
|
12538
|
+
const allowedErrors = [
|
12539
|
+
'No action registered at target for',
|
12540
|
+
'getLayoutIdentityForViewOrThrow is not a function'
|
12541
|
+
];
|
12542
|
+
if (!allowedErrors.some((m) => e.message.includes(m))) {
|
12543
|
+
throw e;
|
12544
|
+
}
|
12545
|
+
// fallback logic for missing endpoint in older runtimes
|
12546
|
+
return this.wrapSync(layoutWindowIdentity);
|
12547
|
+
}
|
12548
|
+
}
|
12524
12549
|
}
|
12525
12550
|
Factory$2.LayoutModule = LayoutModule;
|
12526
12551
|
_LayoutModule_layoutInitializationAttempted = new WeakMap(), _LayoutModule_layoutManager = new WeakMap(), _LayoutModule_getLayoutManagerSpy = new WeakMap(), _LayoutModule_instances = new WeakSet(), _LayoutModule_getSafeLayoutManager = function _LayoutModule_getSafeLayoutManager(method) {
|
@@ -17558,6 +17583,9 @@ class MockEnvironment {
|
|
17558
17583
|
async getInteropInfo() {
|
17559
17584
|
throw new Error(me_1.environmentUnsupportedMessage);
|
17560
17585
|
}
|
17586
|
+
async getViewWindowIdentity() {
|
17587
|
+
throw new Error(me_1.environmentUnsupportedMessage);
|
17588
|
+
}
|
17561
17589
|
getDefaultChannelOptions() {
|
17562
17590
|
throw new Error(me_1.environmentUnsupportedMessage);
|
17563
17591
|
}
|