@sap/bas-sdk
Advanced tools
Comparing version 3.3.1 to 3.3.2
10
api.d.ts
@@ -35,6 +35,10 @@ import { URL } from "url"; | ||
* Compose external login page url | ||
* @param landscapeUrl | ||
* @Returns the external login page url of the given landscape | ||
* @param landscapeUrl The url of the required landscape | ||
* @param useVscodeProtocol - External login process using vscode protocol | ||
* @returns The calculated value of 'external login' page | ||
*/ | ||
export function getExtLoginPath(landscapeUrl: string): string; | ||
export function getExtLoginPath( | ||
landscapeUrl: string, | ||
useVscodeProtocol?: boolean | ||
): string; | ||
} | ||
@@ -41,0 +45,0 @@ |
@@ -23,4 +23,5 @@ /** | ||
* @param landscapeUrl The url of the required landscape | ||
* @param useVscodeProtocol - External login process using vscode protocol | ||
* @returns The calculated value of 'external login' page | ||
*/ | ||
export declare function getExtLoginPath(landscapeUrl: string): string; | ||
export declare function getExtLoginPath(landscapeUrl: string, useVscodeProtocol?: boolean): string; |
@@ -106,8 +106,9 @@ "use strict"; | ||
* @param landscapeUrl The url of the required landscape | ||
* @param useVscodeProtocol - External login process using vscode protocol | ||
* @returns The calculated value of 'external login' page | ||
*/ | ||
function getExtLoginPath(landscapeUrl) { | ||
function getExtLoginPath(landscapeUrl, useVscodeProtocol) { | ||
const url = new URL(landscapeUrl); | ||
url.protocol = `https`; | ||
url.pathname = `remote-login.html`; | ||
url.pathname = `${useVscodeProtocol ? "remote" : "ext"}-login.html`; | ||
url.search = `cb=${Math.floor(Math.random() * 100000)}`; | ||
@@ -114,0 +115,0 @@ return url.toString(); |
@@ -53,4 +53,8 @@ "use strict"; | ||
const landscapeUrl = "https://landscape.com"; | ||
chai_1.expect(core_utils_1.getExtLoginPath(landscapeUrl)).to.contain("https://landscape.com/remote-login.html?cb="); | ||
chai_1.expect(core_utils_1.getExtLoginPath(landscapeUrl)).to.contain("https://landscape.com/ext-login.html?cb="); | ||
}); | ||
it("return the url of the 'external login' page, which is using the vscode protocol push login", () => { | ||
const landscapeUrl = "https://landscape.com"; | ||
chai_1.expect(core_utils_1.getExtLoginPath(landscapeUrl, true)).to.contain("https://landscape.com/remote-login.html?cb="); | ||
}); | ||
it("should throw exception while composing 'external login' when landscape is empty", () => { | ||
@@ -57,0 +61,0 @@ const landscapeUrl = ""; |
{ | ||
"name": "@sap/bas-sdk", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": "SDK for SAP Business Application Studio", | ||
@@ -31,3 +31,3 @@ "license": "SAP", | ||
"devDependencies": { | ||
"@sap/bas-sdk-sinon-helper": "^3.3.1", | ||
"@sap/bas-sdk-sinon-helper": "^3.3.2", | ||
"@types/cross-spawn": "^6.0.2", | ||
@@ -34,0 +34,0 @@ "@types/fs-extra": "^11.0.1", |
@@ -119,10 +119,14 @@ import { spawn } from "cross-spawn"; | ||
* @param landscapeUrl The url of the required landscape | ||
* @param useVscodeProtocol - External login process using vscode protocol | ||
* @returns The calculated value of 'external login' page | ||
*/ | ||
export function getExtLoginPath(landscapeUrl: string): string { | ||
export function getExtLoginPath( | ||
landscapeUrl: string, | ||
useVscodeProtocol?: boolean | ||
): string { | ||
const url = new URL(landscapeUrl); | ||
url.protocol = `https`; | ||
url.pathname = `remote-login.html`; | ||
url.pathname = `${useVscodeProtocol ? "remote" : "ext"}-login.html`; | ||
url.search = `cb=${Math.floor(Math.random() * 100000)}`; | ||
return url.toString(); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
455521
5318