@nativescript/appsync
Advanced tools
Comparing version 3.0.0 to 3.0.1
154
index.d.ts
@@ -1,3 +0,155 @@ | ||
/// <reference types="code-push-lib" /> | ||
export { TNSLocalPackage } from './TNSLocalPackage'; | ||
/** | ||
* Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app, | ||
* in which case only the appVersion is compulsory. | ||
* | ||
* !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !! | ||
*/ | ||
interface IPackage { | ||
deploymentKey: string; | ||
description: string; | ||
label: string; | ||
appVersion: string; | ||
isMandatory: boolean; | ||
packageHash: string; | ||
packageSize: number; | ||
failedInstall: boolean; | ||
serverUrl: string; | ||
} | ||
interface ILocalPackage extends IPackage { | ||
/** | ||
* The local storage path where this package is located. | ||
*/ | ||
localPath: string; | ||
/** | ||
* Indicates if the current application run is the first one after the package was applied. | ||
*/ | ||
isFirstRun: boolean; | ||
/** | ||
* Applies this package to the application. The application will be reloaded with this package and on every application launch this package will be loaded. | ||
* On the first run after the update, the application will wait for a codePush.notifyApplicationReady() call. Once this call is made, the install operation is considered a success. | ||
* Otherwise, the install operation will be marked as failed, and the application is reverted to its previous version on the next run. | ||
* | ||
* @param installSuccess Callback invoked if the install operation succeeded. | ||
* @param installError Optional callback inovoked in case of an error. | ||
* @param installOptions Optional parameter used for customizing the installation behavior. | ||
*/ | ||
install(installSuccess: SuccessCallback<InstallMode>, errorCallback?: ErrorCallback, installOptions?: InstallOptions): void; | ||
} | ||
/** | ||
* Defines a remote package, which represents an update package available for download. | ||
*/ | ||
interface IRemotePackage extends IPackage { | ||
/** | ||
* The URL at which the package is available for download. | ||
*/ | ||
downloadUrl: string; | ||
/** | ||
* Downloads the package update from the CodePush service. | ||
* | ||
* @param downloadSuccess Called with one parameter, the downloaded package information, once the download completed successfully. | ||
* @param downloadError Optional callback invoked in case of an error. | ||
* @param downloadProgress Optional callback invoked during the download process. It is called several times with one DownloadProgress parameter. | ||
*/ | ||
download(downloadSuccess: SuccessCallback<ILocalPackage>, downloadError?: ErrorCallback, downloadProgress?: SuccessCallback<DownloadProgress>): void; | ||
/** | ||
* Aborts the current download session, previously started with download(). | ||
* | ||
* @param abortSuccess Optional callback invoked if the abort operation succeeded. | ||
* @param abortError Optional callback invoked in case of an error. | ||
*/ | ||
abortDownload(abortSuccess?: SuccessCallback<void>, abortError?: ErrorCallback): void; | ||
} | ||
interface SuccessCallback<T> { | ||
(result: T, updateLabel?: string): void; | ||
} | ||
interface ErrorCallback { | ||
(error?: Error): void; | ||
} | ||
/** | ||
* Defines the install operation options. | ||
*/ | ||
interface InstallOptions { | ||
/** | ||
* Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART. | ||
*/ | ||
installMode?: InstallMode; | ||
/** | ||
* If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed. | ||
*/ | ||
minimumBackgroundDuration?: number; | ||
/** | ||
* Used to specify the InstallMode used for the install operation if the update is mandatory. | ||
* This is optional and defaults to InstallMode.ON_NEXT_RESUME. | ||
*/ | ||
mandatoryInstallMode?: InstallMode; | ||
} | ||
/** | ||
* Defines the sync operation options. | ||
*/ | ||
interface SyncOptions extends InstallOptions { | ||
/** | ||
* Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true. | ||
*/ | ||
ignoreFailedUpdates?: boolean; | ||
/** | ||
* Used to enable, disable or customize the user interaction during sync. | ||
* If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory. | ||
* To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance. | ||
*/ | ||
updateDialog?: boolean | UpdateDialogOptions; | ||
/** | ||
* The deployment key when checking for updates. | ||
*/ | ||
deploymentKey: string; | ||
/** | ||
* Overrides the default server URL (https://appsync-server.nativescript.org/). | ||
*/ | ||
serverUrl?: string; | ||
/** | ||
* By default we ignore AppSync updates when running with HMR. | ||
* But if you feel adventurous you can override that behaviour by setting this to true. | ||
*/ | ||
enabledWhenUsingHmr?: boolean; | ||
} | ||
/** | ||
* Defines the configuration options for the alert or confirmation dialog | ||
*/ | ||
interface UpdateDialogOptions { | ||
/** | ||
* If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update. | ||
* The user will not be able to cancel the operation, since the update is mandatory. | ||
*/ | ||
mandatoryUpdateMessage?: string; | ||
/** | ||
* If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog. | ||
* If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded. | ||
*/ | ||
optionalUpdateMessage?: string; | ||
/** | ||
* The title of the dialog box used for interacting with the user in case of a mandatory or optional update. | ||
* This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set. | ||
*/ | ||
updateTitle?: string; | ||
/** | ||
* The label of the confirmation button in case of an optional update. | ||
*/ | ||
optionalInstallButtonLabel?: string; | ||
/** | ||
* The label of the cancel button in case of an optional update. | ||
*/ | ||
optionalIgnoreButtonLabel?: string; | ||
/** | ||
* The label of the continue button in case of a mandatory update. | ||
*/ | ||
mandatoryContinueButtonLabel?: string; | ||
/** | ||
* Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message. | ||
*/ | ||
appendReleaseDescription?: boolean; | ||
/** | ||
* Optional prefix to add to the release description. | ||
*/ | ||
descriptionPrefix?: string; | ||
} | ||
export declare enum InstallMode { | ||
@@ -4,0 +156,0 @@ /** |
@@ -1,2 +0,1 @@ | ||
/// <reference path="./code-push-lib.d.ts"/> | ||
import * as AppVersion from "@nativescript/appversion"; | ||
@@ -3,0 +2,0 @@ import { Application, ApplicationSettings, Device, Dialogs } from "@nativescript/core"; |
{ | ||
"name": "@nativescript/appsync", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Use AppSync to hot deploy updates to your app.", | ||
@@ -5,0 +5,0 @@ "main": "index", |
1061067
1292