Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: URL export info #51

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
16 changes: 15 additions & 1 deletion src/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -197,4 +210,5 @@ export default {
isValidTransferSpec,
randomUUID,
throwError,
getInstallerUrls,
};
35 changes: 4 additions & 31 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
4 changes: 3 additions & 1 deletion src/models/aspera-sdk.model.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -350,6 +350,8 @@ export class AsperaSdk {
getInfo: () => Promise<AsperaSdkInfo>;
/** 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.
Expand Down
7 changes: 7 additions & 0 deletions src/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading