@ibm-aspera/sdk 0.11.0 → 0.19.0

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/README.md CHANGED
@@ -20,6 +20,7 @@ To include this SDK via `script` tag directly in your web application's HTML, re
20
20
  ```html
21
21
  <script src="https://cdn.jsdelivr.net/npm/@ibm-aspera/sdk@0.2.30/dist/js/aspera-sdk.js"></script>
22
22
  ```
23
+ Check npmjs.com for the latest version (https://www.npmjs.com/package/@ibm-aspera/sdk).
23
24
 
24
25
  ## Usage
25
26
 
@@ -1,5 +1,5 @@
1
1
  import { AsperaSdkInfo, TransferResponse } from '../models/aspera-sdk.model';
2
- import { CustomBrandingOptions, DataTransferResponse, DropzoneEventData, DropzoneOptions, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, InitOptions, ModifyTransferOptions, Pagination, PaginatedFilesResponse, ResumeTransferOptions, TransferSpec, WebsocketEvent, ReadChunkAsArrayBufferResponse, ReadAsArrayBufferResponse, SdkCapabilities, GetChecksumOptions, ChecksumFileResponse, ReadDirectoryOptions, ReadDirectoryResponse } from '../models/models';
2
+ import { CustomBrandingOptions, DataTransferResponse, DropzoneEventData, DropzoneOptions, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, SaveFileDialogOptions, InitOptions, ModifyTransferOptions, Pagination, PaginatedFilesResponse, ResumeTransferOptions, TransferSpec, ReadChunkAsArrayBufferResponse, ReadAsArrayBufferResponse, SdkCapabilities, SdkStatus, GetChecksumOptions, ChecksumFileResponse, ReadDirectoryOptions, ReadDirectoryResponse, ShowPreferencesPageOptions, TestSshPortsOptions } from '../models/models';
3
3
  /**
4
4
  * Check if IBM Aspera for Desktop connection works. This function is called by init
5
5
  * when initializing the SDK. This function can be used at any point for checking.
@@ -16,24 +16,149 @@ export declare const testConnection: () => Promise<any>;
16
16
  */
17
17
  export declare const initDragDrop: (initCall?: boolean) => Promise<boolean>;
18
18
  /**
19
- * Initialize IBM Aspera client. If client cannot (reject/catch), then
20
- * client should attempt fixing server URL or trying again. If still fails disable UI elements.
19
+ * Get the current SDK lifecycle status synchronously.
21
20
  *
22
- * @param options initialization options:
21
+ * @returns the current status, or undefined if no init has been called yet
22
+ */
23
+ export declare const getStatus: () => SdkStatus | undefined;
24
+ /**
25
+ * Initialize the SDK and connect to a transfer client. Returns a promise that resolves
26
+ * when the transfer client is ready, or rejects if it cannot be reached.
27
+ *
28
+ * By default, the SDK connects to IBM Aspera for desktop. Set `connectSettings.useConnect`
29
+ * to use IBM Aspera Connect instead. If `httpGatewaySettings` is provided, the gateway is
30
+ * set up first — when `forceGateway` is true it becomes the sole transport; when false it
31
+ * is set up as a supplementary transport and the primary client (Desktop or Connect) is
32
+ * still initialized afterward.
33
+ *
34
+ * Note that the promise behavior varies by transfer client. For Desktop, the promise
35
+ * remains pending until the application is detected. For Connect, the promise resolves
36
+ * immediately after initialization begins — use {@link registerStatusCallback} to track
37
+ * when Connect is actually ready. For a non-blocking alternative that provides consistent
38
+ * lifecycle status events across all transfer clients, see {@link initSession}.
23
39
  *
24
- * - `appId` the unique ID for the website. Transfers initiated during this session
25
- * will be associated with this ID. It is recommended to use a unique ID to keep transfer
26
- * information private from other websites.
40
+ * @param options - Initialization options. See {@link InitOptions}.
27
41
  *
28
- * - `supportMultipleUsers` when enabled (defaults to false), the SDK will iterate over a port
29
- * range and generate a session id to determine the running instance of the desktop app for the
30
- * current user. This is needed when multiple users may be logged into the same machine
31
- * simultaneously, for example on a Windows Server.
42
+ * @returns a promise that resolves with SDK metadata when the transfer client is ready
32
43
  *
33
- * @returns a promise that resolves if IBM Aspera Desktop is running properly or
34
- * rejects if unable to connect
44
+ * @example
45
+ * init({ appId: 'my-app' })
46
+ * .then(() => {
47
+ * // Transfer client is ready — enable UI
48
+ * })
49
+ * .catch(error => {
50
+ * // Could not connect — prompt user to install or launch
51
+ * });
35
52
  */
36
53
  export declare const init: (options?: InitOptions) => Promise<any>;
54
+ /**
55
+ * Initialize the SDK and begin detecting a transfer client. This function returns
56
+ * immediately — lifecycle status is communicated asynchronously via {@link registerStatusCallback}.
57
+ *
58
+ * The SDK supports three transfer clients. By default, IBM Aspera for desktop is used.
59
+ * Set `connectSettings.useConnect` to use IBM Aspera Connect instead. Desktop and Connect
60
+ * are mutually exclusive — one or the other is detected, not both.
61
+ *
62
+ * ## HTTP Gateway
63
+ *
64
+ * HTTP Gateway is a server-side component that enables browser-based transfers without
65
+ * a desktop application. It can be used in two modes:
66
+ *
67
+ * - **Sole transport** (`forceGateway: true`): HTTP Gateway is the only transport.
68
+ * No Desktop or Connect detection occurs. Status transitions to `RUNNING` when the
69
+ * gateway responds successfully, or `FAILED` if it does not.
70
+ *
71
+ * - **Supplementary transport** (`forceGateway: false`): HTTP Gateway is set up first
72
+ * as an additional transport for browser-based uploads and downloads. The primary
73
+ * transfer client (Desktop or Connect) is then detected separately. If HTTP Gateway
74
+ * setup fails, the primary client is still detected. Features that require a desktop
75
+ * application (native file dialogs, drag and drop, etc.) are only available when the
76
+ * primary client is running.
77
+ *
78
+ * ## Status lifecycle
79
+ *
80
+ * Use {@link registerStatusCallback} to receive status updates. Use {@link getStatus} to
81
+ * read the current status synchronously at any time.
82
+ *
83
+ * **Desktop path**: `INITIALIZING` → `RUNNING` (app detected), `DEGRADED` (timeout but
84
+ * HTTP Gateway is available as a supplementary transport), or `FAILED` (timeout, no
85
+ * fallback). Detection continues in the background after `DEGRADED` or `FAILED` — if the
86
+ * user launches the app later, the status transitions to `RUNNING`.
87
+ *
88
+ * **Connect path**: `INITIALIZING` → `RUNNING`, `FAILED`, `OUTDATED`, or
89
+ * `EXTENSION_INSTALL` depending on the state of the Connect browser extension
90
+ * and application.
91
+ *
92
+ * **HTTP Gateway path** (`forceGateway: true`): `INITIALIZING` → `RUNNING` or `FAILED`.
93
+ *
94
+ * @param options - Initialization options. See {@link InitOptions}.
95
+ *
96
+ * @example
97
+ * // Detect IBM Aspera for desktop (default)
98
+ * initSession({ appId: 'my-app' });
99
+ *
100
+ * @example
101
+ * // Detect IBM Aspera for desktop with status handling
102
+ * registerStatusCallback(status => {
103
+ * if (status === 'RUNNING') {
104
+ * // Transfer client is ready — enable UI
105
+ * } else if (status === 'FAILED') {
106
+ * // Not detected — prompt user to install or launch
107
+ * }
108
+ * });
109
+ *
110
+ * initSession({ appId: 'my-app' });
111
+ *
112
+ * @example
113
+ * // Use IBM Aspera Connect
114
+ * initSession({
115
+ * appId: 'my-app',
116
+ * connectSettings: {
117
+ * useConnect: true,
118
+ * },
119
+ * });
120
+ *
121
+ * @example
122
+ * // Use HTTP Gateway as the sole transport (no desktop app needed)
123
+ * initSession({
124
+ * appId: 'my-app',
125
+ * httpGatewaySettings: {
126
+ * url: 'https://example.com/aspera/http-gwy',
127
+ * forceGateway: true,
128
+ * },
129
+ * });
130
+ *
131
+ * @example
132
+ * // HTTP Gateway as supplementary transport with Desktop as primary
133
+ * initSession({
134
+ * appId: 'my-app',
135
+ * httpGatewaySettings: {
136
+ * url: 'https://example.com/aspera/http-gwy',
137
+ * forceGateway: false,
138
+ * },
139
+ * });
140
+ */
141
+ export declare const initSession: (options?: InitOptions) => void;
142
+ /**
143
+ * Tests SSH port connectivity to a transfer server.
144
+ *
145
+ * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway.
146
+ *
147
+ * @param options options including the remote host, SSH port, and timeout.
148
+ *
149
+ * @returns a promise that resolves if the SSH port test is successful and rejects otherwise.
150
+ */
151
+ export declare const testSshPorts: (options: TestSshPortsOptions) => Promise<any>;
152
+ /**
153
+ * Authenticates a transfer specification against the remote server.
154
+ *
155
+ * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway.
156
+ *
157
+ * @param transferSpec the transfer specification to authenticate.
158
+ *
159
+ * @returns a promise that resolves if authentication is successful and rejects otherwise.
160
+ */
161
+ export declare const authenticate: (transferSpec: TransferSpec) => Promise<any>;
37
162
  /**
38
163
  * Start a transfer
39
164
  *
@@ -58,17 +183,45 @@ export declare const registerActivityCallback: (callback: (transfers: TransferRe
58
183
  */
59
184
  export declare const deregisterActivityCallback: (id: string) => void;
60
185
  /**
61
- * Register a callback for getting updates about the connection status of IBM Aspera SDK.
186
+ * Register a callback for SDK lifecycle status changes. The callback fires immediately
187
+ * with the current status (if one exists) and again whenever the status changes.
188
+ *
189
+ * Status values:
62
190
  *
63
- * For example, to be notified of when the SDK loses connection with the application or connection
64
- * is re-established. This can be useful if you want to handle the case where the user quits IBM Aspera
65
- * after `init` has already been called, and want to prompt the user to relaunch the application.
191
+ * - `INITIALIZING` The SDK is detecting a transfer client.
192
+ * - `RUNNING` A transfer client is ready. Full functionality is available.
193
+ * - `DEGRADED` The primary transfer client (IBM Aspera for desktop) was not detected, but HTTP
194
+ * Gateway is available as a fallback. This is only available if XXX...
195
+ * - `FAILED` — No transfer client could be reached. This could be because the user does
196
+ * not have a transfer client installed, it is not running, or in the case of HTTP Gateway,
197
+ * it was not reachable.
198
+ * - `DISCONNECTED` — The transfer client was previously running but lost connection. This is specific
199
+ * to IBM Aspera for desktop. For example, if the user quits the app this status will trigger.
200
+ * - `OUTDATED` — (Connect only) The Connect installation needs updating.
201
+ * - `EXTENSION_INSTALL` — (Connect only) The browser extension needs to be installed.
66
202
  *
67
- * @param callback callback function to receive events
203
+ * For IBM Aspera for desktop, detection continues in the background after `FAILED` or `DEGRADED`.
204
+ * If the user launches the application later, the status transitions to `RUNNING`.
205
+ *
206
+ * @param callback callback function to receive status events
68
207
  *
69
208
  * @returns ID representing the callback for deregistration purposes
209
+ *
210
+ * @example
211
+ * const id = registerStatusCallback(status => {
212
+ * if (status === 'RUNNING') {
213
+ * // Full functionality — enable all UI
214
+ * } else if (status === 'DEGRADED') {
215
+ * // Transfers work via HTTP Gateway
216
+ * } else if (status === 'FAILED') {
217
+ * // Nothing available — prompt user to install
218
+ * }
219
+ * });
220
+ *
221
+ * // Later, to stop listening:
222
+ * deregisterStatusCallback(id);
70
223
  */
71
- export declare const registerStatusCallback: (callback: (status: WebsocketEvent) => void) => string;
224
+ export declare const registerStatusCallback: (callback: (status: SdkStatus) => void) => string;
72
225
  /**
73
226
  * Remove a callback from getting connection status events.
74
227
  *
@@ -116,6 +269,16 @@ export declare const showSelectFileDialog: (options?: FileDialogOptions) => Prom
116
269
  * @returns a promise that resolves with the selected folder(s) and rejects if user cancels dialog
117
270
  */
118
271
  export declare const showSelectFolderDialog: (options?: FolderDialogOptions) => Promise<DataTransferResponse>;
272
+ /**
273
+ * Displays a save file dialog for the user to choose a save location and filename.
274
+ *
275
+ * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway.
276
+ *
277
+ * @param options save file dialog options
278
+ *
279
+ * @returns a promise that resolves with the selected save path and rejects if user cancels dialog
280
+ */
281
+ export declare const showSaveFileDialog: (options?: SaveFileDialogOptions) => Promise<DataTransferResponse>;
119
282
  /**
120
283
  * Shows the about page of the transfer client.
121
284
  *
@@ -138,6 +301,26 @@ export declare const showPreferences: () => Promise<any>;
138
301
  * @returns a promise that resolves when the transfer manager is opened.
139
302
  */
140
303
  export declare const showTransferManager: () => Promise<any>;
304
+ /**
305
+ * Opens the preferences page of the transfer client to a specific tab.
306
+ *
307
+ * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway.
308
+ *
309
+ * @param options options including the page (tab) to open
310
+ *
311
+ * @returns a promise that resolves when the preferences page is opened.
312
+ */
313
+ export declare const showPreferencesPage: (options: ShowPreferencesPageOptions) => Promise<any>;
314
+ /**
315
+ * Opens the transfer rate monitor graph for a specific transfer.
316
+ *
317
+ * Supported for Connect and IBM Aspera for desktop. Not supported for HTTP Gateway.
318
+ *
319
+ * @param transferId the unique identifier of the transfer to monitor.
320
+ *
321
+ * @returns a promise that resolves when the transfer monitor is opened.
322
+ */
323
+ export declare const showTransferMonitor: (transferId: string) => Promise<any>;
141
324
  /**
142
325
  * Get all transfers associated with the current application.
143
326
  *