@ibm-aspera/sdk 0.19.0 → 0.20.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.
Files changed (45) hide show
  1. package/dist/commonjs/app/core.d.ts +43 -17
  2. package/dist/commonjs/app/core.js +144 -28
  3. package/dist/commonjs/app/status.d.ts +11 -1
  4. package/dist/commonjs/app/status.js +35 -4
  5. package/dist/commonjs/connect/core.js +3 -0
  6. package/dist/commonjs/helpers/connect-extension.d.ts +8 -0
  7. package/dist/commonjs/helpers/connect-extension.js +58 -0
  8. package/dist/commonjs/helpers/helpers.d.ts +6 -0
  9. package/dist/commonjs/helpers/helpers.js +19 -1
  10. package/dist/commonjs/helpers/ws.d.ts +16 -0
  11. package/dist/commonjs/helpers/ws.js +49 -2
  12. package/dist/commonjs/http-gateway/core.js +10 -12
  13. package/dist/commonjs/http-gateway/download.js +2 -2
  14. package/dist/commonjs/http-gateway/upload.js +2 -2
  15. package/dist/commonjs/http-gateway/v2/app/core.d.ts +84 -0
  16. package/dist/commonjs/http-gateway/v2/app/core.js +170 -0
  17. package/dist/commonjs/http-gateway/v2/app/download.d.ts +15 -0
  18. package/dist/commonjs/http-gateway/v2/app/download.js +68 -0
  19. package/dist/commonjs/http-gateway/v2/app/upload.d.ts +169 -0
  20. package/dist/commonjs/http-gateway/v2/app/upload.js +601 -0
  21. package/dist/commonjs/http-gateway/v2/constants/constants.d.ts +6 -0
  22. package/dist/commonjs/http-gateway/v2/constants/constants.js +9 -0
  23. package/dist/commonjs/http-gateway/v2/constants/messages.d.ts +35 -0
  24. package/dist/commonjs/http-gateway/v2/constants/messages.js +38 -0
  25. package/dist/commonjs/http-gateway/v2/helpers/helpers.d.ts +121 -0
  26. package/dist/commonjs/http-gateway/v2/helpers/helpers.js +294 -0
  27. package/dist/commonjs/http-gateway/v2/helpers/http.d.ts +86 -0
  28. package/dist/commonjs/http-gateway/v2/helpers/http.js +153 -0
  29. package/dist/commonjs/http-gateway/v2/index.d.ts +35 -0
  30. package/dist/commonjs/http-gateway/v2/index.js +70 -0
  31. package/dist/commonjs/http-gateway/v2/models/http-gateway-global.model.d.ts +254 -0
  32. package/dist/commonjs/http-gateway/v2/models/http-gateway-global.model.js +367 -0
  33. package/dist/commonjs/http-gateway/v2/models/models.d.ts +127 -0
  34. package/dist/commonjs/http-gateway/v2/models/models.js +87 -0
  35. package/dist/commonjs/index.d.ts +3 -3
  36. package/dist/commonjs/index.js +3 -1
  37. package/dist/commonjs/models/aspera-sdk.model.d.ts +2 -1
  38. package/dist/commonjs/models/aspera-sdk.model.js +8 -0
  39. package/dist/commonjs/models/models.d.ts +10 -1
  40. package/dist/js/aspera-sdk.js +1 -1
  41. package/dist/js/aspera-sdk.js.LICENSE.txt +1 -1
  42. package/dist/js/aspera-sdk.js.map +1 -1
  43. package/package.json +1 -2
  44. package/scripts/release.sh +7 -7
  45. package/scripts/version.sh +24 -15
@@ -0,0 +1,35 @@
1
+ import { HttpGateway } from './models/http-gateway-global.model';
2
+ export declare const asperaHttpGateway: HttpGateway;
3
+ export { initHttpGateway, testHttpGatewayConnection, registerActivityCallback, deregisterActivityCallback, getTransferById, getAllTransfers, clearNonActiveTransfers, cancelTransfer, removeTransfer } from './app/core';
4
+ export { download } from './app/download';
5
+ export { upload, getFilesForUpload, getFilesForUploadPromise, getFoldersForUpload, getFoldersForUploadPromise, createDropzone, removeDropzone } from './app/upload';
6
+ declare const _default: {
7
+ asperaHttpGateway: HttpGateway;
8
+ initHttpGateway: (serverUrl: string, softwareMode?: boolean, supportMultipleServers?: boolean) => Promise<any>;
9
+ testHttpGatewayConnection: () => Promise<any>;
10
+ download: (transferSpec: import("./models/models").TransferSpec, options?: import("./models/models").DownloadOptions) => Promise<any>;
11
+ upload: (transferSpec: import("./models/models").TransferSpec, id: string, memoryFilesToLoad?: File[], options?: import("./models/models").UploadOptions) => Promise<any>;
12
+ getFilesForUpload: (callback: (data: import("./models/models").DataTransferResponse) => void, id: string) => void;
13
+ getFilesForUploadPromise: (id: string) => Promise<import("./models/models").DataTransferResponse>;
14
+ getFoldersForUpload: (callback: (data: import("./models/models").DataTransferResponse) => void, id: string) => void;
15
+ getFoldersForUploadPromise: (id: string) => Promise<import("./models/models").DataTransferResponse>;
16
+ createDropzone: (callback: (data: {
17
+ event: any;
18
+ files: {
19
+ dataTransfer: {
20
+ files: import("./models/models").ConnectStyleFile[];
21
+ };
22
+ };
23
+ }) => void, elementSelector: string) => void;
24
+ removeDropzone: (elementSelector: string) => void;
25
+ registerActivityCallback: (callback: (transfers: import("./models/http-gateway-global.model").TransferResponse) => void) => string;
26
+ deregisterActivityCallback: (id: string) => void;
27
+ getTransferById: (id: string) => {
28
+ transfer_info: import("./models/models").HttpTransfer;
29
+ };
30
+ getAllTransfers: () => import("./models/http-gateway-global.model").TransferResponse;
31
+ clearNonActiveTransfers: () => void;
32
+ removeTransfer: (id: string) => void;
33
+ cancelTransfer: (id: string) => void;
34
+ };
35
+ export default _default;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeDropzone = exports.createDropzone = exports.getFoldersForUploadPromise = exports.getFoldersForUpload = exports.getFilesForUploadPromise = exports.getFilesForUpload = exports.upload = exports.download = exports.removeTransfer = exports.cancelTransfer = exports.clearNonActiveTransfers = exports.getAllTransfers = exports.getTransferById = exports.deregisterActivityCallback = exports.registerActivityCallback = exports.testHttpGatewayConnection = exports.initHttpGateway = exports.asperaHttpGateway = void 0;
4
+ var http_gateway_global_model_1 = require("./models/http-gateway-global.model");
5
+ var core_1 = require("./app/core");
6
+ var download_1 = require("./app/download");
7
+ var upload_1 = require("./app/upload");
8
+ exports.asperaHttpGateway = new http_gateway_global_model_1.HttpGateway();
9
+ exports.asperaHttpGateway.initHttpGateway = core_1.initHttpGateway;
10
+ exports.asperaHttpGateway.testHttpGatewayConnection = core_1.testHttpGatewayConnection;
11
+ exports.asperaHttpGateway.download = download_1.download;
12
+ exports.asperaHttpGateway.upload = upload_1.upload;
13
+ exports.asperaHttpGateway.getFilesForUpload = upload_1.getFilesForUpload;
14
+ exports.asperaHttpGateway.getFilesForUploadPromise = upload_1.getFilesForUploadPromise;
15
+ exports.asperaHttpGateway.getFoldersForUpload = upload_1.getFoldersForUpload;
16
+ exports.asperaHttpGateway.getFoldersForUploadPromise = upload_1.getFoldersForUploadPromise;
17
+ exports.asperaHttpGateway.createDropzone = upload_1.createDropzone;
18
+ exports.asperaHttpGateway.removeDropzone = upload_1.removeDropzone;
19
+ exports.asperaHttpGateway.registerActivityCallback = core_1.registerActivityCallback;
20
+ exports.asperaHttpGateway.deregisterActivityCallback = core_1.deregisterActivityCallback;
21
+ exports.asperaHttpGateway.getTransferById = core_1.getTransferById;
22
+ exports.asperaHttpGateway.getAllTransfers = core_1.getAllTransfers;
23
+ exports.asperaHttpGateway.clearNonActiveTransfers = core_1.clearNonActiveTransfers;
24
+ exports.asperaHttpGateway.removeTransfer = core_1.removeTransfer;
25
+ exports.asperaHttpGateway.cancelTransfer = core_1.cancelTransfer;
26
+ if (typeof window === 'object') {
27
+ window.onbeforeunload = exports.asperaHttpGateway.checkForPageLeave;
28
+ window.addEventListener('beforeunload', exports.asperaHttpGateway.checkForPageLeave);
29
+ window.asperaHttpGateway = exports.asperaHttpGateway;
30
+ }
31
+ var core_2 = require("./app/core");
32
+ Object.defineProperty(exports, "initHttpGateway", { enumerable: true, get: function () { return core_2.initHttpGateway; } });
33
+ Object.defineProperty(exports, "testHttpGatewayConnection", { enumerable: true, get: function () { return core_2.testHttpGatewayConnection; } });
34
+ Object.defineProperty(exports, "registerActivityCallback", { enumerable: true, get: function () { return core_2.registerActivityCallback; } });
35
+ Object.defineProperty(exports, "deregisterActivityCallback", { enumerable: true, get: function () { return core_2.deregisterActivityCallback; } });
36
+ Object.defineProperty(exports, "getTransferById", { enumerable: true, get: function () { return core_2.getTransferById; } });
37
+ Object.defineProperty(exports, "getAllTransfers", { enumerable: true, get: function () { return core_2.getAllTransfers; } });
38
+ Object.defineProperty(exports, "clearNonActiveTransfers", { enumerable: true, get: function () { return core_2.clearNonActiveTransfers; } });
39
+ Object.defineProperty(exports, "cancelTransfer", { enumerable: true, get: function () { return core_2.cancelTransfer; } });
40
+ Object.defineProperty(exports, "removeTransfer", { enumerable: true, get: function () { return core_2.removeTransfer; } });
41
+ var download_2 = require("./app/download");
42
+ Object.defineProperty(exports, "download", { enumerable: true, get: function () { return download_2.download; } });
43
+ var upload_2 = require("./app/upload");
44
+ Object.defineProperty(exports, "upload", { enumerable: true, get: function () { return upload_2.upload; } });
45
+ Object.defineProperty(exports, "getFilesForUpload", { enumerable: true, get: function () { return upload_2.getFilesForUpload; } });
46
+ Object.defineProperty(exports, "getFilesForUploadPromise", { enumerable: true, get: function () { return upload_2.getFilesForUploadPromise; } });
47
+ Object.defineProperty(exports, "getFoldersForUpload", { enumerable: true, get: function () { return upload_2.getFoldersForUpload; } });
48
+ Object.defineProperty(exports, "getFoldersForUploadPromise", { enumerable: true, get: function () { return upload_2.getFoldersForUploadPromise; } });
49
+ Object.defineProperty(exports, "createDropzone", { enumerable: true, get: function () { return upload_2.createDropzone; } });
50
+ Object.defineProperty(exports, "removeDropzone", { enumerable: true, get: function () { return upload_2.removeDropzone; } });
51
+ exports.default = {
52
+ asperaHttpGateway: exports.asperaHttpGateway,
53
+ initHttpGateway: core_1.initHttpGateway,
54
+ testHttpGatewayConnection: core_1.testHttpGatewayConnection,
55
+ download: download_1.download,
56
+ upload: upload_1.upload,
57
+ getFilesForUpload: upload_1.getFilesForUpload,
58
+ getFilesForUploadPromise: upload_1.getFilesForUploadPromise,
59
+ getFoldersForUpload: upload_1.getFoldersForUpload,
60
+ getFoldersForUploadPromise: upload_1.getFoldersForUploadPromise,
61
+ createDropzone: upload_1.createDropzone,
62
+ removeDropzone: upload_1.removeDropzone,
63
+ registerActivityCallback: core_1.registerActivityCallback,
64
+ deregisterActivityCallback: core_1.deregisterActivityCallback,
65
+ getTransferById: core_1.getTransferById,
66
+ getAllTransfers: core_1.getAllTransfers,
67
+ clearNonActiveTransfers: core_1.clearNonActiveTransfers,
68
+ removeTransfer: core_1.removeTransfer,
69
+ cancelTransfer: core_1.cancelTransfer,
70
+ };
@@ -0,0 +1,254 @@
1
+ import { HttpTransfer, TransferSpec, DataTransferResponse, ConnectStyleFile, FolderData } from './models';
2
+ declare class HttpGatewayGlobals {
3
+ /** The URL of the server to use with the SDK */
4
+ serverUrl: string;
5
+ /** Server information */
6
+ serverInfo: ServerInfo;
7
+ /** Chunk size to use for uploads in bytes */
8
+ chunkSize: number;
9
+ /** Indication that the server has been verified as working */
10
+ serverVerified: boolean;
11
+ /** The ID to use for HTTP Gateway needed DOM items */
12
+ mainContainerId: string;
13
+ /** The Element that is added to document for containing all items */
14
+ mainContainer: HTMLElement;
15
+ /** The ID to use for the form container for forms */
16
+ formContainerId: string;
17
+ /** The form container Element that is added to document */
18
+ formContainer: HTMLElement;
19
+ /** The ID to use for the download container */
20
+ downloadsContainerId: string;
21
+ /** The download container Element that is added to document to store download IFRAMEs */
22
+ downloadsContainer: HTMLElement;
23
+ /** Map of all forms currently in the container */
24
+ formsAvailable: Map<string, HTMLFormElement>;
25
+ /** Map of form with files from drop events */
26
+ formsFilesFromDrop: Map<string, File[]>;
27
+ /** Map of folders with files from drop events */
28
+ folderFiles: Map<string, Map<string, FolderData>>;
29
+ /** Indicates if running in software mode (no DOM) */
30
+ softwareMode: boolean;
31
+ /** Indicates if multiple server support should be used (will not lock out if gateway server is not working) */
32
+ supportMultipleServers: boolean;
33
+ /** Number of concurrent uploads to support */
34
+ concurrentUploads: number;
35
+ /** Map of dropzones created by querySelector */
36
+ dropzonesCreated: Map<string, {
37
+ event: string;
38
+ callback: (event: any) => void;
39
+ }[]>;
40
+ /**
41
+ * Add a form item to the form container for transferring if form already exists the existing one is returned
42
+ *
43
+ * @param id ID to use for the form reference
44
+ */
45
+ createOrUseForm(id: string): HTMLFormElement;
46
+ /**
47
+ * Delete a form from the container by the ID
48
+ *
49
+ * @param id the form to delete
50
+ */
51
+ deleteFormFromContainer(id: string): void;
52
+ /**
53
+ * Removes all forms from the Parent container
54
+ */
55
+ removeAllFormsFromContainer(): void;
56
+ /**
57
+ * Get or create an array of Files to store drop events in
58
+ *
59
+ * @param id the form to associate the files with
60
+ */
61
+ getOrCreateFormFileListFromDrop(id: string): File[];
62
+ /**
63
+ * Get or create an array of Folder data to store folder entries
64
+ *
65
+ * @param id the form to associate the folders with
66
+ */
67
+ getOrCreateFolderDataList(id: string): Map<string, FolderData>;
68
+ /**
69
+ * Setup HTTP Gateway SDK server and formContainer
70
+ *
71
+ * @param serverUrl URL to use for the server
72
+ * @param softwareMode indicate if software mode is in use
73
+ * @param supportMultipleServers indicate if multiple servers are supported
74
+ */
75
+ setUpServer(serverUrl: string, softwareMode?: boolean, supportMultipleServers?: boolean): void;
76
+ backupDownloadMethod(url: string): void;
77
+ /**
78
+ * Download a file based on a URL. By default a hidden IFRAME attempts to download
79
+ * the file but if that fails a fallback of opening a new window happens.
80
+ *
81
+ * @param url the URL of the file to download
82
+ */
83
+ triggerDownloadFromUrl(url: string): void;
84
+ }
85
+ export declare class ServerInfo {
86
+ /** The version of the HTTP Gateway Server */
87
+ version: string;
88
+ /** The name of the HTTP Gateway Server */
89
+ name: string;
90
+ /** List of endpoints supported on this HTTP Gateway Server */
91
+ endpoints: string[];
92
+ /** UI Item indicating that the SDK failed to verify this gateway setup */
93
+ sdkVerificationFailed?: boolean;
94
+ }
95
+ export declare class TransferResponse {
96
+ iteration_token: string;
97
+ result_count: number;
98
+ transfers: HttpTransfer[];
99
+ }
100
+ export declare class ActivityTracking {
101
+ /** Map of transfers by ID */
102
+ private transfers;
103
+ /** Map of callbacks that receive transfers */
104
+ private callbacks;
105
+ /** Indicate if a callback should happen */
106
+ private needCallback;
107
+ /** Queued uploads */
108
+ queuedUploads: {
109
+ id: string;
110
+ transferSpec: TransferSpec;
111
+ files: File[];
112
+ }[];
113
+ constructor();
114
+ /**
115
+ * Get transfer response object including all transfers
116
+ *
117
+ * @returns transfer data object with transfers array
118
+ */
119
+ getAllTransfersResponse(): TransferResponse;
120
+ /**
121
+ * Remove all transfers that are not active
122
+ */
123
+ clearNonActiveTransfers(): void;
124
+ /**
125
+ * Poll transfer callbacks
126
+ */
127
+ pollCallbacks(): void;
128
+ /**
129
+ * Trigger activity callback on activity events
130
+ */
131
+ triggerActivityCallbacks(): void;
132
+ /**
133
+ * Register a callback for getting transfers back to the consumer
134
+ *
135
+ * @param callback the function to call with the array of transfers
136
+ *
137
+ * @returns the ID of the callback index
138
+ */
139
+ setCallback(callback: (transfers: TransferResponse) => void): string;
140
+ /**
141
+ * Remove the callback (deregister) from the list of callbacks
142
+ *
143
+ * @param id the string of the callback to remove
144
+ */
145
+ removeCallback(id: string): void;
146
+ /**
147
+ * Set the transfer in the transfers map
148
+ *
149
+ * @param id transfer id for tracking transfers
150
+ * @param transfer transfer object
151
+ */
152
+ setTransfer(id: string, transfer: HttpTransfer): void;
153
+ /**
154
+ * Get the status of a specific transfer by ID (only returns for items during the session)
155
+ *
156
+ * @param id the ID of the transfer to retrieve that has been started during the session
157
+ *
158
+ * @returns an HttpTransfer object that includes the transfer info and status
159
+ */
160
+ getTransferById(id: string): HttpTransfer;
161
+ /**
162
+ * Get all active transfers (transfers that are not completed or failed)
163
+ */
164
+ getActiveTransfers(): HttpTransfer[];
165
+ /**
166
+ * Remove a transfer from the transfer list
167
+ *
168
+ * @param id the ID of the transfer to remove
169
+ */
170
+ removeTransfer(id: string): void;
171
+ /**
172
+ * Get the list of transfers started during the session for checking status
173
+ *
174
+ * @param returnMap boolean to indicate if the raw Map should be returned instead of an array
175
+ *
176
+ * @returns an Array of transfers or a Map of transfers (with the ID as key). Array is default
177
+ */
178
+ getAllTransfers(returnMap?: boolean): any;
179
+ }
180
+ export declare class HttpGateway {
181
+ /** Global information about the HTTP Gateway */
182
+ globals: HttpGatewayGlobals;
183
+ /** Activity tracking for watching transfers */
184
+ activityTracking: ActivityTracking;
185
+ /** Function to init the HTTP Gateway */
186
+ initHttpGateway: (serverUrl: string, softwareMode?: boolean) => Promise<any>;
187
+ /** Function to test the HTTP Gateway status */
188
+ testHttpGatewayConnection: () => Promise<any>;
189
+ /** Function to download from the HTTP Gateway */
190
+ download: (transferSpec: TransferSpec) => Promise<any>;
191
+ /** Function to upload to the HTTP Gateway */
192
+ upload: (transferSpec: TransferSpec, id: string, overrideFiles?: File[]) => Promise<any>;
193
+ /** Request file picker to get files for uploading */
194
+ getFilesForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void;
195
+ /** Request file picker to get files for uploading using Promises */
196
+ getFilesForUploadPromise: (id: string) => Promise<DataTransferResponse>;
197
+ /** Request folder picker to get folder for uploading */
198
+ getFoldersForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void;
199
+ /** Request folder picker to get folder for uploading using Promises */
200
+ getFoldersForUploadPromise: (id: string) => Promise<DataTransferResponse>;
201
+ /** Create dropzone for drop events of files */
202
+ createDropzone: (callback: (data: {
203
+ event: any;
204
+ files: {
205
+ dataTransfer: {
206
+ files: ConnectStyleFile[];
207
+ };
208
+ };
209
+ }) => void, elementSelector: string, formId: string) => void;
210
+ /** Remove dropzone for drop events of files */
211
+ removeDropzone: (elementSelector: string, formId: string) => void;
212
+ /** Register callback for the transfer activity monitor */
213
+ registerActivityCallback: (callback: (transfers: TransferResponse) => void) => string;
214
+ /** Deregister callback to remove it from the callbacks getting transfer data */
215
+ deregisterActivityCallback: (id: string) => void;
216
+ /** Get HTTP Gateway transfer by ID */
217
+ getTransferById: (id: string) => {
218
+ transfer_info: HttpTransfer;
219
+ };
220
+ /** Get all HTTP Gateway transfers */
221
+ getAllTransfers: () => TransferResponse;
222
+ /** Clear all transfers that are not active */
223
+ clearNonActiveTransfers: () => void;
224
+ /** Remove transfer by uuid */
225
+ removeTransfer: (id: string) => void;
226
+ /** Cancel transfer by uuid */
227
+ cancelTransfer: (id: string) => void;
228
+ /**
229
+ * Check if the HTTP Server is ready to be used and has been verified
230
+ *
231
+ * @returns a boolean indicating if SDK can be used for transfers
232
+ */
233
+ get isReady(): boolean;
234
+ /**
235
+ * If the user attempts to leave the page warn that by leaving they will have their transfer abort
236
+ * NOTE: Only IE will show custom text. No way to indicate why they are being blocked.
237
+ */
238
+ checkForPageLeave: (event: BeforeUnloadEvent) => string;
239
+ /**
240
+ * Overwrite default chunk size for chunking transfer data.
241
+ * This is an optional function, a default recommended size is set on start.
242
+ *
243
+ * @param size the size to use
244
+ */
245
+ overwriteDefaultChunkSize(size: number): void;
246
+ /**
247
+ * Overwrite default concurrent transfer number for parallel transfers
248
+ * This is an optional function, a default recommended number is set on start.
249
+ *
250
+ * @param transfers the number of concurrent uploads to use
251
+ */
252
+ overwriteDefaultConcurrentUploads(transfers: number): void;
253
+ }
254
+ export {};