@sap-devx/feature-toggle-node
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -0,1 +1,13 @@ | ||
<a name="1.0.5"></a> | ||
# 1.0.5 (2020-07-23) | ||
### Features | ||
- Added support for "ready" and "registered" events of the unleash-client dependency | ||
### BREAKING CHANGES | ||
- None | ||
<a name="1.0.4"></a> | ||
@@ -2,0 +14,0 @@ |
@@ -9,3 +9,4 @@ import { Context as appstudioContext } from "unleash-client/lib/context"; | ||
currentWs: string; | ||
currentTenantId: string; | ||
} | ||
export declare function createContextObject(): AppStudioMultiContext; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const LANDSCAPE_NAME = "LANDSCAPE_NAME"; | ||
const TENANT_ID = "TENANT_ID"; | ||
const fullFormatWsBaseUrl = "Expected format: https://<CF sub account>-workspaces-ws-<id>.<cluster region>.<domain>/"; | ||
@@ -34,2 +35,4 @@ function extractCfSubAccountAndWs(wsBaseUrlString, context) { | ||
const landscape = utils_1.getEnv(LANDSCAPE_NAME, "Feature toggle env LANDSCAPE_NAME was NOT found in the environment variables"); | ||
// get the tenant id from the env | ||
const tenantId = utils_1.getEnv(TENANT_ID, "Feature toggle env TENANT_ID was NOT found in the environment variables"); | ||
// Create the context | ||
@@ -43,2 +46,3 @@ const context = { | ||
currentWs: "", | ||
currentTenantId: tenantId, | ||
}; | ||
@@ -45,0 +49,0 @@ // get the WS and SubAccount from WS_BASE_URL env |
@@ -10,2 +10,3 @@ import { Strategy as appstudioStrategy } from "unleash-client"; | ||
wss: string; | ||
tenantids: string; | ||
} | ||
@@ -12,0 +13,0 @@ export declare class AppStudioMultiStrategy extends appstudioStrategy { |
@@ -15,3 +15,3 @@ "use strict"; | ||
// !! returns false for: null,undefined,0,"",false | ||
if (!parameters.environments && !parameters.infrastructures && !parameters.landscapes && !parameters.subaccounts && !parameters.users && !parameters.wss) { | ||
if (!parameters.environments && !parameters.infrastructures && !parameters.landscapes && !parameters.subaccounts && !parameters.users && !parameters.wss && !parameters.tenantids) { | ||
// No restriction from the strategy side | ||
@@ -46,2 +46,6 @@ return true; // strategy returns true. if the enabled button in the FT server is "on" the feature returns enabled | ||
} | ||
// tenantids | ||
if (!!context.currentTenantId && parameters.tenantids && parameters.tenantids.indexOf(context.currentTenantId) !== -1) { | ||
return true; | ||
} | ||
// no matches -> send "disable the feature" to the FT server | ||
@@ -48,0 +52,0 @@ return false; |
{ | ||
"name": "@sap-devx/feature-toggle-node", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -29,8 +29,8 @@ "main": "lib/api.js", | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"author": "SAP SE", | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "1.0.1", | ||
"@types/chai": "^4.2.8", | ||
"@types/mocha": "^7.0.1", | ||
"@types/mocha": "^8.0.1", | ||
"@types/rimraf": "3.0.0", | ||
@@ -40,6 +40,11 @@ "@types/sinon": "^9.0.0", | ||
"@typescript-eslint/parser": "2.34.0", | ||
"coveralls": "3.1.0", | ||
"chai": "^4.2.0", | ||
"cz-conventional-changelog": "3.3.0", | ||
"@commitlint/cli": "11.0.0", | ||
"@commitlint/config-conventional": "11.0.0", | ||
"eslint": "6.8.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-plugin-prettier": "3.1.3", | ||
"eslint-plugin-prettier": "3.1.4", | ||
"husky": "4.3.0", | ||
"mocha": "^8.0.1", | ||
@@ -53,4 +58,9 @@ "npm-run-all": "4.1.5", | ||
"ts-node": "8.10.2", | ||
"typescript": "3.9.5" | ||
"typescript": "3.9.7" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"mocha": { | ||
@@ -88,3 +98,13 @@ "require": [ | ||
"unleash-client": "^3.3.5" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
} | ||
} |
[![CircleCI](https://circleci.com/gh/SAP/feature-toggle-node.svg?style=svg)](https://circleci.com/gh/SAP/feature-toggle-node) | ||
[![Coverage Status](https://coveralls.io/repos/github/SAP/feature-toggle-node/badge.svg?branch=master)](https://coveralls.io/github/SAP/feature-toggle-node?branch=master) | ||
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
[![Commitizen friendly](https://api.dependabot.com/badges/status?host=github&repo=SAP/feature-toggle-node)](https://dependabot.com/) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
[![dependentbot](https://api.dependabot.com/badges/status?host=github&repo=SAP/feature-toggle-node)](https://dependabot.com/) | ||
[![REUSE status](https://api.reuse.software/badge/github.com/SAP/feature-toggle-node)](https://api.reuse.software/info/github.com/SAP/feature-toggle-node) | ||
@@ -71,7 +74,1 @@ # feature-toggle-node | ||
Open an issue within this GitHub repository. | ||
## License | ||
Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. | ||
This file is licensed under the Apache 2.0 License [except as noted otherwise in the LICENSE file](https://github.com/sap/feature-toggle-node/blob/master/README.md). |
@@ -8,2 +8,3 @@ import { Context as appstudioContext } from "unleash-client/lib/context"; | ||
const LANDSCAPE_NAME = "LANDSCAPE_NAME"; | ||
const TENANT_ID = "TENANT_ID"; | ||
@@ -19,2 +20,3 @@ const fullFormatWsBaseUrl = "Expected format: https://<CF sub account>-workspaces-ws-<id>.<cluster region>.<domain>/"; | ||
currentWs: string; | ||
currentTenantId: string; | ||
} | ||
@@ -50,2 +52,4 @@ | ||
const landscape = getEnv(LANDSCAPE_NAME, "Feature toggle env LANDSCAPE_NAME was NOT found in the environment variables"); | ||
// get the tenant id from the env | ||
const tenantId = getEnv(TENANT_ID, "Feature toggle env TENANT_ID was NOT found in the environment variables"); | ||
@@ -60,2 +64,3 @@ // Create the context | ||
currentWs: "", // will be added in the next function | ||
currentTenantId: tenantId, | ||
}; | ||
@@ -62,0 +67,0 @@ |
@@ -14,2 +14,3 @@ import { Strategy as appstudioStrategy } from "unleash-client"; | ||
wss: string; | ||
tenantids: string; | ||
} | ||
@@ -26,3 +27,3 @@ | ||
// !! returns false for: null,undefined,0,"",false | ||
if (!parameters.environments && !parameters.infrastructures && !parameters.landscapes && !parameters.subaccounts && !parameters.users && !parameters.wss) { | ||
if (!parameters.environments && !parameters.infrastructures && !parameters.landscapes && !parameters.subaccounts && !parameters.users && !parameters.wss && !parameters.tenantids) { | ||
// No restriction from the strategy side | ||
@@ -58,2 +59,6 @@ return true; // strategy returns true. if the enabled button in the FT server is "on" the feature returns enabled | ||
} | ||
// tenantids | ||
if (!!context.currentTenantId && parameters.tenantids && parameters.tenantids.indexOf(context.currentTenantId) !== -1) { | ||
return true; | ||
} | ||
@@ -60,0 +65,0 @@ // no matches -> send "disable the feature" to the FT server |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
0
100
700
1
48678
25
47
74