@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
@@ -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,127 +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(consoleWarnCall).toHaveBeenCalled();
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 consoleWarnCall = jest.fn();
41
- console.warn = consoleWarnCall;
42
- const testMessage = 'Test message';
43
- expect((<any>window).asperaSdkLogs).toBe(undefined);
44
- const error = {error: true};
45
- errorLog(testMessage, {error: true});
46
- expect(consoleWarnCall).toHaveBeenLastCalledWith('Aspera SDK: Test message', error);
47
- expect((<any>window).asperaSdkLogs[0].message).toBe(testMessage);
48
- expect((<any>window).asperaSdkLogs[0].debugData.error).toBe(true);
49
- });
50
- });
51
-
52
- describe('generateErrorBody', () => {
53
-
54
- test('should return error object without debugData if nothing is passed', () => {
55
- const errorResponse = generateErrorBody('testing');
56
- expect(errorResponse.message).toBe('testing');
57
- expect(errorResponse.error).toBe(true);
58
- expect(errorResponse.debugData).toBe(undefined);
59
- });
60
-
61
- test('should return error object with debugData if data is passed', () => {
62
- const errorTest = new JSONRPCErrorException('testing error body', -32002, {foo: 'bar'});
63
- const errorResponse = generateErrorBody('testing', errorTest);
64
- expect(errorResponse.message).toBe('testing');
65
- expect(errorResponse.error).toBe(true);
66
- expect(errorResponse.debugData.message).toBe('testing error body');
67
- expect(errorResponse.debugData.code).toBe(-32002);
68
- expect(errorResponse.debugData.data).toStrictEqual({foo: 'bar'});
69
- });
70
- });
71
-
72
- describe('isValidTransferSpec', () => {
73
- const transferSpec: TransferSpec = {
74
- authentication: 'token',
75
- paths: [
76
- {
77
- source: '/foo'
78
- }
79
- ],
80
- direction: 'receive',
81
- remote_host: 'localhost'
82
- };
83
- const invalidTransferSpecs: any[] = [
84
- null,
85
- undefined,
86
- 'transfer',
87
- 85
88
- ];
89
-
90
- test('should return true if valid transferSpec', () => {
91
- expect(isValidTransferSpec(transferSpec)).toBe(true);
92
- });
93
-
94
- test('should return false if invalid transferSpec', () => {
95
- invalidTransferSpecs.forEach(element => {
96
- expect(isValidTransferSpec(element)).toBe(false);
97
- });
98
- });
99
- });
100
-
101
- describe('isValidURL', () => {
102
- const validUrls = [
103
- 'http://www.aspera.us',
104
- 'https://www.aspera.us',
105
- 'https://aspera.us',
106
- 'https://aspera.us/aspera/sdk/latest.json',
107
- 'https://aspera.us///aspera/sdk',
108
- ];
109
- const invalidUrls = [
110
- 'aspera.us',
111
- '/aspera/sdk',
112
- 'aspera',
113
- ];
114
-
115
- test('should return true if valid url', () => {
116
- validUrls.forEach(url => {
117
- expect(isValidURL(url)).toBe(true);
118
- });
119
- });
120
-
121
- test('should return false if invalid url', () => {
122
- invalidUrls.forEach(url => {
123
- expect(isValidURL(url)).toBe(false);
124
- });
125
- });
126
- });
127
-
@@ -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,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/js",
4
- "noImplicitAny": true,
5
- "module": "node16",
6
- "target": "es5",
7
- "esModuleInterop": true,
8
- "moduleResolution": "node16",
9
- "isolatedModules": true
10
- },
11
- "exclude": [
12
- "./example"
13
- ]
14
- }
@@ -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,7 +0,0 @@
1
- module.exports = {
2
- out: 'docs',
3
- theme: 'default',
4
- excludePrivate: false,
5
- name: 'IBM Aspera JavaScript Library',
6
- hideGenerator: true
7
- };
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
- };