@ibm-aspera/sdk 0.2.12 → 0.2.29

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.
Files changed (111) hide show
  1. package/.editorconfig +13 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.github/CODE_OF_CONDUCT.md +128 -0
  4. package/.github/CONTRIBUTING.md +147 -0
  5. package/.github/dependabot.yml +10 -0
  6. package/.github/workflows/ci.yml +39 -0
  7. package/.github/workflows/documentation.yml +44 -0
  8. package/.github/workflows/publish.yml +23 -0
  9. package/.github/workflows/version.yml +32 -0
  10. package/CHANGELOG.md +204 -0
  11. package/docs/DEVELOPMENT.md +38 -0
  12. package/eslint.config.js +104 -0
  13. package/example/README.md +7 -0
  14. package/example/index.html +14 -0
  15. package/example/package-lock.json +2989 -0
  16. package/example/package.json +30 -0
  17. package/example/public/404.html +5 -0
  18. package/example/public/sdk-code.js +326 -0
  19. package/example/src/App/App.scss +40 -0
  20. package/example/src/App/index.tsx +196 -0
  21. package/example/src/Views/AllTogether.tsx +26 -0
  22. package/example/src/Views/DragDrop.tsx +23 -0
  23. package/example/src/Views/Home.tsx +10 -0
  24. package/example/src/Views/Initialize.tsx +31 -0
  25. package/example/src/Views/Installer.tsx +154 -0
  26. package/example/src/Views/MonitorTransfers.tsx +88 -0
  27. package/example/src/Views/Other.tsx +24 -0
  28. package/example/src/Views/SelectItems.tsx +46 -0
  29. package/example/src/Views/StartTransfer.tsx +37 -0
  30. package/example/src/Views/Test.tsx +20 -0
  31. package/example/src/Views/Views.scss +111 -0
  32. package/example/src/helpers/index.ts +19 -0
  33. package/example/src/index.scss +47 -0
  34. package/example/src/main.tsx +17 -0
  35. package/example/src/vite-env.d.ts +2 -0
  36. package/example/tsconfig.json +30 -0
  37. package/example/vite.config.ts +23 -0
  38. package/jest.config.js +19 -0
  39. package/jest.setup.js +0 -0
  40. package/package.json +4 -4
  41. package/renovate.json +12 -0
  42. package/src/app/core.ts +765 -0
  43. package/src/app/installer.ts +53 -0
  44. package/src/connect/core.ts +83 -0
  45. package/src/constants/constants.ts +19 -0
  46. package/src/constants/messages.ts +35 -0
  47. package/src/helpers/client/client.ts +11 -0
  48. package/src/helpers/client/http-client.ts +92 -0
  49. package/src/helpers/client/safari-client.ts +334 -0
  50. package/src/helpers/helpers.ts +253 -0
  51. package/src/helpers/http.ts +39 -0
  52. package/src/helpers/ws.ts +191 -0
  53. package/src/http-gateway/core.ts +273 -0
  54. package/src/http-gateway/download.ts +217 -0
  55. package/src/http-gateway/index.ts +19 -0
  56. package/src/http-gateway/models.ts +20 -0
  57. package/src/http-gateway/upload.ts +148 -0
  58. package/src/index.ts +72 -0
  59. package/src/models/aspera-sdk.model.ts +446 -0
  60. package/src/models/models.ts +740 -0
  61. package/tests/client.spec.ts +52 -0
  62. package/tests/core.spec.ts +13 -0
  63. package/tests/helpers.spec.ts +127 -0
  64. package/tests/http.spec.ts +14 -0
  65. package/tests/installer.spec.ts +135 -0
  66. package/tests/mocks.ts +11 -0
  67. package/tsconfig.json +14 -0
  68. package/tsconfig.module.json +16 -0
  69. package/typedoc.js +7 -0
  70. package/webpack.config.js +35 -0
  71. package/dist/commonjs/app/core.d.ts +0 -191
  72. package/dist/commonjs/app/core.js +0 -682
  73. package/dist/commonjs/app/installer.d.ts +0 -9
  74. package/dist/commonjs/app/installer.js +0 -50
  75. package/dist/commonjs/connect/core.d.ts +0 -11
  76. package/dist/commonjs/connect/core.js +0 -73
  77. package/dist/commonjs/constants/constants.d.ts +0 -8
  78. package/dist/commonjs/constants/constants.js +0 -11
  79. package/dist/commonjs/constants/messages.d.ts +0 -35
  80. package/dist/commonjs/constants/messages.js +0 -38
  81. package/dist/commonjs/helpers/client/client.d.ts +0 -5
  82. package/dist/commonjs/helpers/client/client.js +0 -7
  83. package/dist/commonjs/helpers/client/http-client.d.ts +0 -42
  84. package/dist/commonjs/helpers/client/http-client.js +0 -84
  85. package/dist/commonjs/helpers/client/safari-client.d.ts +0 -101
  86. package/dist/commonjs/helpers/client/safari-client.js +0 -264
  87. package/dist/commonjs/helpers/helpers.d.ts +0 -109
  88. package/dist/commonjs/helpers/helpers.js +0 -249
  89. package/dist/commonjs/helpers/http.d.ts +0 -16
  90. package/dist/commonjs/helpers/http.js +0 -42
  91. package/dist/commonjs/helpers/ws.d.ts +0 -62
  92. package/dist/commonjs/helpers/ws.js +0 -176
  93. package/dist/commonjs/http-gateway/core.d.ts +0 -76
  94. package/dist/commonjs/http-gateway/core.js +0 -254
  95. package/dist/commonjs/http-gateway/download.d.ts +0 -14
  96. package/dist/commonjs/http-gateway/download.js +0 -186
  97. package/dist/commonjs/http-gateway/index.d.ts +0 -11
  98. package/dist/commonjs/http-gateway/index.js +0 -11
  99. package/dist/commonjs/http-gateway/models.d.ts +0 -16
  100. package/dist/commonjs/http-gateway/models.js +0 -2
  101. package/dist/commonjs/http-gateway/upload.d.ts +0 -14
  102. package/dist/commonjs/http-gateway/upload.js +0 -124
  103. package/dist/commonjs/index.d.ts +0 -8
  104. package/dist/commonjs/index.js +0 -100
  105. package/dist/commonjs/models/aspera-sdk.model.d.ts +0 -245
  106. package/dist/commonjs/models/aspera-sdk.model.js +0 -312
  107. package/dist/commonjs/models/models.d.ts +0 -712
  108. package/dist/commonjs/models/models.js +0 -2
  109. package/dist/js/aspera-sdk.js +0 -3
  110. package/dist/js/aspera-sdk.js.LICENSE.txt +0 -15
  111. package/dist/js/aspera-sdk.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ import {mockFetch} from './mocks';
2
+ import {httpClient, getRpcServerUrl} from '../src/helpers/client/http-client';
3
+
4
+ let id = 0;
5
+
6
+ const getHeaders = () => {
7
+ return {
8
+ 'content-type': 'application/json',
9
+ };
10
+ };
11
+
12
+ const getMethod = () => {
13
+ return 'POST';
14
+ };
15
+
16
+ const getBody = (method: string, params: any = {}) => {
17
+ return JSON.stringify({
18
+ jsonrpc: '2.0',
19
+ id,
20
+ method,
21
+ params,
22
+ });
23
+ };
24
+
25
+ const getExpectedRequest = (method: string, params: any = {}) => {
26
+ id++;
27
+
28
+ return {
29
+ method: getMethod(),
30
+ headers: getHeaders(),
31
+ body: getBody(method, params),
32
+ };
33
+ };
34
+
35
+ describe('request', () => {
36
+ beforeEach(() => {
37
+ (<any>global).fetch = mockFetch({});
38
+ });
39
+
40
+ const fakeData = {data: 'testing'};
41
+ const rpcServerURL = getRpcServerUrl();
42
+
43
+ test('POST with no params should call url with no params', () => {
44
+ httpClient.request('fake');
45
+ expect(fetch).toHaveBeenCalledWith(rpcServerURL, getExpectedRequest('fake'));
46
+ });
47
+
48
+ test('POST with params should call url with params', () => {
49
+ httpClient.request('fake', fakeData);
50
+ expect(fetch).toHaveBeenCalledWith(rpcServerURL, getExpectedRequest('fake', fakeData));
51
+ });
52
+ });
@@ -0,0 +1,13 @@
1
+ import {mockFetch} from './mocks';
2
+ import {init} from '../src';
3
+
4
+ describe('initHttpGateway', () => {
5
+ beforeEach(() => {
6
+ (<any>global).fetch = mockFetch({});
7
+ });
8
+
9
+ test('calls default URL', async () => {
10
+ init({appId: 'fake'}).catch(() => {});
11
+ // expect(fetch).toBeCalled();
12
+ });
13
+ });
@@ -0,0 +1,127 @@
1
+ import {JSONRPCErrorException} from 'json-rpc-2.0';
2
+ import {
3
+ errorLog,
4
+ generateErrorBody,
5
+ generatePromiseObjects,
6
+ isValidTransferSpec,
7
+ isValidURL
8
+ } from '../src/helpers/helpers';
9
+ import {TransferSpec} from '../src/models/models';
10
+
11
+ describe('generatePromiseObjects', () => {
12
+
13
+ test('returns object containg promise, rejecter and resolver', () => {
14
+ const promiseItem = generatePromiseObjects();
15
+ expect(typeof promiseItem.promise.then).toBe('function');
16
+ expect(typeof promiseItem.resolver).toBe('function');
17
+ expect(typeof promiseItem.rejecter).toBe('function');
18
+ });
19
+ });
20
+
21
+ describe('errorLog', () => {
22
+
23
+ beforeEach(() => {
24
+ (<any>window).asperaSdkLogs = undefined;
25
+ jest.spyOn(global.console, 'warn');
26
+ });
27
+
28
+ test('with message and no debug data should store in array and console', () => {
29
+ const consoleWarnCall = jest.fn();
30
+ console.warn = consoleWarnCall;
31
+ const testMessage = 'Test message';
32
+ expect((<any>window).asperaSdkLogs).toBe(undefined);
33
+ errorLog(testMessage);
34
+ expect(consoleWarnCall).toHaveBeenCalled();
35
+ expect((<any>window).asperaSdkLogs[0].message).toBe(testMessage);
36
+ expect((<any>window).asperaSdkLogs[0].debugData).toBe(undefined);
37
+ });
38
+
39
+ test('with message and debug data should store in array and console', () => {
40
+ const consoleWarnCall = jest.fn();
41
+ console.warn = consoleWarnCall;
42
+ const testMessage = 'Test message';
43
+ expect((<any>window).asperaSdkLogs).toBe(undefined);
44
+ const error = {error: true};
45
+ errorLog(testMessage, {error: true});
46
+ expect(consoleWarnCall).toHaveBeenLastCalledWith('Aspera SDK: Test message', error);
47
+ expect((<any>window).asperaSdkLogs[0].message).toBe(testMessage);
48
+ expect((<any>window).asperaSdkLogs[0].debugData.error).toBe(true);
49
+ });
50
+ });
51
+
52
+ describe('generateErrorBody', () => {
53
+
54
+ test('should return error object without debugData if nothing is passed', () => {
55
+ const errorResponse = generateErrorBody('testing');
56
+ expect(errorResponse.message).toBe('testing');
57
+ expect(errorResponse.error).toBe(true);
58
+ expect(errorResponse.debugData).toBe(undefined);
59
+ });
60
+
61
+ test('should return error object with debugData if data is passed', () => {
62
+ const errorTest = new JSONRPCErrorException('testing error body', -32002, {foo: 'bar'});
63
+ const errorResponse = generateErrorBody('testing', errorTest);
64
+ expect(errorResponse.message).toBe('testing');
65
+ expect(errorResponse.error).toBe(true);
66
+ expect(errorResponse.debugData.message).toBe('testing error body');
67
+ expect(errorResponse.debugData.code).toBe(-32002);
68
+ expect(errorResponse.debugData.data).toStrictEqual({foo: 'bar'});
69
+ });
70
+ });
71
+
72
+ describe('isValidTransferSpec', () => {
73
+ const transferSpec: TransferSpec = {
74
+ authentication: 'token',
75
+ paths: [
76
+ {
77
+ source: '/foo'
78
+ }
79
+ ],
80
+ direction: 'receive',
81
+ remote_host: 'localhost'
82
+ };
83
+ const invalidTransferSpecs: any[] = [
84
+ null,
85
+ undefined,
86
+ 'transfer',
87
+ 85
88
+ ];
89
+
90
+ test('should return true if valid transferSpec', () => {
91
+ expect(isValidTransferSpec(transferSpec)).toBe(true);
92
+ });
93
+
94
+ test('should return false if invalid transferSpec', () => {
95
+ invalidTransferSpecs.forEach(element => {
96
+ expect(isValidTransferSpec(element)).toBe(false);
97
+ });
98
+ });
99
+ });
100
+
101
+ describe('isValidURL', () => {
102
+ const validUrls = [
103
+ 'http://www.aspera.us',
104
+ 'https://www.aspera.us',
105
+ 'https://aspera.us',
106
+ 'https://aspera.us/aspera/sdk/latest.json',
107
+ 'https://aspera.us///aspera/sdk',
108
+ ];
109
+ const invalidUrls = [
110
+ 'aspera.us',
111
+ '/aspera/sdk',
112
+ 'aspera',
113
+ ];
114
+
115
+ test('should return true if valid url', () => {
116
+ validUrls.forEach(url => {
117
+ expect(isValidURL(url)).toBe(true);
118
+ });
119
+ });
120
+
121
+ test('should return false if invalid url', () => {
122
+ invalidUrls.forEach(url => {
123
+ expect(isValidURL(url)).toBe(false);
124
+ });
125
+ });
126
+ });
127
+
@@ -0,0 +1,14 @@
1
+ import {apiGet} from '../src/helpers/http';
2
+ import {mockFetch} from './mocks';
3
+
4
+ describe('apiGet', () => {
5
+
6
+ beforeEach(() => {
7
+ (<any>global).fetch = mockFetch({});
8
+ });
9
+
10
+ test('GET should call url', () => {
11
+ apiGet('aspera.us');
12
+ expect(fetch).toHaveBeenCalledWith('aspera.us', {headers: {'Content-Type': 'application/json'}});
13
+ });
14
+ });
@@ -0,0 +1,135 @@
1
+ import {getInstallerInfo} from '../src/app/installer';
2
+ import {installerUrl} from '../src/constants/constants';
3
+ import {mockFetch} from './mocks';
4
+
5
+ describe('getInstallerInfo', () => {
6
+ const defaultHeaders = {headers: {'Content-Type': 'application/json'}};
7
+
8
+ beforeEach(() => {
9
+ const response = {
10
+ entries: [
11
+ {
12
+ 'version': '1.2.0',
13
+ 'platform': 'macos',
14
+ 'type': 'dmg',
15
+ 'arch': 'universal',
16
+ 'url': 'https://downloads.ibmaspera.com/downloads/desktop/macos/1.2.0/stable/universal/ibm-aspera-sdk_1.2.0_macos.dmg'
17
+ },
18
+ {
19
+ 'version': '1.2.0',
20
+ 'platform': 'windows',
21
+ 'type': 'msi',
22
+ 'arch': 'x64',
23
+ 'url': 'https://downloads.ibmaspera.com/downloads/desktop/windows/1.2.0/stable/x64/ibm-aspera-sdk_1.2.0.msi'
24
+ },
25
+ {
26
+ 'version': '1.1.9',
27
+ 'platform': 'linux',
28
+ 'type': 'rpm',
29
+ 'arch': 'x64',
30
+ 'url': 'https://downloads.ibmaspera.com/downloads/desktop/linux/1.1.9/stable/x64/ibm-aspera-sdk_1.1.9.rpm'
31
+ },
32
+ {
33
+ 'version': '1.1.9',
34
+ 'platform': 'linux',
35
+ 'type': 'appimage',
36
+ 'arch': 'x64',
37
+ 'url': 'https://downloads.ibmaspera.com/downloads/desktop/linux/1.1.9/stable/x64/ibm-aspera-sdk_1.1.9.AppImage'
38
+ }
39
+ ]
40
+ };
41
+ (<any>global).fetch = mockFetch(response);
42
+ console.warn = jest.fn();
43
+ });
44
+
45
+ test('called with no options fetches from downloads server by default', () => {
46
+ getInstallerInfo().catch(() => {});
47
+ expect(fetch).toHaveBeenCalledWith(`${installerUrl}/latest.json`, defaultHeaders);
48
+ });
49
+
50
+ test('called with no options returns results for specific platform', async () => {
51
+ Object.defineProperty(window.navigator, 'userAgent', {value : 'Macintosh'});
52
+ const exp = [
53
+ {
54
+ 'version': '1.2.0',
55
+ 'platform': 'macos',
56
+ 'type': 'dmg',
57
+ 'arch': 'universal',
58
+ 'url': 'https://downloads.ibmaspera.com/downloads/desktop/macos/1.2.0/stable/universal/ibm-aspera-sdk_1.2.0_macos.dmg'
59
+ }
60
+ ];
61
+ const data = await getInstallerInfo();
62
+ expect(data.entries).toEqual(exp);
63
+ });
64
+
65
+ test('called with all returns results for all platforms', async () => {
66
+ const data = await getInstallerInfo({all: true});
67
+ expect(data.entries.length).toBe(4);
68
+ });
69
+
70
+ test('called with endpoint', () => {
71
+ getInstallerInfo({endpoint: 'https://aspera.us/aspera/sdk'}).catch(() => {});
72
+ expect(fetch).toHaveBeenCalledWith('https://aspera.us/aspera/sdk/latest.json', defaultHeaders);
73
+ });
74
+
75
+ test('called with endpoint with trailing json file', () => {
76
+ getInstallerInfo({endpoint: 'https://aspera.us/aspera/sdk/latest.json'}).catch(() => {});
77
+ expect(fetch).toHaveBeenCalledWith('https://aspera.us/aspera/sdk/latest.json', defaultHeaders);
78
+ });
79
+
80
+ test('called with endpoint returns URLs relative to endpoint', async () => {
81
+ const response = {
82
+ entries: [
83
+ {
84
+ 'version': '1.2.0',
85
+ 'platform': 'macos',
86
+ 'type': 'dmg',
87
+ 'arch': 'universal',
88
+ 'url': 'downloads/ibm-aspera-sdk_1.2.0_macos.dmg'
89
+ },
90
+ {
91
+ 'version': '1.2.0',
92
+ 'platform': 'windows',
93
+ 'type': 'msi',
94
+ 'arch': 'x64',
95
+ 'url': 'downloads/ibm-aspera-sdk_1.2.0.msi'
96
+ },
97
+ {
98
+ 'version': '1.1.9',
99
+ 'platform': 'linux',
100
+ 'type': 'rpm',
101
+ 'arch': 'x64',
102
+ 'url': 'downloads/ibm-aspera-sdk_1.1.9.rpm'
103
+ },
104
+ {
105
+ 'version': '1.1.9',
106
+ 'platform': 'linux',
107
+ 'type': 'appimage',
108
+ 'arch': 'x64',
109
+ 'url': 'downloads/ibm-aspera-sdk_1.1.9.AppImage'
110
+ }
111
+ ]
112
+ };
113
+ (<any>global).fetch = mockFetch(response);
114
+ const data = await getInstallerInfo({endpoint: 'https://aspera.us/aspera/sdk', all: true});
115
+ for (const entry of data.entries) {
116
+ expect(entry.url.startsWith('https://aspera.us/aspera/sdk/downloads/ibm-aspera-sdk')).toBe(true);
117
+ }
118
+ });
119
+
120
+ test('called with invalid endpoint rejects', () => {
121
+ const response = {
122
+ entries: [
123
+ {
124
+ 'version': '1.2.0',
125
+ 'platform': 'macos',
126
+ 'type': 'dmg',
127
+ 'arch': 'universal',
128
+ 'url': 'downloads/ibm-aspera-sdk_1.2.0_macos.dmg'
129
+ }
130
+ ]
131
+ };
132
+ (<any>global).fetch = mockFetch(response);
133
+ return expect(getInstallerInfo({endpoint: 'aspera.us'})).rejects.toMatchObject({error: true});
134
+ });
135
+ });
package/tests/mocks.ts ADDED
@@ -0,0 +1,11 @@
1
+ export const mockFetch = (data: any) => {
2
+ const returnPromise = new Promise(resolver => {
3
+ resolver(data);
4
+ });
5
+ return jest.fn().mockImplementation(() => {
6
+ return Promise.resolve({
7
+ ok: true,
8
+ json:() => returnPromise.catch(() => {}),
9
+ });
10
+ });
11
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "./dist/js",
4
+ "noImplicitAny": true,
5
+ "module": "node16",
6
+ "target": "es5",
7
+ "esModuleInterop": true,
8
+ "moduleResolution": "node16",
9
+ "isolatedModules": true
10
+ },
11
+ "exclude": [
12
+ "./example"
13
+ ]
14
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "module": "commonjs",
5
+ "lib": ["es2017", "es7", "es6", "dom"],
6
+ "declaration": true,
7
+ "outDir": "dist/commonjs",
8
+ "esModuleInterop": true
9
+ },
10
+ "exclude": [
11
+ "node_modules",
12
+ "example",
13
+ "dist",
14
+ "tests"
15
+ ]
16
+ }
package/typedoc.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ out: 'docs',
3
+ theme: 'default',
4
+ excludePrivate: false,
5
+ name: 'IBM Aspera JavaScript Library',
6
+ hideGenerator: true
7
+ };
@@ -0,0 +1,35 @@
1
+ const path = require('path');
2
+ const webpack = require('webpack');
3
+
4
+ const packageFile = require('./package.json');
5
+ let version = '';
6
+
7
+ if (packageFile.version) {
8
+ version = `v${packageFile.version}`;
9
+ }
10
+
11
+ const banner = `IBM Aspera SDK ${version}\nLicensed Materials – Property of IBM\n© Copyright IBM Corp. 2024, 2025\nU.S. Government Users Restricted Rights: Use, duplication or disclosure restricted by\nGSA ADP Schedule Contract with IBM Corp.`;
12
+
13
+ module.exports = {
14
+ entry: './src/index.ts',
15
+ devtool: 'source-map',
16
+ output: {
17
+ path: path.resolve(__dirname, 'dist/js'),
18
+ filename: 'aspera-sdk.js'
19
+ },
20
+ resolve: {
21
+ extensions: ['.tsx', '.ts', '.js', '.json']
22
+ },
23
+ module: {
24
+ rules: [
25
+ {
26
+ test: /\.tsx?$/,
27
+ use: ['ts-loader'],
28
+ exclude: /node_modules/
29
+ }
30
+ ]
31
+ },
32
+ plugins: [
33
+ new webpack.BannerPlugin(banner)
34
+ ]
35
+ };
@@ -1,191 +0,0 @@
1
- import { AsperaSdkInfo, TransferResponse } from '../models/aspera-sdk.model';
2
- import { CustomBrandingOptions, DataTransferResponse, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, InitOptions, ModifyTransferOptions, ResumeTransferOptions, TransferSpec, WebsocketEvent } from '../models/models';
3
- import * as ConnectTypes from '@ibm-aspera/connect-sdk-js/dist/esm/core/types';
4
- /**
5
- * Check if IBM Aspera for Desktop connection works. This function is called by init
6
- * when initializing the SDK. This function can be used at any point for checking.
7
- *
8
- * @returns a promise that resolves if server can connect or rejects if not
9
- */
10
- export declare const testConnection: () => Promise<any>;
11
- /**
12
- * Initialize drag and drop. HTTP Gateway and Connect does not need to init.
13
- * Ignore if only HTTP Gateway
14
- * @param initCall - Indicate if called via init flow and should not reject
15
- *
16
- * @returns a promise that resolves if the initialization was successful or not
17
- */
18
- export declare const initDragDrop: (initCall?: boolean) => Promise<boolean>;
19
- /**
20
- * Initialize IBM Aspera client. If client cannot (reject/catch), then
21
- * client should attempt fixing server URL or trying again. If still fails disable UI elements.
22
- *
23
- * @param options initialization options:
24
- *
25
- * - `appId` the unique ID for the website. Transfers initiated during this session
26
- * will be associated with this ID. It is recommended to use a unique ID to keep transfer
27
- * information private from other websites.
28
- *
29
- * - `supportMultipleUsers` when enabled (defaults to false), the SDK will iterate over a port
30
- * range and generate a session id to determine the running instance of the desktop app for the
31
- * current user. This is needed when multiple users may be logged into the same machine
32
- * simultaneously, for example on a Windows Server.
33
- *
34
- * @returns a promise that resolves if IBM Aspera Desktop is running properly or
35
- * rejects if unable to connect
36
- */
37
- export declare const init: (options?: InitOptions) => Promise<any>;
38
- /**
39
- * Start a transfer
40
- *
41
- * @param transferSpec standard transferSpec for transfer
42
- * @param asperaSdkSpec IBM Aspera settings when starting a transfer.
43
- *
44
- * @returns a promise that resolves if transfer initiation is successful and rejects if transfer cannot be started
45
- */
46
- export declare const startTransfer: (transferSpec: TransferSpec, asperaSdkSpec: AsperaSdkSpec) => Promise<AsperaSdkTransfer>;
47
- /**
48
- * Register a callback event for getting transfer updates
49
- *
50
- * @param callback callback function to receive transfers
51
- *
52
- * @returns ID representing the callback for deregistration purposes
53
- */
54
- export declare const registerActivityCallback: (callback: (transfers: TransferResponse) => void) => string;
55
- /**
56
- * Remove a callback from the transfer callback
57
- *
58
- * @param id the ID returned by `registerActivityCallback`
59
- */
60
- export declare const deregisterActivityCallback: (id: string) => void;
61
- /**
62
- * Register a callback for getting updates about the connection status of IBM Aspera SDK.
63
- *
64
- * For example, to be notified of when the SDK loses connection with the application or connection
65
- * is re-established. This can be useful if you want to handle the case where the user quits IBM Aspera
66
- * after `init` has already been called, and want to prompt the user to relaunch the application.
67
- *
68
- * @param callback callback function to receive events
69
- *
70
- * @returns ID representing the callback for deregistration purposes
71
- */
72
- export declare const registerStatusCallback: (callback: (status: WebsocketEvent) => void) => string;
73
- /**
74
- * Remove a callback from getting connection status events.
75
- *
76
- * @param id the ID returned by `registerStatusCallback`
77
- */
78
- export declare const deregisterStatusCallback: (id: string) => void;
79
- /**
80
- * Remove a transfer. This will stop the transfer if it is in progress.
81
- *
82
- * @param id transfer uuid
83
- *
84
- * @returns a promise that resolves if transfer is removed and rejects if transfer cannot be removed
85
- */
86
- export declare const removeTransfer: (id: string) => Promise<any>;
87
- /**
88
- * Stop a transfer.
89
- *
90
- * @param id transfer uuid
91
- *
92
- * @returns a promise that resolves if transfer is stopped and rejects if transfer cannot be stopped
93
- */
94
- export declare const stopTransfer: (id: string) => Promise<any>;
95
- /**
96
- * Resume a paused or failed transfer.
97
- *
98
- * @param id transfer uuid
99
- * @param options resume transfer options
100
- *
101
- * @returns a promise that resolves with the new transfer object if transfer is resumed
102
- */
103
- export declare const resumeTransfer: (id: string, options?: ResumeTransferOptions) => Promise<AsperaSdkTransfer>;
104
- /**
105
- * Displays a file browser dialog for the user to select files.
106
- *
107
- * @param options file dialog options
108
- *
109
- * @returns a promise that resolves with the selected file(s) and rejects if user cancels dialog
110
- */
111
- export declare const showSelectFileDialog: (options?: FileDialogOptions) => Promise<DataTransferResponse>;
112
- /**
113
- * Displays a folder browser dialog for the user to select folders.
114
- *
115
- * @param options folder dialog options
116
- *
117
- * @returns a promise that resolves with the selected folder(s) and rejects if user cancels dialog
118
- */
119
- export declare const showSelectFolderDialog: (options?: FolderDialogOptions) => Promise<DataTransferResponse>;
120
- /**
121
- * Opens the IBM Aspera preferences page.
122
- *
123
- * @returns a promise that resolves when the preferences page is opened.
124
- */
125
- export declare const showPreferences: () => Promise<any>;
126
- /**
127
- * Get all transfers associated with the current application.
128
- *
129
- * @returns a promise that resolves with an array of transfers.
130
- */
131
- export declare const getAllTransfers: () => Promise<AsperaSdkTransfer[]>;
132
- /**
133
- * Get a specific transfer by ID.
134
- *
135
- * @param id transfer uuid
136
- *
137
- * @returns a promise that resolves with the transfer.
138
- */
139
- export declare const getTransfer: (id: string) => Promise<AsperaSdkTransfer>;
140
- /**
141
- * Opens and highlights the downloaded file in Finder or Windows Explorer. If multiple files,
142
- * then only the first file will be selected.
143
- *
144
- * @param id transfer uuid
145
- *
146
- * @returns a promise that resolves if the file can be shown and rejects if not
147
- */
148
- export declare const showDirectory: (id: string) => Promise<any>;
149
- /**
150
- * Modify the speed of a running transfer.
151
- *
152
- * @param id transfer uuid
153
- * @param options transfer rate options
154
- *
155
- * @returns a promise that resolves if the transfer rate can be modified and rejects if not
156
- */
157
- export declare const modifyTransfer: (id: string, options: ModifyTransferOptions) => Promise<AsperaSdkTransfer>;
158
- /**
159
- * Set the custom branding template to be used by IBM Aspera. If the app is already
160
- * configured to use a different branding, then the branding template you specify will be
161
- * stored by the app, allowing the end user to switch at any point.
162
- *
163
- * @param id custom branding template id. This should be consistent across page loads.
164
- * @param options custom branding options
165
- *
166
- * @returns a promise that resolves if the branding was properly set.
167
- */
168
- export declare const setBranding: (id: string, options: CustomBrandingOptions) => Promise<any>;
169
- /**
170
- * Create a dropzone for the given element selector.
171
- *
172
- * @param callback the function to call once the files are dropped
173
- * @param elementSelector the selector of the element on the page that should watch for drop events
174
- * @param connectOptions options for connect
175
- */
176
- export declare const createDropzone: (callback: (data: {
177
- event: DragEvent;
178
- files: DataTransferResponse;
179
- }) => void, elementSelector: string, connectOptions?: ConnectTypes.DragDropOptions) => void;
180
- /**
181
- * Remove dropzone.
182
- *
183
- * @param elementSelector the selector of the element on the page that should remove
184
- */
185
- export declare const removeDropzone: (elementSelector: string) => void;
186
- /**
187
- * Get metadata about the IBM Aspera installation.
188
- *
189
- * @returns a promise that returns information about the user's IBM Aspera installation.
190
- */
191
- export declare const getInfo: () => Promise<AsperaSdkInfo>;