@ibm-aspera/sdk 0.2.29 → 0.4.12

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 (113) hide show
  1. package/README.md +17 -13
  2. package/dist/commonjs/app/core.d.ts +234 -0
  3. package/dist/commonjs/app/core.js +812 -0
  4. package/dist/commonjs/app/installer.d.ts +9 -0
  5. package/dist/commonjs/app/installer.js +50 -0
  6. package/dist/commonjs/connect/core.d.ts +11 -0
  7. package/dist/commonjs/connect/core.js +73 -0
  8. package/dist/commonjs/constants/constants.d.ts +8 -0
  9. package/dist/commonjs/constants/constants.js +11 -0
  10. package/dist/commonjs/constants/messages.d.ts +38 -0
  11. package/dist/commonjs/constants/messages.js +41 -0
  12. package/dist/commonjs/helpers/client/client.d.ts +5 -0
  13. package/dist/commonjs/helpers/client/client.js +7 -0
  14. package/dist/commonjs/helpers/client/http-client.d.ts +42 -0
  15. package/dist/commonjs/helpers/client/http-client.js +84 -0
  16. package/dist/commonjs/helpers/client/safari-client.d.ts +101 -0
  17. package/dist/commonjs/helpers/client/safari-client.js +264 -0
  18. package/dist/commonjs/helpers/helpers.d.ts +109 -0
  19. package/dist/commonjs/helpers/helpers.js +249 -0
  20. package/dist/commonjs/helpers/http.d.ts +16 -0
  21. package/dist/commonjs/helpers/http.js +42 -0
  22. package/dist/commonjs/helpers/ws.d.ts +62 -0
  23. package/dist/commonjs/helpers/ws.js +161 -0
  24. package/dist/commonjs/http-gateway/core.d.ts +98 -0
  25. package/dist/commonjs/http-gateway/core.js +388 -0
  26. package/dist/commonjs/http-gateway/download.d.ts +14 -0
  27. package/dist/commonjs/http-gateway/download.js +187 -0
  28. package/dist/commonjs/http-gateway/index.d.ts +11 -0
  29. package/dist/commonjs/http-gateway/index.js +11 -0
  30. package/dist/commonjs/http-gateway/models.d.ts +16 -0
  31. package/dist/commonjs/http-gateway/models.js +2 -0
  32. package/dist/commonjs/http-gateway/upload.d.ts +14 -0
  33. package/dist/commonjs/http-gateway/upload.js +124 -0
  34. package/dist/commonjs/index.d.ts +12 -0
  35. package/dist/commonjs/index.js +109 -0
  36. package/dist/commonjs/models/aspera-sdk.model.d.ts +259 -0
  37. package/dist/commonjs/models/aspera-sdk.model.js +349 -0
  38. package/dist/commonjs/models/models.d.ts +760 -0
  39. package/dist/commonjs/models/models.js +2 -0
  40. package/dist/js/aspera-sdk.js +3 -0
  41. package/dist/js/aspera-sdk.js.LICENSE.txt +15 -0
  42. package/dist/js/aspera-sdk.js.map +1 -0
  43. package/package.json +8 -5
  44. package/.editorconfig +0 -13
  45. package/.github/CODEOWNERS +0 -1
  46. package/.github/CODE_OF_CONDUCT.md +0 -128
  47. package/.github/CONTRIBUTING.md +0 -147
  48. package/.github/dependabot.yml +0 -10
  49. package/.github/workflows/ci.yml +0 -39
  50. package/.github/workflows/documentation.yml +0 -44
  51. package/.github/workflows/publish.yml +0 -23
  52. package/.github/workflows/version.yml +0 -32
  53. package/.whitesource +0 -3
  54. package/CHANGELOG.md +0 -204
  55. package/docs/DEVELOPMENT.md +0 -38
  56. package/eslint.config.js +0 -104
  57. package/example/README.md +0 -7
  58. package/example/index.html +0 -14
  59. package/example/package-lock.json +0 -2989
  60. package/example/package.json +0 -30
  61. package/example/public/404.html +0 -5
  62. package/example/public/sdk-code.js +0 -326
  63. package/example/src/App/App.scss +0 -40
  64. package/example/src/App/index.tsx +0 -196
  65. package/example/src/Views/AllTogether.tsx +0 -26
  66. package/example/src/Views/DragDrop.tsx +0 -23
  67. package/example/src/Views/Home.tsx +0 -10
  68. package/example/src/Views/Initialize.tsx +0 -31
  69. package/example/src/Views/Installer.tsx +0 -154
  70. package/example/src/Views/MonitorTransfers.tsx +0 -88
  71. package/example/src/Views/Other.tsx +0 -24
  72. package/example/src/Views/SelectItems.tsx +0 -46
  73. package/example/src/Views/StartTransfer.tsx +0 -37
  74. package/example/src/Views/Test.tsx +0 -20
  75. package/example/src/Views/Views.scss +0 -111
  76. package/example/src/helpers/index.ts +0 -19
  77. package/example/src/index.scss +0 -47
  78. package/example/src/main.tsx +0 -17
  79. package/example/src/vite-env.d.ts +0 -2
  80. package/example/tsconfig.json +0 -30
  81. package/example/vite.config.ts +0 -23
  82. package/jest.config.js +0 -19
  83. package/jest.setup.js +0 -0
  84. package/renovate.json +0 -12
  85. package/src/app/core.ts +0 -765
  86. package/src/app/installer.ts +0 -53
  87. package/src/connect/core.ts +0 -83
  88. package/src/constants/constants.ts +0 -19
  89. package/src/constants/messages.ts +0 -35
  90. package/src/helpers/client/client.ts +0 -11
  91. package/src/helpers/client/http-client.ts +0 -92
  92. package/src/helpers/client/safari-client.ts +0 -334
  93. package/src/helpers/helpers.ts +0 -253
  94. package/src/helpers/http.ts +0 -39
  95. package/src/helpers/ws.ts +0 -191
  96. package/src/http-gateway/core.ts +0 -273
  97. package/src/http-gateway/download.ts +0 -217
  98. package/src/http-gateway/index.ts +0 -19
  99. package/src/http-gateway/models.ts +0 -20
  100. package/src/http-gateway/upload.ts +0 -148
  101. package/src/index.ts +0 -72
  102. package/src/models/aspera-sdk.model.ts +0 -446
  103. package/src/models/models.ts +0 -740
  104. package/tests/client.spec.ts +0 -52
  105. package/tests/core.spec.ts +0 -13
  106. package/tests/helpers.spec.ts +0 -127
  107. package/tests/http.spec.ts +0 -14
  108. package/tests/installer.spec.ts +0 -135
  109. package/tests/mocks.ts +0 -11
  110. package/tsconfig.json +0 -14
  111. package/tsconfig.module.json +0 -16
  112. package/typedoc.js +0 -7
  113. package/webpack.config.js +0 -35
package/README.md CHANGED
@@ -1,7 +1,12 @@
1
1
  # IBM Aspera JavaScript SDK
2
- This JavaScript SDK allows web applications to integrate with `IBM Aspera for desktop` to perform high-speed Aspera file transfers.
2
+ This JavaScript SDK allows web applications to integrate with Aspera transfer clients to perform high-speed Aspera file transfers.
3
3
 
4
- Documentation is available on [GitHub Pages](https://ibm.github.io/aspera-sdk-js/docs/)
4
+ Supported transfer clients:
5
+ - IBM Aspera for desktop
6
+ - IBM Aspera HTTP Gateway
7
+ - IBM Aspera Connect
8
+
9
+ Example code is available on [GitHub Pages](https://ibm.github.io/aspera-sdk-js) with TypeDoc documentation [here](https://ibm.github.io/aspera-sdk-js/docs/).
5
10
 
6
11
  ## Installation
7
12
  Install via npm:
@@ -10,19 +15,18 @@ Install via npm:
10
15
  $ npm install --save @ibm-aspera/sdk
11
16
  ```
12
17
 
13
- Install from source:
18
+ To include this SDK via `script` tag directly in your web application's HTML, refer to third-party CDNs such as jsDelivr:
14
19
 
15
- ```shell
16
- $ git clone https://github.com/IBM/aspera-sdk-js.git
17
- $ cd aspera-sdk-js
18
- $ npm install
20
+ ```html
21
+ <script src="https://cdn.jsdelivr.net/npm/@ibm-aspera/sdk@0.2.30/dist/js/aspera-sdk.js"></script>
19
22
  ```
20
23
 
21
- When installing from source, the `dist` directory includes a `js` directory that contains the bundled JavaScript SDK that can be included via `script` tag
22
- or copied to a web server for hosting.
24
+ ## Usage
25
+
26
+ The full API of this SDK can be found [here](https://ibm.github.io/aspera-sdk-js/docs/) with many [code examples](https://github.com/IBM/aspera-sdk-js/blob/main/examples).
27
+
28
+ Along with the examples, you can find an example test application [here](https://ibm.github.io/aspera-sdk-js/all).
23
29
 
24
- ## Development
25
- To get started with development, take a look [here](https://github.com/IBM/aspera-sdk-js/blob/main/docs/DEVELOPMENT.md).
30
+ ## Migration from Connect SDK
26
31
 
27
- ## Code Example and test application
28
- You can run the test appp by running `npm run start:example` which will launch the browser to the test app.
32
+ Refer to [MIGRATION](MIGRATION.md) for recommended changes when migrating your web application from the Connect SDK (`@ibm-aspera/connect-sdk-js`).
@@ -0,0 +1,234 @@
1
+ import { AsperaSdkInfo, TransferResponse } from '../models/aspera-sdk.model';
2
+ import { CustomBrandingOptions, DataTransferResponse, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, InitOptions, ModifyTransferOptions, ResumeTransferOptions, TransferSpec, WebsocketEvent, ReadChunkAsArrayBufferResponse, ReadAsArrayBufferResponse, SdkCapabilities } 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>;
192
+ /**
193
+ * Read an entire file as an array buffer (base64-encoded).
194
+ *
195
+ * Note: The maximum file size allowed is 50 MiB.
196
+ *
197
+ * @param path path to the file to read
198
+ *
199
+ * @returns a promise that resolves with the file data as a base64-encoded string and mime type
200
+ */
201
+ export declare const readAsArrayBuffer: (path: string) => Promise<ReadAsArrayBufferResponse>;
202
+ /**
203
+ * Read a chunk of a file as an array buffer (base64-encoded).
204
+ *
205
+ * Note: The maximum chunk size allowed is 50 MiB.
206
+ *
207
+ * @param path path to the file to read
208
+ * @param offset offset to start reading the file, in bytes
209
+ * @param chunkSize the size of the chunk to read, in bytes
210
+ *
211
+ * @returns a promise that resolves with the file chunk data as a base64-encoded string and mime type
212
+ */
213
+ export declare const readChunkAsArrayBuffer: (path: string, offset: number, chunkSize: number) => Promise<ReadChunkAsArrayBufferResponse>;
214
+ /**
215
+ * Returns an object describing the high-level capabilities supported by the user's
216
+ * transfer client (e.g. IBM Aspera for desktop, Connect, or HTTP Gateway).
217
+ *
218
+ * Use this for feature detection at a semantic level rather than checking individual RPC methods.
219
+ * Capabitilies may depend on multiple underlying RPC methods and also may vary by transfer client.
220
+ *
221
+ * Some capabitilies may depend on newer versions of the transfer client. This function may be useful
222
+ * if you want to conditionally perform certain actions rather than potentially getting an error.
223
+ *
224
+ * @returns an object with boolean flags for each capability.
225
+ *
226
+ * @example
227
+ * // Conditionally render UI based on capabilities
228
+ * const caps = asperaSdk.getCapabilities();
229
+ * // Determine if your web application can render image previews for user selected files
230
+ * if (caps.imagePreview) {
231
+ * asperaSdk.readAsArrayBuffer(path);
232
+ * }
233
+ */
234
+ export declare const getCapabilities: () => SdkCapabilities;