@ibm-aspera/sdk 0.21.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/app/core.js +16 -3
- package/dist/commonjs/http-gateway/core.js +29 -1
- package/dist/commonjs/models/aspera-sdk.model.d.ts +4 -0
- package/dist/commonjs/models/aspera-sdk.model.js +1 -0
- package/dist/js/aspera-sdk.js +1 -1
- package/dist/js/aspera-sdk.js.LICENSE.txt +1 -1
- package/dist/js/aspera-sdk.js.map +1 -1
- package/package.json +1 -1
|
@@ -1274,15 +1274,28 @@ exports.removeDropzone = removeDropzone;
|
|
|
1274
1274
|
* @returns a promise that returns information about the user's IBM Aspera installation.
|
|
1275
1275
|
*/
|
|
1276
1276
|
var getInfo = function () {
|
|
1277
|
+
// Fetch the Connect application version on demand the first time it's requested.
|
|
1278
|
+
// Cached on `asperaSdk.globals.connectVersion` so subsequent calls return immediately.
|
|
1279
|
+
if (index_1.asperaSdk.useConnect && !index_1.asperaSdk.globals.connectVersion) {
|
|
1280
|
+
var promiseInfo_1 = (0, helpers_1.generatePromiseObjects)();
|
|
1281
|
+
index_1.asperaSdk.globals.connect.version()
|
|
1282
|
+
.then(function (info) {
|
|
1283
|
+
index_1.asperaSdk.globals.connectVersion = info === null || info === void 0 ? void 0 : info.version;
|
|
1284
|
+
promiseInfo_1.resolver(index_1.asperaSdk.globals.sdkResponseData);
|
|
1285
|
+
})
|
|
1286
|
+
.catch(function () {
|
|
1287
|
+
// Best-effort — leave connectVersion undefined if Connect's version() rejects.
|
|
1288
|
+
promiseInfo_1.resolver(index_1.asperaSdk.globals.sdkResponseData);
|
|
1289
|
+
});
|
|
1290
|
+
return promiseInfo_1.promise;
|
|
1291
|
+
}
|
|
1277
1292
|
if (index_1.asperaSdk.useHttpGateway || index_1.asperaSdk.useConnect) {
|
|
1278
1293
|
return Promise.resolve(index_1.asperaSdk.globals.sdkResponseData);
|
|
1279
1294
|
}
|
|
1280
1295
|
if (!index_1.asperaSdk.isReady) {
|
|
1281
1296
|
return (0, helpers_1.throwError)(messages_1.messages.serverNotVerified);
|
|
1282
1297
|
}
|
|
1283
|
-
return
|
|
1284
|
-
resolve(index_1.asperaSdk.globals.sdkResponseData);
|
|
1285
|
-
});
|
|
1298
|
+
return Promise.resolve(index_1.asperaSdk.globals.sdkResponseData);
|
|
1286
1299
|
};
|
|
1287
1300
|
exports.getInfo = getInfo;
|
|
1288
1301
|
/**
|
|
@@ -283,6 +283,33 @@ var httpGatewaySelectFileFolderDialog = function (options, folder) {
|
|
|
283
283
|
return promise;
|
|
284
284
|
};
|
|
285
285
|
exports.httpGatewaySelectFileFolderDialog = httpGatewaySelectFileFolderDialog;
|
|
286
|
+
/**
|
|
287
|
+
* Generate a human-readable title for an HTTP Gateway transfer. The desktop and Connect
|
|
288
|
+
* transfer clients populate `title` themselves; HTTP Gateway transfers are constructed
|
|
289
|
+
* client-side and need a synthesized title for consumer UIs.
|
|
290
|
+
*
|
|
291
|
+
* If the caller already supplied a `title` on the spec, that wins. Otherwise we use the
|
|
292
|
+
* basename of the first source path, suffixed with `(+N)` when there are additional paths.
|
|
293
|
+
*/
|
|
294
|
+
var getTitle = function (transferSpec) {
|
|
295
|
+
var _a, _b;
|
|
296
|
+
if (transferSpec.title) {
|
|
297
|
+
return transferSpec.title;
|
|
298
|
+
}
|
|
299
|
+
var paths = transferSpec.paths;
|
|
300
|
+
if (!paths || paths.length === 0) {
|
|
301
|
+
return '';
|
|
302
|
+
}
|
|
303
|
+
var path = (_a = paths[0]) === null || _a === void 0 ? void 0 : _a.source;
|
|
304
|
+
if (!path) {
|
|
305
|
+
return '';
|
|
306
|
+
}
|
|
307
|
+
var first = (_b = path.split('/').filter(Boolean).pop()) !== null && _b !== void 0 ? _b : '';
|
|
308
|
+
if (paths.length === 1) {
|
|
309
|
+
return first;
|
|
310
|
+
}
|
|
311
|
+
return "".concat(first, " (+").concat(paths.length - 1, ")");
|
|
312
|
+
};
|
|
286
313
|
/**
|
|
287
314
|
* Get a generic transfer object for HTTP Gateway transfers.
|
|
288
315
|
*
|
|
@@ -291,6 +318,7 @@ exports.httpGatewaySelectFileFolderDialog = httpGatewaySelectFileFolderDialog;
|
|
|
291
318
|
* @returns a transfer object to track status and send to consumers
|
|
292
319
|
*/
|
|
293
320
|
var getSdkTransfer = function (transferSpec) {
|
|
321
|
+
var title = getTitle(transferSpec);
|
|
294
322
|
return {
|
|
295
323
|
uuid: (0, helpers_1.randomUUID)(),
|
|
296
324
|
transfer_spec: transferSpec,
|
|
@@ -311,7 +339,7 @@ var getSdkTransfer = function (transferSpec) {
|
|
|
311
339
|
calculated_rate_kbps: 0,
|
|
312
340
|
elapsed_usec: 0,
|
|
313
341
|
percentage: 0,
|
|
314
|
-
title:
|
|
342
|
+
title: title,
|
|
315
343
|
remaining_usec: 0,
|
|
316
344
|
transfer_client: 'http-gateway',
|
|
317
345
|
httpGatewayTransfer: true,
|
|
@@ -47,6 +47,8 @@ export declare class AsperaSdkGlobals {
|
|
|
47
47
|
connectInstaller?: ConnectTypes.ConnectInstallerClientType;
|
|
48
48
|
/** Connect status */
|
|
49
49
|
connectStatus: ConnectTypes.ConnectStatusStrings;
|
|
50
|
+
/** Connect application version, populated when Connect transitions to RUNNING. */
|
|
51
|
+
connectVersion?: string;
|
|
50
52
|
backupLaunchMethod(url: string): void;
|
|
51
53
|
/**
|
|
52
54
|
* Launch the IBM Aspera App via protocol url. By default, a hidden IFRAME attempts to
|
|
@@ -71,6 +73,8 @@ export type AsperaSdkInfo = AsperaSdkClientInfo & {
|
|
|
71
73
|
connect: {
|
|
72
74
|
active: boolean;
|
|
73
75
|
status: ConnectTypes.ConnectStatusStrings;
|
|
76
|
+
/** Connect application version, available once Connect has reached the RUNNING status. */
|
|
77
|
+
version?: string;
|
|
74
78
|
};
|
|
75
79
|
};
|
|
76
80
|
export interface TransferResponse {
|