@ibm-aspera/sdk 0.4.12 → 0.4.16
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.d.ts +1 -1
- package/dist/commonjs/app/core.js +11 -21
- package/dist/commonjs/http-gateway/core.d.ts +17 -6
- package/dist/commonjs/http-gateway/core.js +44 -15
- package/dist/commonjs/http-gateway/index.d.ts +2 -2
- package/dist/commonjs/http-gateway/index.js +2 -1
- package/dist/commonjs/models/models.d.ts +5 -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
- package/scripts/release.sh +46 -0
|
@@ -43,7 +43,7 @@ export declare const init: (options?: InitOptions) => Promise<any>;
|
|
|
43
43
|
*
|
|
44
44
|
* @returns a promise that resolves if transfer initiation is successful and rejects if transfer cannot be started
|
|
45
45
|
*/
|
|
46
|
-
export declare const startTransfer: (transferSpec: TransferSpec, asperaSdkSpec
|
|
46
|
+
export declare const startTransfer: (transferSpec: TransferSpec, asperaSdkSpec?: AsperaSdkSpec) => Promise<AsperaSdkTransfer>;
|
|
47
47
|
/**
|
|
48
48
|
* Register a callback event for getting transfer updates
|
|
49
49
|
*
|
|
@@ -7,7 +7,6 @@ var helpers_1 = require("../helpers/helpers");
|
|
|
7
7
|
var http_gateway_1 = require("../http-gateway");
|
|
8
8
|
var core_1 = require("../http-gateway/core");
|
|
9
9
|
var index_1 = require("../index");
|
|
10
|
-
var http_gateway_sdk_js_1 = require("@ibm-aspera/http-gateway-sdk-js");
|
|
11
10
|
var connect_sdk_js_1 = require("@ibm-aspera/connect-sdk-js");
|
|
12
11
|
var core_2 = require("../connect/core");
|
|
13
12
|
/**
|
|
@@ -17,6 +16,7 @@ var core_2 = require("../connect/core");
|
|
|
17
16
|
* @returns a promise that resolves if server can connect or rejects if not
|
|
18
17
|
*/
|
|
19
18
|
var testConnection = function () {
|
|
19
|
+
// FIXME: If force HTTP gateway is false this ends up preventing SDK from verifying IBM Aspera for desktop is running.
|
|
20
20
|
if (index_1.asperaSdk.useHttpGateway || index_1.asperaSdk.useConnect) {
|
|
21
21
|
return Promise.resolve(index_1.asperaSdk.globals.sdkResponseData);
|
|
22
22
|
}
|
|
@@ -102,12 +102,6 @@ var init = function (options) {
|
|
|
102
102
|
var _a, _b, _c;
|
|
103
103
|
var appId = (_a = options === null || options === void 0 ? void 0 : options.appId) !== null && _a !== void 0 ? _a : (0, helpers_1.randomUUID)();
|
|
104
104
|
index_1.asperaSdk.globals.appId = appId;
|
|
105
|
-
// Watch for old HTTP Gateway transfers in case used.
|
|
106
|
-
(0, http_gateway_sdk_js_1.registerActivityCallback)(function (oldHttpTransfers) {
|
|
107
|
-
oldHttpTransfers.transfers.forEach(function (oldHttpTransfer) {
|
|
108
|
-
(0, core_1.sendTransferUpdate)(oldHttpTransfer);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
105
|
// For now ignore multi user support in Safari
|
|
112
106
|
if ((options === null || options === void 0 ? void 0 : options.supportMultipleUsers) && !(0, helpers_1.isSafari)()) {
|
|
113
107
|
index_1.asperaSdk.globals.supportMultipleUsers = true;
|
|
@@ -160,25 +154,21 @@ var init = function (options) {
|
|
|
160
154
|
return responseData;
|
|
161
155
|
});
|
|
162
156
|
}).then(function (response) {
|
|
157
|
+
return (0, http_gateway_1.initHttpGateway)(response);
|
|
158
|
+
}).then(function () {
|
|
163
159
|
var _a, _b;
|
|
164
|
-
index_1.asperaSdk.globals.httpGatewayInfo = response;
|
|
165
|
-
index_1.asperaSdk.globals.httpGatewayVerified = true;
|
|
166
|
-
var iframeContainer = document.createElement('div');
|
|
167
|
-
iframeContainer.id = 'aspera-http-gateway-iframes';
|
|
168
|
-
iframeContainer.style = 'display: none;';
|
|
169
|
-
document.body.appendChild(iframeContainer);
|
|
170
|
-
index_1.asperaSdk.globals.httpGatewayIframeContainer = iframeContainer;
|
|
171
160
|
if ((_a = options === null || options === void 0 ? void 0 : options.httpGatewaySettings) === null || _a === void 0 ? void 0 : _a.forceGateway) {
|
|
172
161
|
return Promise.resolve(index_1.asperaSdk.globals.sdkResponseData);
|
|
173
162
|
}
|
|
174
|
-
|
|
175
|
-
return ((_b = options === null || options === void 0 ? void 0 : options.connectSettings) === null || _b === void 0 ? void 0 : _b.useConnect) ? getConnectStartCalls() : getDesktopStartCalls();
|
|
176
|
-
}
|
|
163
|
+
return ((_b = options === null || options === void 0 ? void 0 : options.connectSettings) === null || _b === void 0 ? void 0 : _b.useConnect) ? getConnectStartCalls() : getDesktopStartCalls();
|
|
177
164
|
}).catch(function (error) {
|
|
178
|
-
var _a;
|
|
179
|
-
// If HTTP Gateway fails log and move on to
|
|
165
|
+
var _a, _b;
|
|
166
|
+
// If HTTP Gateway fails log and move on to transfer client
|
|
180
167
|
(0, helpers_1.errorLog)(messages_1.messages.httpInitFail, error);
|
|
181
|
-
|
|
168
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.httpGatewaySettings) === null || _a === void 0 ? void 0 : _a.forceGateway) {
|
|
169
|
+
throw (0, helpers_1.generateErrorBody)(messages_1.messages.httpInitFail, error);
|
|
170
|
+
}
|
|
171
|
+
return ((_b = options === null || options === void 0 ? void 0 : options.connectSettings) === null || _b === void 0 ? void 0 : _b.useConnect) ? getConnectStartCalls() : getDesktopStartCalls();
|
|
182
172
|
});
|
|
183
173
|
}
|
|
184
174
|
return ((_c = options === null || options === void 0 ? void 0 : options.connectSettings) === null || _c === void 0 ? void 0 : _c.useConnect) ? getConnectStartCalls() : getDesktopStartCalls();
|
|
@@ -210,7 +200,7 @@ var startTransfer = function (transferSpec, asperaSdkSpec) {
|
|
|
210
200
|
var promiseInfo = (0, helpers_1.generatePromiseObjects)();
|
|
211
201
|
var payload = {
|
|
212
202
|
transfer_spec: transferSpec,
|
|
213
|
-
desktop_spec: asperaSdkSpec,
|
|
203
|
+
desktop_spec: asperaSdkSpec || {},
|
|
214
204
|
app_id: index_1.asperaSdk.globals.appId,
|
|
215
205
|
};
|
|
216
206
|
client_1.client.request('start_transfer', payload)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FileDialogOptions, DataTransferResponse, TransferSpec, AsperaSdkTransfer, ReadAsArrayBufferResponse, ReadChunkAsArrayBufferResponse } from '../models/models';
|
|
2
|
+
import { HttpGatewayInfo } from './models';
|
|
2
3
|
/**
|
|
3
4
|
* HTTP Gateway Core Logic
|
|
4
5
|
* - File/Folder picking
|
|
@@ -8,6 +9,22 @@ import { FileDialogOptions, DataTransferResponse, TransferSpec, AsperaSdkTransfe
|
|
|
8
9
|
* Most logic is called directly by Desktop SDK functions
|
|
9
10
|
* You may not need to import anything from this file.
|
|
10
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* Send a transfer update through the SDK
|
|
14
|
+
*
|
|
15
|
+
* @param transfer - Transsfer object to send to consumers
|
|
16
|
+
*/
|
|
17
|
+
export declare const sendTransferUpdate: (transfer: AsperaSdkTransfer) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the HTTP Gateway after the /info response has been received and verified.
|
|
20
|
+
* For v2 gateways, delegates to the old HTTP Gateway SDK.
|
|
21
|
+
* For v3 gateways, sets up the iframe container for downloads.
|
|
22
|
+
*
|
|
23
|
+
* @param response - The /info response from the HTTP Gateway server
|
|
24
|
+
*
|
|
25
|
+
* @returns a promise that resolves when the HTTP Gateway is initialized
|
|
26
|
+
*/
|
|
27
|
+
export declare const initHttpGateway: (response: HttpGatewayInfo) => Promise<void>;
|
|
11
28
|
/**
|
|
12
29
|
* Remove a transfer from HTTP Gateway systems
|
|
13
30
|
* @param id - ID of the transfer
|
|
@@ -56,12 +73,6 @@ export declare const httpGatewaySelectFileFolderDialog: (options?: FileDialogOpt
|
|
|
56
73
|
* @returns a transfer object to track status and send to consumers
|
|
57
74
|
*/
|
|
58
75
|
export declare const getSdkTransfer: (transferSpec: TransferSpec) => AsperaSdkTransfer;
|
|
59
|
-
/**
|
|
60
|
-
* Send a transfer update through the SDK
|
|
61
|
-
*
|
|
62
|
-
* @param transfer - Transsfer object to send to consumers
|
|
63
|
-
*/
|
|
64
|
-
export declare const sendTransferUpdate: (transfer: AsperaSdkTransfer) => void;
|
|
65
76
|
/**
|
|
66
77
|
* Try to parse and get a useful string from API calls for HTTP Gateway
|
|
67
78
|
*
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpGatewayReadChunkAsArrayBuffer = exports.httpGatewayReadAsArrayBuffer = exports.base64Encoding = exports.getMessageFromError = exports.
|
|
3
|
+
exports.httpGatewayReadChunkAsArrayBuffer = exports.httpGatewayReadAsArrayBuffer = exports.base64Encoding = exports.getMessageFromError = exports.getSdkTransfer = exports.httpGatewaySelectFileFolderDialog = exports.handleHttpGatewayDrop = exports.createHtmlInputElement = exports.httpGetTransfer = exports.httpGetAllTransfers = exports.httpRemoveTransfer = exports.initHttpGateway = exports.sendTransferUpdate = void 0;
|
|
4
4
|
var messages_1 = require("../constants/messages");
|
|
5
5
|
var helpers_1 = require("../helpers/helpers");
|
|
6
6
|
var index_1 = require("../index");
|
|
7
7
|
var http_gateway_sdk_js_1 = require("@ibm-aspera/http-gateway-sdk-js");
|
|
8
|
-
// 50MiB
|
|
8
|
+
// Maximum file size for generating image previews for files. 50MiB matches the limits in both Connect and IBM Aspera for desktop.
|
|
9
9
|
var MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
10
10
|
/**
|
|
11
11
|
* HTTP Gateway Core Logic
|
|
@@ -16,6 +16,48 @@ var MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
|
16
16
|
* Most logic is called directly by Desktop SDK functions
|
|
17
17
|
* You may not need to import anything from this file.
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Send a transfer update through the SDK
|
|
21
|
+
*
|
|
22
|
+
* @param transfer - Transsfer object to send to consumers
|
|
23
|
+
*/
|
|
24
|
+
var sendTransferUpdate = function (transfer) {
|
|
25
|
+
index_1.asperaSdk.httpGatewayTransferStore.set(transfer.uuid, transfer);
|
|
26
|
+
index_1.asperaSdk.activityTracking.handleTransferActivity({
|
|
27
|
+
type: 'transferUpdated',
|
|
28
|
+
data: { transfers: [transfer] },
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.sendTransferUpdate = sendTransferUpdate;
|
|
32
|
+
/**
|
|
33
|
+
* Initialize the HTTP Gateway after the /info response has been received and verified.
|
|
34
|
+
* For v2 gateways, delegates to the old HTTP Gateway SDK.
|
|
35
|
+
* For v3 gateways, sets up the iframe container for downloads.
|
|
36
|
+
*
|
|
37
|
+
* @param response - The /info response from the HTTP Gateway server
|
|
38
|
+
*
|
|
39
|
+
* @returns a promise that resolves when the HTTP Gateway is initialized
|
|
40
|
+
*/
|
|
41
|
+
var initHttpGateway = function (response) {
|
|
42
|
+
index_1.asperaSdk.globals.httpGatewayInfo = response;
|
|
43
|
+
index_1.asperaSdk.globals.httpGatewayVerified = true;
|
|
44
|
+
if (index_1.asperaSdk.useOldHttpGateway) {
|
|
45
|
+
// Watch for old HTTP Gateway transfers in case used.
|
|
46
|
+
(0, http_gateway_sdk_js_1.registerActivityCallback)(function (oldHttpTransfers) {
|
|
47
|
+
oldHttpTransfers.transfers.forEach(function (oldHttpTransfer) {
|
|
48
|
+
(0, exports.sendTransferUpdate)(oldHttpTransfer);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return (0, http_gateway_sdk_js_1.initHttpGateway)(index_1.asperaSdk.globals.httpGatewayUrl).then(function () { });
|
|
52
|
+
}
|
|
53
|
+
var iframeContainer = document.createElement('div');
|
|
54
|
+
iframeContainer.id = 'aspera-http-gateway-iframes';
|
|
55
|
+
iframeContainer.style = 'display: none;';
|
|
56
|
+
document.body.appendChild(iframeContainer);
|
|
57
|
+
index_1.asperaSdk.globals.httpGatewayIframeContainer = iframeContainer;
|
|
58
|
+
return Promise.resolve();
|
|
59
|
+
};
|
|
60
|
+
exports.initHttpGateway = initHttpGateway;
|
|
19
61
|
/**
|
|
20
62
|
* Remove a transfer from HTTP Gateway systems
|
|
21
63
|
* @param id - ID of the transfer
|
|
@@ -205,19 +247,6 @@ var getSdkTransfer = function (transferSpec) {
|
|
|
205
247
|
};
|
|
206
248
|
};
|
|
207
249
|
exports.getSdkTransfer = getSdkTransfer;
|
|
208
|
-
/**
|
|
209
|
-
* Send a transfer update through the SDK
|
|
210
|
-
*
|
|
211
|
-
* @param transfer - Transsfer object to send to consumers
|
|
212
|
-
*/
|
|
213
|
-
var sendTransferUpdate = function (transfer) {
|
|
214
|
-
index_1.asperaSdk.httpGatewayTransferStore.set(transfer.uuid, transfer);
|
|
215
|
-
index_1.asperaSdk.activityTracking.handleTransferActivity({
|
|
216
|
-
type: 'transferUpdated',
|
|
217
|
-
data: { transfers: [transfer] },
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
exports.sendTransferUpdate = sendTransferUpdate;
|
|
221
250
|
/**
|
|
222
251
|
* Try to parse and get a useful string from API calls for HTTP Gateway
|
|
223
252
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { httpDownload } from './download';
|
|
2
2
|
import { httpUpload } from './upload';
|
|
3
|
-
import { handleHttpGatewayDrop, httpGatewaySelectFileFolderDialog, createHtmlInputElement } from './core';
|
|
3
|
+
import { handleHttpGatewayDrop, httpGatewaySelectFileFolderDialog, createHtmlInputElement, initHttpGateway } from './core';
|
|
4
4
|
/**
|
|
5
5
|
* HTTP Gateway Exports
|
|
6
6
|
*
|
|
@@ -8,4 +8,4 @@ import { handleHttpGatewayDrop, httpGatewaySelectFileFolderDialog, createHtmlInp
|
|
|
8
8
|
* Most logic is called directly by Desktop SDK functions
|
|
9
9
|
* You may not need to import anything from this file.
|
|
10
10
|
*/
|
|
11
|
-
export { httpUpload, httpDownload, handleHttpGatewayDrop, httpGatewaySelectFileFolderDialog, createHtmlInputElement, };
|
|
11
|
+
export { httpUpload, httpDownload, handleHttpGatewayDrop, httpGatewaySelectFileFolderDialog, createHtmlInputElement, initHttpGateway, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createHtmlInputElement = exports.httpGatewaySelectFileFolderDialog = exports.handleHttpGatewayDrop = exports.httpDownload = exports.httpUpload = void 0;
|
|
3
|
+
exports.initHttpGateway = exports.createHtmlInputElement = exports.httpGatewaySelectFileFolderDialog = exports.handleHttpGatewayDrop = exports.httpDownload = exports.httpUpload = void 0;
|
|
4
4
|
var download_1 = require("./download");
|
|
5
5
|
Object.defineProperty(exports, "httpDownload", { enumerable: true, get: function () { return download_1.httpDownload; } });
|
|
6
6
|
var upload_1 = require("./upload");
|
|
@@ -9,3 +9,4 @@ var core_1 = require("./core");
|
|
|
9
9
|
Object.defineProperty(exports, "handleHttpGatewayDrop", { enumerable: true, get: function () { return core_1.handleHttpGatewayDrop; } });
|
|
10
10
|
Object.defineProperty(exports, "httpGatewaySelectFileFolderDialog", { enumerable: true, get: function () { return core_1.httpGatewaySelectFileFolderDialog; } });
|
|
11
11
|
Object.defineProperty(exports, "createHtmlInputElement", { enumerable: true, get: function () { return core_1.createHtmlInputElement; } });
|
|
12
|
+
Object.defineProperty(exports, "initHttpGateway", { enumerable: true, get: function () { return core_1.initHttpGateway; } });
|
|
@@ -162,6 +162,11 @@ export interface AsperaSdkSpec {
|
|
|
162
162
|
* alongside the transfer.
|
|
163
163
|
*/
|
|
164
164
|
preview_base64?: string;
|
|
165
|
+
/**
|
|
166
|
+
* When `false`, IBM Aspera for desktop disables automatic UI prompts, except when the user must authorize
|
|
167
|
+
* transfers to untrusted hosts.
|
|
168
|
+
*/
|
|
169
|
+
allow_dialogs?: boolean;
|
|
165
170
|
/**
|
|
166
171
|
* HTTP Gateway Server override. This will not verify server but switch a transfer to use
|
|
167
172
|
* this server instead of the default one that initiated the SDK.
|