@ibm-aspera/sdk 0.20.1 → 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 +24 -5
- 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 +16 -1
- package/dist/commonjs/models/models.d.ts +50 -21
- 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
|
/**
|
|
@@ -1440,11 +1453,11 @@ var supportsMethod = function (method) {
|
|
|
1440
1453
|
// We currently do not support calculating file checksums when using HTTP Gateway. In theory it should be possible
|
|
1441
1454
|
// to calculate this directly in the browser similar to how `readAsArrayBuffer()` is implemented.
|
|
1442
1455
|
// HTTP Gateway also does not support showing native transfer client UI (about, preferences, etc.).
|
|
1443
|
-
if (index_1.asperaSdk.useHttpGateway && (method === 'get_checksum' || method === 'show_about' || method === 'open_preferences' || method === 'show_transfer_manager' || method === 'show_transfer_monitor' || method === 'authenticate' || method === 'test_ssh_ports' || method === 'show_save_file_dialog' || method === 'read_directory')) {
|
|
1456
|
+
if (index_1.asperaSdk.useHttpGateway && (method === 'get_checksum' || method === 'show_about' || method === 'open_preferences' || method === 'show_transfer_manager' || method === 'show_transfer_monitor' || method === 'authenticate' || method === 'test_ssh_ports' || method === 'show_save_file_dialog' || method === 'read_directory' || method === 'get_files_list' || method === 'update_branding' || method === 'show_directory' || method === 'modify_transfer' || method === 'resume_transfer')) {
|
|
1444
1457
|
return false;
|
|
1445
1458
|
}
|
|
1446
1459
|
// Reading directory contents is only supported by the Desktop App (not Connect).
|
|
1447
|
-
if (index_1.asperaSdk.useConnect && method === 'read_directory') {
|
|
1460
|
+
if (index_1.asperaSdk.useConnect && (method === 'read_directory' || method === 'get_files_list' || method === 'update_branding')) {
|
|
1448
1461
|
return false;
|
|
1449
1462
|
}
|
|
1450
1463
|
// HTTP Gateway and Connect do not have any RPC methods so fallback to true
|
|
@@ -1486,6 +1499,12 @@ var getCapabilities = function () {
|
|
|
1486
1499
|
testSshPorts: supportsMethod('test_ssh_ports'),
|
|
1487
1500
|
showSaveFileDialog: supportsMethod('show_save_file_dialog'),
|
|
1488
1501
|
readDirectory: supportsMethod('read_directory'),
|
|
1502
|
+
getFilesList: supportsMethod('get_files_list'),
|
|
1503
|
+
setBranding: supportsMethod('update_branding'),
|
|
1504
|
+
showDirectory: supportsMethod('show_directory'),
|
|
1505
|
+
folderUpload: !index_1.asperaSdk.useOldHttpGateway,
|
|
1506
|
+
modifyTransfer: supportsMethod('modify_transfer'),
|
|
1507
|
+
resumeTransfer: supportsMethod('resume_transfer'),
|
|
1489
1508
|
};
|
|
1490
1509
|
};
|
|
1491
1510
|
exports.getCapabilities = getCapabilities;
|
|
@@ -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 {
|
|
@@ -77,6 +77,7 @@ var AsperaSdkGlobals = /** @class */ (function () {
|
|
|
77
77
|
}, connect: {
|
|
78
78
|
active: this.connectStatus === 'RUNNING',
|
|
79
79
|
status: this.connectStatus,
|
|
80
|
+
version: this.connectVersion,
|
|
80
81
|
} });
|
|
81
82
|
},
|
|
82
83
|
enumerable: false,
|
|
@@ -124,10 +125,24 @@ var ActivityTracking = /** @class */ (function () {
|
|
|
124
125
|
* @param webSocketEvent the event type.
|
|
125
126
|
*/
|
|
126
127
|
ActivityTracking.prototype.handleWebSocketEvents = function (webSocketEvent) {
|
|
128
|
+
var current_status = status_1.statusService.getStatus();
|
|
127
129
|
if (webSocketEvent === 'CLOSED') {
|
|
128
130
|
status_1.statusService.setStatus('DISCONNECTED');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (webSocketEvent !== 'RECONNECT') {
|
|
134
|
+
return;
|
|
129
135
|
}
|
|
130
|
-
|
|
136
|
+
// Only treat RECONNECT as a transition to RUNNING when we have prior verification of
|
|
137
|
+
// IBM Aspera for desktop. For example, if IBM Aspera for desktop was RUNNING and verified,
|
|
138
|
+
// and then the user quits and restarts the application.
|
|
139
|
+
//
|
|
140
|
+
// TODO: This potentially leads to a data race if the application was quit/restarted because it was being
|
|
141
|
+
// upgraded. The new application may have newer RPC methods, but transitioning to RUNNING here could
|
|
142
|
+
// potentially lead to an application seeing stale RPC methods if they call `hasCapability()`, for example,
|
|
143
|
+
// in the status event listener.
|
|
144
|
+
var wasPreviouslyVerified = index_1.asperaSdk.globals.rpcMethods.length > 0;
|
|
145
|
+
if (current_status === 'DISCONNECTED' || (current_status === 'DEGRADED' && wasPreviouslyVerified)) {
|
|
131
146
|
status_1.statusService.setStatus('RUNNING');
|
|
132
147
|
}
|
|
133
148
|
};
|
|
@@ -966,70 +966,99 @@ export interface RpcMethod {
|
|
|
966
966
|
*/
|
|
967
967
|
export interface SdkCapabilities {
|
|
968
968
|
/**
|
|
969
|
-
* Whether the
|
|
969
|
+
* Whether the transfer client can read file contents for generating image previews.
|
|
970
970
|
*
|
|
971
|
-
*
|
|
972
|
-
* with the required RPC methods.
|
|
971
|
+
* This is supported when using HTTP Gateway, Connect, or IBM Aspera for desktop.
|
|
973
972
|
*/
|
|
974
973
|
imagePreview: boolean;
|
|
975
974
|
/**
|
|
976
|
-
* Whether the
|
|
975
|
+
* Whether the transfer client can calculate checksums of a file chunk.
|
|
977
976
|
*/
|
|
978
977
|
fileChecksum: boolean;
|
|
979
978
|
/**
|
|
980
979
|
* Whether the transfer client supports showing the about page.
|
|
981
980
|
*
|
|
982
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
983
|
-
* but not HTTP Gateway.
|
|
981
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
984
982
|
*/
|
|
985
983
|
showAbout: boolean;
|
|
986
984
|
/**
|
|
987
985
|
* Whether the transfer client supports showing the preferences page.
|
|
988
986
|
*
|
|
989
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
990
|
-
* but not HTTP Gateway.
|
|
987
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
991
988
|
*/
|
|
992
989
|
showPreferences: boolean;
|
|
993
990
|
/**
|
|
994
991
|
* Whether the transfer client supports showing the transfer manager.
|
|
995
992
|
*
|
|
996
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
997
|
-
* but not HTTP Gateway.
|
|
993
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
998
994
|
*/
|
|
999
995
|
showTransferManager: boolean;
|
|
1000
996
|
/**
|
|
1001
997
|
* Whether the transfer client supports showing the transfer rate monitor.
|
|
1002
998
|
*
|
|
1003
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
1004
|
-
* but not HTTP Gateway.
|
|
999
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1005
1000
|
*/
|
|
1006
1001
|
showTransferMonitor: boolean;
|
|
1007
1002
|
/**
|
|
1008
1003
|
* Whether the transfer client supports authenticating a transfer specification.
|
|
1009
1004
|
*
|
|
1010
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
1011
|
-
* but not HTTP Gateway.
|
|
1005
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1012
1006
|
*/
|
|
1013
1007
|
authenticate: boolean;
|
|
1014
1008
|
/**
|
|
1015
1009
|
* Whether the transfer client supports testing SSH port connectivity.
|
|
1016
1010
|
*
|
|
1017
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
1018
|
-
* but not HTTP Gateway.
|
|
1011
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1019
1012
|
*/
|
|
1020
1013
|
testSshPorts: boolean;
|
|
1021
1014
|
/**
|
|
1022
1015
|
* Whether the transfer client supports showing the save file dialog.
|
|
1023
1016
|
*
|
|
1024
|
-
* This is supported when using Connect or IBM Aspera for desktop
|
|
1025
|
-
* but not HTTP Gateway.
|
|
1017
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1026
1018
|
*/
|
|
1027
1019
|
showSaveFileDialog: boolean;
|
|
1028
1020
|
/**
|
|
1029
|
-
* Whether the
|
|
1021
|
+
* Whether the transfer client can read directory contents.
|
|
1030
1022
|
*
|
|
1031
|
-
* This is supported when using IBM Aspera for desktop
|
|
1032
|
-
* but not Connect or HTTP Gateway.
|
|
1023
|
+
* This is only supported when using IBM Aspera for desktop.
|
|
1033
1024
|
*/
|
|
1034
1025
|
readDirectory: boolean;
|
|
1026
|
+
/**
|
|
1027
|
+
* Whether the transfer client supports getting file-level progress for a given transfer.
|
|
1028
|
+
*
|
|
1029
|
+
* This is supported when using IBM Aspera for desktop.
|
|
1030
|
+
*/
|
|
1031
|
+
getFilesList: boolean;
|
|
1032
|
+
/**
|
|
1033
|
+
* Whether the transfer client supports customized branding settings.
|
|
1034
|
+
*
|
|
1035
|
+
* This is supported when using IBM Aspera for desktop.
|
|
1036
|
+
*/
|
|
1037
|
+
setBranding: boolean;
|
|
1038
|
+
/**
|
|
1039
|
+
* Whether the transfer client supports highlighting the destination directory of the transfer
|
|
1040
|
+
* using the system's file browser (ex: Finder or Windows Explorer).
|
|
1041
|
+
*
|
|
1042
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1043
|
+
*/
|
|
1044
|
+
showDirectory: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Whether the transfer client supports uploading folders.
|
|
1047
|
+
*
|
|
1048
|
+
* This is supported when using Connect, IBM Aspera for desktop, and HTTP Gateway v3 or newer. HTTP Gateway v2 and older
|
|
1049
|
+
* do not support uploading folders.
|
|
1050
|
+
*/
|
|
1051
|
+
folderUpload: boolean;
|
|
1052
|
+
/**
|
|
1053
|
+
* Whether the transfer client can modify a running transfer.
|
|
1054
|
+
*
|
|
1055
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1056
|
+
*/
|
|
1057
|
+
modifyTransfer: boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* Whether the transfer client resume a stopped transfer.
|
|
1060
|
+
*
|
|
1061
|
+
* This is supported when using Connect or IBM Aspera for desktop.
|
|
1062
|
+
*/
|
|
1063
|
+
resumeTransfer: boolean;
|
|
1035
1064
|
}
|