@ibm-aspera/sdk 0.2.7 → 0.2.8

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 (68) hide show
  1. package/dist/commonjs/app/core.d.ts +2 -1
  2. package/dist/commonjs/app/core.js +10 -3
  3. package/dist/commonjs/constants/messages.d.ts +1 -0
  4. package/dist/commonjs/constants/messages.js +1 -0
  5. package/dist/js/aspera-sdk.js +1 -1
  6. package/dist/js/aspera-sdk.js.LICENSE.txt +1 -1
  7. package/dist/js/aspera-sdk.js.map +1 -1
  8. package/package.json +3 -3
  9. package/.editorconfig +0 -13
  10. package/.eslintrc.js +0 -131
  11. package/.github/CODE_OF_CONDUCT.md +0 -128
  12. package/.github/CONTRIBUTING.md +0 -147
  13. package/.github/workflows/ci.yml +0 -36
  14. package/.github/workflows/documentation.yml +0 -43
  15. package/.github/workflows/npm_upload.yml +0 -30
  16. package/.husky/pre-commit +0 -4
  17. package/CHANGELOG.md +0 -165
  18. package/docs/DEVELOPMENT.md +0 -38
  19. package/example/README.md +0 -7
  20. package/example/index.html +0 -14
  21. package/example/package-lock.json +0 -2847
  22. package/example/package.json +0 -29
  23. package/example/public/404.html +0 -5
  24. package/example/public/sdk-code.js +0 -334
  25. package/example/src/App/App.scss +0 -40
  26. package/example/src/App/index.tsx +0 -174
  27. package/example/src/Views/AllTogether.tsx +0 -26
  28. package/example/src/Views/DragDrop.tsx +0 -23
  29. package/example/src/Views/Home.tsx +0 -10
  30. package/example/src/Views/Initialize.tsx +0 -21
  31. package/example/src/Views/Installer.tsx +0 -119
  32. package/example/src/Views/MonitorTransfers.tsx +0 -88
  33. package/example/src/Views/Other.tsx +0 -25
  34. package/example/src/Views/SelectItems.tsx +0 -46
  35. package/example/src/Views/StartTransfer.tsx +0 -32
  36. package/example/src/Views/Test.tsx +0 -20
  37. package/example/src/Views/Views.scss +0 -111
  38. package/example/src/helpers/index.ts +0 -19
  39. package/example/src/index.scss +0 -47
  40. package/example/src/main.tsx +0 -17
  41. package/example/src/vite-env.d.ts +0 -2
  42. package/example/tsconfig.json +0 -30
  43. package/example/vite.config.ts +0 -22
  44. package/jest.config.js +0 -15
  45. package/jest.setup.js +0 -0
  46. package/src/app/core.ts +0 -611
  47. package/src/app/installer.ts +0 -53
  48. package/src/constants/constants.ts +0 -19
  49. package/src/constants/messages.ts +0 -29
  50. package/src/helpers/client/client.ts +0 -11
  51. package/src/helpers/client/http-client.ts +0 -92
  52. package/src/helpers/client/safari-client.ts +0 -334
  53. package/src/helpers/helpers.ts +0 -214
  54. package/src/helpers/http.ts +0 -39
  55. package/src/helpers/ws.ts +0 -215
  56. package/src/index.ts +0 -78
  57. package/src/models/aspera-sdk.model.ts +0 -399
  58. package/src/models/models.ts +0 -676
  59. package/tests/client.spec.ts +0 -52
  60. package/tests/core.spec.ts +0 -13
  61. package/tests/helpers.spec.ts +0 -124
  62. package/tests/http.spec.ts +0 -14
  63. package/tests/installer.spec.ts +0 -135
  64. package/tests/mocks.ts +0 -11
  65. package/tsconfig.json +0 -13
  66. package/tsconfig.module.json +0 -16
  67. package/typedoc.js +0 -17
  68. package/webpack.config.js +0 -35
@@ -1,52 +0,0 @@
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
- });
@@ -1,13 +0,0 @@
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
- });
@@ -1,124 +0,0 @@
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(console.warn).toBeCalled();
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 testMessage = 'Test message';
41
- expect((<any>window).asperaSdkLogs).toBe(undefined);
42
- errorLog(testMessage, {error: true});
43
- expect(console.warn).toBeCalled();
44
- expect((<any>window).asperaSdkLogs[0].message).toBe(testMessage);
45
- expect((<any>window).asperaSdkLogs[0].debugData.error).toBe(true);
46
- });
47
- });
48
-
49
- describe('generateErrorBody', () => {
50
-
51
- test('should return error object without debugData if nothing is passed', () => {
52
- const errorResponse = generateErrorBody('testing');
53
- expect(errorResponse.message).toBe('testing');
54
- expect(errorResponse.error).toBe(true);
55
- expect(errorResponse.debugData).toBe(undefined);
56
- });
57
-
58
- test('should return error object with debugData if data is passed', () => {
59
- const errorTest = new JSONRPCErrorException('testing error body', -32002, {foo: 'bar'});
60
- const errorResponse = generateErrorBody('testing', errorTest);
61
- expect(errorResponse.message).toBe('testing');
62
- expect(errorResponse.error).toBe(true);
63
- expect(errorResponse.debugData.message).toBe('testing error body');
64
- expect(errorResponse.debugData.code).toBe(-32002);
65
- expect(errorResponse.debugData.data).toStrictEqual({foo: 'bar'});
66
- });
67
- });
68
-
69
- describe('isValidTransferSpec', () => {
70
- const transferSpec: TransferSpec = {
71
- authentication: 'token',
72
- paths: [
73
- {
74
- source: '/foo'
75
- }
76
- ],
77
- direction: 'receive',
78
- remote_host: 'localhost'
79
- };
80
- const invalidTransferSpecs: any[] = [
81
- null,
82
- undefined,
83
- 'transfer',
84
- 85
85
- ];
86
-
87
- test('should return true if valid transferSpec', () => {
88
- expect(isValidTransferSpec(transferSpec)).toBe(true);
89
- });
90
-
91
- test('should return false if invalid transferSpec', () => {
92
- invalidTransferSpecs.forEach(element => {
93
- expect(isValidTransferSpec(element)).toBe(false);
94
- });
95
- });
96
- });
97
-
98
- describe('isValidURL', () => {
99
- const validUrls = [
100
- 'http://www.aspera.us',
101
- 'https://www.aspera.us',
102
- 'https://aspera.us',
103
- 'https://aspera.us/aspera/sdk/latest.json',
104
- 'https://aspera.us///aspera/sdk',
105
- ];
106
- const invalidUrls = [
107
- 'aspera.us',
108
- '/aspera/sdk',
109
- 'aspera',
110
- ];
111
-
112
- test('should return true if valid url', () => {
113
- validUrls.forEach(url => {
114
- expect(isValidURL(url)).toBe(true);
115
- });
116
- });
117
-
118
- test('should return false if invalid url', () => {
119
- invalidUrls.forEach(url => {
120
- expect(isValidURL(url)).toBe(false);
121
- });
122
- });
123
- });
124
-
@@ -1,14 +0,0 @@
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
- });
@@ -1,135 +0,0 @@
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 DELETED
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/js",
4
- "noImplicitAny": true,
5
- "module": "es6",
6
- "target": "es5",
7
- "esModuleInterop": true,
8
- "moduleResolution": "node",
9
- },
10
- "exclude": [
11
- "./example"
12
- ]
13
- }
@@ -1,16 +0,0 @@
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 DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- mode: 'file',
3
- out: 'docs',
4
- theme: 'default',
5
- ignoreCompilerErrors: true,
6
- excludePrivate: false,
7
- excludeNotExported: true,
8
- target: 'ES6',
9
- moduleResolution: 'node',
10
- preserveConstEnums: 'true',
11
- stripInternal: 'true',
12
- suppressExcessPropertyErrors: 'true',
13
- suppressImplicitAnyIndexErrors: 'true',
14
- module: 'commonjs',
15
- name: 'IBM Aspera JavaScript Library',
16
- hideGenerator: true
17
- };
package/webpack.config.js DELETED
@@ -1,35 +0,0 @@
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
- };