@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,169 @@
1
+ import { TransferSpec, DataTransferResponse, ConnectStyleFile, PromiseObject, TransferStatus, UploadOptions } from '../models/models';
2
+ /**
3
+ * Used to update the transfer in the activity monitor for a specific transfer. If transfer not found it is ignored
4
+ *
5
+ * @param id the id of the transfer to update
6
+ * @param status the status of the transfer
7
+ * @param total the total bytes of the transfer
8
+ * @param current the amount of bytes transferred thus far
9
+ * @param error error body
10
+ * @param currentFile the current file being transferred
11
+ */
12
+ export declare const updateTransferActivity: (id: string, status: TransferStatus, total?: number, current?: number, error?: any, currentFile?: File) => void;
13
+ /**
14
+ * Slice a file and read it in with FileReader. This uses the callback to send the read event.
15
+ * This function supports falling back to vendor prefix versions
16
+ * of the slice function for older Firefox and Webkit browsers.
17
+ *
18
+ * @param file the file to slice
19
+ * @param filePosition the start position of the file to slice
20
+ * @param chunksize the end position of the file to slice
21
+ * @param callback the callback to use for FileReader
22
+ * @param fileReader the FileReader to use for reading in data
23
+ */
24
+ export declare const handleBlobSlicing: (file: File, filePosition: number, chunksize: number, callback: any, fileReader: FileReader) => void;
25
+ /**
26
+ * Software mode version of `handleBlobSlicing` for dealing with Buffer instead of File API
27
+ *
28
+ * @param file the file to slice (data string is a FileSystem readFile in binary format)
29
+ * @param filePosition the start position of the file to slice
30
+ * @param chunksize the end position of the file to slice
31
+ * @param callback the callback to use for triggering event on slice
32
+ *
33
+ * @example
34
+ * ```javascript
35
+ * const fileInfo = fs.statSync(filePointer);
36
+ * const file = {
37
+ * data: fs.readFileSync(filePointer, {encoding: 'binary'}),
38
+ * size: fileInfo.size,
39
+ * type: 'file',
40
+ * lastModified: fileInfo.mtime.toISOString(),
41
+ * name: filePointer,
42
+ * }
43
+ * ```
44
+ */
45
+ export declare const handleSoftwareModeSlicing: (file: {
46
+ name: string;
47
+ data: string;
48
+ type: string;
49
+ lastModified: string;
50
+ }, filePosition: number, chunksize: number, callback: any) => void;
51
+ /**
52
+ * Start sending chunked data through the opened websocket
53
+ *
54
+ * @param socket the WebSocket to use for data transfer
55
+ * @param transferSpec the transferSpec to send for the upload
56
+ * @param id the ID of the transfer for monitoring
57
+ * @param queue the array of functions to call for sending data
58
+ * @param fileReaderToUse the file reader to use for this transfer
59
+ */
60
+ export declare const startSendingData: (socket: WebSocket, transferSpec: TransferSpec, files: File[], id: string, queue: (() => void)[], fileReaderToUse: FileReader) => void;
61
+ /**
62
+ * Add file input to a form for getting files from the local computer
63
+ *
64
+ * @param form form to add new file input to
65
+ */
66
+ export declare const addFilePickerToForm: (form: HTMLFormElement) => HTMLElement;
67
+ /**
68
+ * Add file input to a form with folder support for getting folders from the local computer
69
+ *
70
+ * NOTE: this cannot stop files from being picked.
71
+ *
72
+ * @param form form to add new file input to
73
+ */
74
+ export declare const addFolderPickerToForm: (form: HTMLFormElement) => HTMLElement;
75
+ /**
76
+ * Request file picker for choosing files
77
+ *
78
+ * @param id the ID of the form to use (must be unique to each transfer grouping)
79
+ * @param callback the function to call once the files are added
80
+ */
81
+ export declare const getFilesForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void;
82
+ /**
83
+ * Request file picker for choosing files and use promise.
84
+ * Uses `getFilesForUpload` logic wrapped in a Promise
85
+ *
86
+ * @param id the ID of the form to use (must be unique to each transfer grouping)
87
+ *
88
+ * @returns promise that resolves with the files (error state is never used)
89
+ */
90
+ export declare const getFilesForUploadPromise: (id: string) => Promise<DataTransferResponse>;
91
+ /**
92
+ * Request folder picker for choosing folders
93
+ * @remarks Feature not supported. Will be introduced in future release.
94
+ *
95
+ * @param id the ID of the form to use (must be unique to each transfer grouping)
96
+ * @param callback the function to call once the folders are added
97
+ */
98
+ export declare const getFoldersForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void;
99
+ /**
100
+ * Request folder picker for choosing folders and use promise.
101
+ * Uses `getFoldersForUpload` logic wrapped in a Promise
102
+ * @remarks Feature not supported. Will be introduced in future release.
103
+ *
104
+ * @param id the ID of the form to use (must be unique to each transfer grouping)
105
+ *
106
+ * @returns promise that resolves with the folders/file list (error state is never used)
107
+ */
108
+ export declare const getFoldersForUploadPromise: (id: string) => Promise<DataTransferResponse>;
109
+ /**
110
+ * Start the Websockets and transfer
111
+ *
112
+ * @param id the ID to use for the transfer
113
+ * @param transferSpec the transferSpec of the transfer
114
+ * @param files the files to transfer
115
+ * @param promiseInfo the promise data to resolve for the transfer if needed
116
+ */
117
+ export declare const startWebSocketTransfer: (id: string, transferSpec: TransferSpec, files: File[], promiseInfo?: PromiseObject, options?: UploadOptions) => void;
118
+ /**
119
+ * Start a HTTP Gateway upload.
120
+ *
121
+ * @param transferSpec standard Connect transferSpec for uploading
122
+ * @param id the ID of the form group to use for files
123
+ * @param memoryFilesToLoad array of files from memory to use. These will be used all the time and if transferSpec does not contain them an error will raise.
124
+ * @param options options for customizing the upload
125
+ *
126
+ * @returns a promise that resolves if upload is successful and rejects if upload cannot be started
127
+ */
128
+ export declare const upload: (transferSpec: TransferSpec, id: string, memoryFilesToLoad?: File[], options?: UploadOptions) => Promise<any>;
129
+ /**
130
+ * Create a dropzone linked to a form grouping.
131
+ * All drops are stored in same place to allow body drops.
132
+ *
133
+ * @param callback the function to call once the files are dropped
134
+ * @param elementSelector the selector of the element on the page that should watch for drop events
135
+ */
136
+ export declare const createDropzone: (callback: (data: {
137
+ event: any;
138
+ files: {
139
+ dataTransfer: {
140
+ files: ConnectStyleFile[];
141
+ };
142
+ };
143
+ }) => void, elementSelector: string) => void;
144
+ /**
145
+ * Remove dropzone added by gateway.
146
+ *
147
+ * @param elementSelector the selector of the element on the page that should remove
148
+ */
149
+ export declare const removeDropzone: (elementSelector: string) => void;
150
+ declare const _default: {
151
+ upload: (transferSpec: TransferSpec, id: string, memoryFilesToLoad?: File[], options?: UploadOptions) => Promise<any>;
152
+ updateTransferActivity: (id: string, status: TransferStatus, total?: number, current?: number, error?: any, currentFile?: File) => void;
153
+ startSendingData: (socket: WebSocket, transferSpec: TransferSpec, files: File[], id: string, queue: (() => void)[], fileReaderToUse: FileReader) => void;
154
+ addFilePickerToForm: (form: HTMLFormElement) => HTMLElement;
155
+ createDropzone: (callback: (data: {
156
+ event: any;
157
+ files: {
158
+ dataTransfer: {
159
+ files: ConnectStyleFile[];
160
+ };
161
+ };
162
+ }) => void, elementSelector: string) => void;
163
+ removeDropzone: (elementSelector: string) => void;
164
+ getFilesForUploadPromise: (id: string) => Promise<DataTransferResponse>;
165
+ getFilesForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void;
166
+ getFoldersForUploadPromise: (id: string) => Promise<DataTransferResponse>;
167
+ getFoldersForUpload: (callback: (data: DataTransferResponse) => void, id: string) => void;
168
+ };
169
+ export default _default;