From c772695fbe74e9ef3e1f7dc6433dde3c2d0b0306 Mon Sep 17 00:00:00 2001 From: David Bradshaw Date: Fri, 15 Nov 2024 11:51:42 -0800 Subject: [PATCH] fix: URL export info --- src/constants/constants.ts | 5 ++++- src/helpers/helpers.ts | 16 +++++++++++++++- src/index.ts | 35 ++++------------------------------ src/models/aspera-sdk.model.ts | 4 +++- src/models/models.ts | 7 +++++++ 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/constants/constants.ts b/src/constants/constants.ts index 23e843b..c91b037 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -13,4 +13,7 @@ export const hiddenStyleList = ` export const protocol = 'aspera://'; /** @ignore */ -export const installerUrl = 'https://downloads.ibmaspera.com/downloads/desktop/latest/stable'; +export const baseInstallerUrl = 'https://downloads.ibmaspera.com/downloads/desktop'; + +/** @ignore */ +export const installerUrl = `${baseInstallerUrl}/latest/stable`; diff --git a/src/helpers/helpers.ts b/src/helpers/helpers.ts index 578d04d..f40b67a 100644 --- a/src/helpers/helpers.ts +++ b/src/helpers/helpers.ts @@ -1,4 +1,5 @@ -import {ErrorResponse, PromiseObject, TransferSpec} from '../models/models'; +import {baseInstallerUrl, installerUrl} from '../constants/constants'; +import {ErrorResponse, InstallerUrlInfo, PromiseObject, TransferSpec} from '../models/models'; /** * Generates promise object that can be resolved or rejected via functions @@ -186,6 +187,18 @@ export const isSafari = (): boolean => { return /^((?!chrome|android).)*safari/i.test(navigator.userAgent) && !(window as any).MSStream; }; +/** + * Get the URLs for installer management. + * + * @returns Info on URLs where installers live + */ +export const getInstallerUrls = (): InstallerUrlInfo => { + return { + base: baseInstallerUrl, + latest: installerUrl, + }; +}; + export default { errorLog, generateErrorBody, @@ -197,4 +210,5 @@ export default { isValidTransferSpec, randomUUID, throwError, + getInstallerUrls, }; diff --git a/src/index.ts b/src/index.ts index 39a4fbd..fd19ecf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import {AsperaSdk} from './models/aspera-sdk.model'; import {createDropzone, deregisterActivityCallback, deregisterRemovedCallback, deregisterSafariExtensionStatusCallback, deregisterStatusCallback, getAllTransfers, getInfo, getTransfer, init, initDragDrop, modifyTransfer, registerActivityCallback, registerRemovedCallback, registerSafariExtensionStatusCallback, registerStatusCallback, removeDropzone, removeTransfer, resumeTransfer, setBranding, showDirectory, showPreferences, showSelectFileDialog, showSelectFolderDialog, startTransfer, stopTransfer, testConnection,} from './app/core'; import {getInstallerInfo} from './app/installer'; -import {isSafari} from './helpers/helpers'; +import {getInstallerUrls, isSafari} from './helpers/helpers'; export const asperaSdk: AsperaSdk = new AsperaSdk(); @@ -33,6 +33,7 @@ asperaSdk.initDragDrop = initDragDrop; asperaSdk.setBranding = setBranding; asperaSdk.getInfo = getInfo; asperaSdk.isSafari = isSafari; +asperaSdk.getInstallerUrls = getInstallerUrls; const launch = asperaSdk.globals.launch; asperaSdk.launch = launch; @@ -70,35 +71,7 @@ export { deregisterSafariExtensionStatusCallback, setBranding, getInfo, + getInstallerUrls, }; -export default { - isSafari, - init, - testConnection, - startTransfer, - launch, - registerActivityCallback, - deregisterActivityCallback, - removeTransfer, - showDirectory, - stopTransfer, - resumeTransfer, - getAllTransfers, - getTransfer, - registerRemovedCallback, - deregisterRemovedCallback, - showSelectFileDialog, - showSelectFolderDialog, - showPreferences, - modifyTransfer, - createDropzone, - removeDropzone, - getInstallerInfo, - registerStatusCallback, - deregisterStatusCallback, - registerSafariExtensionStatusCallback, - deregisterSafariExtensionStatusCallback, - setBranding, - getInfo, -}; +export default asperaSdk; diff --git a/src/models/aspera-sdk.model.ts b/src/models/aspera-sdk.model.ts index a7934f7..bd531d8 100644 --- a/src/models/aspera-sdk.model.ts +++ b/src/models/aspera-sdk.model.ts @@ -1,4 +1,4 @@ -import {CustomBrandingOptions, DataTransferResponse, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, InitOptions, InstallerInfoResponse, InstallerOptions, ModifyTransferOptions, ResumeTransferOptions, SafariExtensionEvent, TransferSpec, WebsocketEvent} from './models'; +import {CustomBrandingOptions, DataTransferResponse, AsperaSdkSpec, AsperaSdkTransfer, FileDialogOptions, FolderDialogOptions, InitOptions, InstallerInfoResponse, InstallerOptions, ModifyTransferOptions, ResumeTransferOptions, SafariExtensionEvent, TransferSpec, WebsocketEvent, InstallerUrlInfo} from './models'; import {hiddenStyleList, installerUrl, protocol} from '../constants/constants'; import {messages} from '../constants/messages'; import {safariClient} from '../helpers/client/safari-client'; @@ -350,6 +350,8 @@ export class AsperaSdk { getInfo: () => Promise; /** Function to get whether IBM Aspera is running on Safari */ isSafari: () => boolean; + /** Function to get URLs for installer management. */ + getInstallerUrls: () => InstallerUrlInfo; /** * Check if IBM Aspera is ready to be used and has been verified. diff --git a/src/models/models.ts b/src/models/models.ts index 113512d..ce6ab6d 100644 --- a/src/models/models.ts +++ b/src/models/models.ts @@ -667,3 +667,10 @@ export interface InitOptions { appId?: string; supportMultipleUsers?: boolean; } + +export interface InstallerUrlInfo { + /** Base URL of the Desktop download server */ + base: string; + /** URL to the latest installers (GA release) */ + latest: string; +}