Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/bas-sdk

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/bas-sdk - npm Package Compare versions

Comparing version 3.8.1 to 3.8.2

2

dist/src/apis/get-devspace.d.ts
import * as devUtils from "../utils/devspace-utils";
export declare const BAS_PLAN = "TENANT_PLAN";
export declare const BUILD_CODE_PLAN = "BUILD_CODE_PLAN";
/**

@@ -3,0 +5,0 @@ * Return information about the current workspace.

28

dist/src/apis/get-devspace.js

@@ -29,3 +29,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getBasMode = exports.isBuildCode = exports.updateDevSpace = exports.createDevSpace = exports.getExtensionPacks = exports.getDevSpacesSpec = exports.deleteDevSpace = exports.getDevSpaces = exports.getDevspaceInfo = void 0;
exports.getBasMode = exports.isBuildCode = exports.updateDevSpace = exports.createDevSpace = exports.getExtensionPacks = exports.getDevSpacesSpec = exports.deleteDevSpace = exports.getDevSpaces = exports.getDevspaceInfo = exports.BUILD_CODE_PLAN = exports.BAS_PLAN = void 0;
const lodash_1 = require("lodash");

@@ -37,4 +37,4 @@ const url_join_1 = __importDefault(require("url-join"));

const lodash_2 = require("lodash");
const TENANT_PLAN = "TENANT_PLAN";
const BUILD_CODE_PLAN = "BUILD_CODE_PLAN";
exports.BAS_PLAN = "TENANT_PLAN";
exports.BUILD_CODE_PLAN = "BUILD_CODE_PLAN";
const N_A = "n/a";

@@ -114,4 +114,8 @@ /**

const env = process.env;
const buildCode = env[BUILD_CODE_PLAN];
return (!(0, lodash_2.isEmpty)(buildCode) && buildCode !== N_A);
const buildCode = env[exports.BUILD_CODE_PLAN];
const basPlan = env[exports.BAS_PLAN];
if ((0, lodash_2.isEmpty)(buildCode) || !basPlan) {
return false;
}
return (!basPlan.toLowerCase().trim().includes("standard") && buildCode !== N_A);
}

@@ -121,11 +125,11 @@ exports.isBuildCode = isBuildCode;

const env = process.env;
const tenantPlaneVal = env[TENANT_PLAN];
const buildCodePlanVal = env[BUILD_CODE_PLAN];
if (tenantPlaneVal === "personal-edition") {
const basPlan = env[exports.BAS_PLAN];
const buildCodePlanVal = env[exports.BUILD_CODE_PLAN];
if (basPlan === "personal-edition") {
return "personal-edition";
}
if (tenantPlaneVal === "standard-edition") {
if (basPlan === null || basPlan === void 0 ? void 0 : basPlan.toLowerCase().trim().includes("standard")) {
return "standard";
}
if ((tenantPlaneVal === "free" || tenantPlaneVal === "trial") &&
if ((basPlan === "free" || basPlan === "trial") &&
buildCodePlanVal !== "standard" &&

@@ -135,7 +139,7 @@ buildCodePlanVal !== "free") {

}
if ((tenantPlaneVal === "free" || tenantPlaneVal === "trial" || tenantPlaneVal === "build-code") &&
if ((basPlan === "free" || basPlan === "trial" || basPlan === "build-code") &&
buildCodePlanVal === "free") {
return "buildCodeFree";
}
if ((tenantPlaneVal === "build-code" || tenantPlaneVal === "free" || tenantPlaneVal === "trial") &&
if ((basPlan === "build-code" || basPlan === "free" || basPlan === "trial") &&
buildCodePlanVal === "standard") {

@@ -142,0 +146,0 @@ return "buildCodeStandard";

@@ -600,22 +600,54 @@ "use strict";

describe("Test for isBuildCode()", () => {
it("returns true when BUILD_CODE_PLAN is defined", () => {
(0, bas_sdk_sinon_helper_1.stubEnv)({
BUILD_CODE_PLAN: "fake",
let envStub;
beforeEach(() => {
// Stubbing process.env
envStub = sinon_1.default.stub(process, "env").value({});
});
afterEach(() => {
// Restoring the stubbed process.env to its original state
envStub.restore();
});
it("should return false if buildCode is empty", () => {
envStub.value({
[get_devspace_1.BUILD_CODE_PLAN]: "",
[get_devspace_1.BAS_PLAN]: "standard",
});
(0, chai_1.expect)((0, get_devspace_1.isBuildCode)()).to.be.true;
(0, chai_1.expect)((0, get_devspace_1.isBuildCode)()).to.be.false;
});
it("returns false when BUILD_CODE_PLAN is undefined", () => {
(0, bas_sdk_sinon_helper_1.stubEnv)({
BUILD_CODE_PLAN: undefined,
it("should return false if basPlan is not present", () => {
envStub.value({
[get_devspace_1.BUILD_CODE_PLAN]: "ABC123",
[get_devspace_1.BAS_PLAN]: "",
});
(0, chai_1.expect)((0, get_devspace_1.isBuildCode)()).to.be.false;
});
it("returns false BUILD_CODE_PLAN is undefined", () => {
(0, bas_sdk_sinon_helper_1.stubEnv)({
BUILD_CODE_PLAN: "n/a",
it('should return false if basPlan includes "standard"', () => {
envStub.value({
[get_devspace_1.BUILD_CODE_PLAN]: "XYZ789",
[get_devspace_1.BAS_PLAN]: " standard ", // Added whitespace to test trim functionality
});
(0, chai_1.expect)((0, get_devspace_1.isBuildCode)()).to.be.false;
});
it('should return false if buildCode is "N/A" even when basPlan not includes "standard"', () => {
envStub.value({
[get_devspace_1.BUILD_CODE_PLAN]: "n/a",
[get_devspace_1.BAS_PLAN]: "free",
});
(0, chai_1.expect)((0, get_devspace_1.isBuildCode)()).to.be.false;
});
it('should return true if basPlan does not include "standard" and buildCode is not "N/A" ', () => {
envStub.value({
[get_devspace_1.BUILD_CODE_PLAN]: "XYZ789",
[get_devspace_1.BAS_PLAN]: "premium",
});
(0, chai_1.expect)((0, get_devspace_1.isBuildCode)()).to.be.true;
});
});
describe("Test for GET_BAS_MODE()", () => {
it("returns standard when TENANT_PLAN not exist", () => {
(0, bas_sdk_sinon_helper_1.stubEnv)({
TENANT_PLAN: undefined,
});
(0, chai_1.expect)((0, get_devspace_1.getBasMode)()).to.be.equal("standard");
});
it("returns personal-edition when TENANT_PLAN is personal-edition", () => {

@@ -622,0 +654,0 @@ (0, bas_sdk_sinon_helper_1.stubEnv)({

{
"name": "@sap/bas-sdk",
"version": "3.8.1",
"version": "3.8.2",
"description": "SDK for SAP Business Application Studio",

@@ -31,3 +31,3 @@ "license": "SAP",

"devDependencies": {
"@sap/bas-sdk-sinon-helper": "^3.8.1",
"@sap/bas-sdk-sinon-helper": "^3.8.2",
"@types/cross-spawn": "^6.0.2",

@@ -34,0 +34,0 @@ "@types/fs-extra": "^11.0.1",

@@ -8,4 +8,4 @@ import { assign } from "lodash";

const TENANT_PLAN = "TENANT_PLAN";
const BUILD_CODE_PLAN = "BUILD_CODE_PLAN";
export const BAS_PLAN = "TENANT_PLAN";
export const BUILD_CODE_PLAN = "BUILD_CODE_PLAN";
const N_A = "n/a";

@@ -129,20 +129,23 @@

const env = process.env;
const buildCode = env[BUILD_CODE_PLAN];
const buildCode = env[BUILD_CODE_PLAN];
const basPlan = env[BAS_PLAN];
if (isEmpty(buildCode) || !basPlan) {
return false;
}
return (
!isEmpty(buildCode) && buildCode !== N_A
!basPlan.toLowerCase().trim().includes("standard") && buildCode !== N_A
);
}
export function getBasMode(): BasMode {
const env = process.env;
const tenantPlaneVal = env[TENANT_PLAN];
const basPlan = env[BAS_PLAN];
const buildCodePlanVal = env[BUILD_CODE_PLAN];
if (tenantPlaneVal === "personal-edition") {
if (basPlan === "personal-edition") {
return "personal-edition";
}
if (tenantPlaneVal === "standard-edition") {
if (basPlan?.toLowerCase().trim().includes("standard")) {
return "standard";
}
if (
(tenantPlaneVal === "free" || tenantPlaneVal === "trial") &&
(basPlan === "free" || basPlan === "trial") &&
buildCodePlanVal !== "standard" &&

@@ -154,3 +157,3 @@ buildCodePlanVal !== "free"

if (
(tenantPlaneVal === "free" || tenantPlaneVal === "trial" || tenantPlaneVal === "build-code") &&
(basPlan === "free" || basPlan === "trial" || basPlan === "build-code") &&
buildCodePlanVal === "free"

@@ -161,3 +164,3 @@ ) {

if (
(tenantPlaneVal === "build-code" || tenantPlaneVal === "free" || tenantPlaneVal === "trial") &&
(basPlan === "build-code" || basPlan === "free" || basPlan === "trial") &&
buildCodePlanVal === "standard"

@@ -175,2 +178,2 @@ ) {

| "buildCodeFree"
| "buildCodeStandard";
| "buildCodeStandard";

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc