From e86ed0698cc790ccf402038572737b1a0806d9a4 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Sat, 21 Mar 2026 16:40:40 -0700 Subject: [PATCH] feat(cordova-plugin-unvired-sdk): Enhance LoginParameters and UMPRequestConfig (#5123) * feat(cordova-plugin-unvired-sdk): added a new functions. * updated getUMPRequestConfig with params. * feat(cordova-plugin-unvired-sdk): updated getUMPRequestConfig method params. * feat(cordova-plugin-unvired-sdk): Add `dbDeleteWithArgs`, `dbUpdateWithArgs`, and `dbExecuteStatementWithArgs` methods, and deprecate their non-argument counterparts. * feat(cordova-plugin-unvired-sdk): add dbUpdateStatements property to LoginParameters interface * docs: regenerate plugin readmes --------- Co-authored-by: Venkadesh P --- .../plugins/unvired-cordova-sdk/index.ts | 110 +++++++++++++++++- 1 file changed, 107 insertions(+), 3 deletions(-) diff --git a/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts b/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts index 431f46011..268580535 100644 --- a/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts +++ b/src/@awesome-cordova-plugins/plugins/unvired-cordova-sdk/index.ts @@ -213,6 +213,10 @@ export enum NotificationListenerType { * Notify that the JWT token is received */ JWTTokenReceived = 12, + /** + * Notify that the JWT token is expired + */ + jwtTokenExpired = 13 } export enum AttachmentItemStatus { @@ -430,9 +434,16 @@ export class LoginParameters { appVersion: string; /** - * + * Specify the redirect URL. */ redirectURL: string; + + /** + * Specify the database update statements as a JSON string. This will update the database schema. + */ + dbUpdateStatements: string; + + } export class LoginResult extends UnviredResult { type: LoginListenerType; @@ -1021,6 +1032,7 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { * # Select values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 * this.unviredSDK.dbDelete('FORM_HEADER', "FORM_ID = '5caed815892215034dacad56'") * ``` + * @deprecated Use `dbDeleteWithArgs` instead. */ @Cordova() dbDelete(tableName: string, whereClause: any): Promise { @@ -1039,6 +1051,7 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { * # Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 * this.unviredSDK.dbUpdate('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, "FORM_ID = '5caed815892215034dacad56'") * ``` + * @deprecated Use `dbUpdateWithArgs` instead. */ @Cordova() dbUpdate(tableName: string, updatedObject: any, whereClause: any): Promise { @@ -1053,12 +1066,65 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { * ``` * this.unviredSDK.dbExecuteStatement("SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = '39'") * ``` + * @deprecated Use `dbExecuteStatementWithArgs` instead. */ @Cordova() dbExecuteStatement(query: string): Promise { return; } + /** + * Delete records from the database. + * + * @param tableName Name of the table + * @param whereClause {Object} Browser: JSON object containing name-value pairs. + * Mobile: Or a Sqlite whereClause ( without the 'where' keyword ) + * @param args Arguments to replace the '?' placeholders in the query if any + * Example: + * ``` + * # Delete values from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * this.unviredSDK.dbDeleteWithArgs('FORM_HEADER', "FORM_ID = ?", ['5caed815892215034dacad56']) + * ``` + */ + @Cordova() + dbDeleteWithArgs(tableName: string, whereClause: any, args: any[]): Promise { + return; + } + + /** + * Update records in database. + * + * @param tableName Name of the table + * @param updatedObject JSON object containing updated name-value pairs. + * @param whereClause {Object} Browser: JSON object containing name-value pairs. + * Mobile: Or a Sqlite where Clause ( without the 'where' keyword ) + * @param args Arguments to replace the '?' placeholders in the query if any + * Example: + * ``` + * # Update NAME & NO from FORM_HEADER table where FORM_ID is 5caed815892215034dacad56 + * this.unviredSDK.dbUpdateWithArgs('FORM_HEADER', {"NAME":"UPDATED_USER","UPDATED_NO":"0039"}, "FORM_ID = ?", ['5caed815892215034dacad56']) + * ``` + */ + @Cordova() + dbUpdateWithArgs(tableName: string, updatedObject: any, whereClause: any, args: any[]): Promise { + return; + } + + /** + * Execute a SQL statement + * + * @param query {string} SQL Statement. + * @param args Arguments to replace the '?' placeholders in the query if any + * Example: + * ``` + * this.unviredSDK.dbExecuteStatementWithArgs("SELECT * FROM CUSTOMER_HEADER WHERE CUSTOMER_ID = ?", ['39']) + * ``` + */ + @Cordova() + dbExecuteStatementWithArgs(query: string, args: any[]): Promise { + return; + } + /** * Create Savepoint. For more info consult SQLite Documentation ( https://www.sqlite.org/lang_savepoint.html ) * @@ -1422,6 +1488,19 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { return; } + /** For Mobile platform only + * getPushNotificationListener - Register for callback on Push Notification received from server + * + * Mobile Only api + */ + @Cordova({ + observable: true, + }) + getPushNotificationListener(): Observable { + return; + }; + + /** * For Browser platform only. * Reinitialize web db. Use this api to initialize db from persisted local storage db @@ -1734,13 +1813,38 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { return; } + /** + * Sets the authentication token (JWT) to be used for communicating with UMP server. + * This api is useful in scenarios where the app has its own authentication mechanism and receives a JWT token from UMP server. + * The app can set this token using this api and all subsequent communication with UMP server would be authenticated using this token. + * + * @param token JWT token received from UMP server. + * @returns A promise containing true if the operation was successful. + */ + @Cordova() + setAuthToken(token: string): Promise { + return; + } + + /** + * Get the validity of the authentication token in seconds. + * If the return value is less than or equal to 0, then the token is either not set or expired. + * If the return value is greater than 0, then it contains the number of seconds for which the token is valid from now. + * + * @returns A promise containing number of seconds for which the token is valid. + */ + @Cordova() + getAuthTokenValidity(): Promise { + return; + } + /** * Get UMP request configuration with authentication headers * @param {string} endpoint - The API endpoint * @param {Object} [options] - Optional configuration object * @param {string} [options.customUrl] - Optional custom base URL to override server URL * @returns UMPRequestConfig which contails url and auth header - * Example - + * Example: - * * // with auth api * await this.unviredSDK.getUMPRequestConfig("/auth/getmodel/tenex/tenex_model.json"); @@ -1753,7 +1857,7 @@ export class UnviredCordovaSDK extends AwesomeCordovaNativePlugin { * await this.unviredSDK.getUMPRequestConfig("/UMP/api/v1/users"); */ @Cordova() - getUMPRequestConfig(): Promise { + getUMPRequestConfig(endpoint: string, options?: { customUrl?: string }): Promise { return; } }