mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-28 00:17:12 +01:00
chore(update): Updates biome config to 1.3 format (#5421)
Does what it says on the tin, update to 1.3.x format for biome config
This commit is contained in:
parent
0a6055b7e0
commit
c179c8ad5e
21
biome.json
21
biome.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.2.2/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/1.3.3/schema.json",
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
@ -8,13 +8,15 @@
|
||||
"noDelete": "off"
|
||||
},
|
||||
"correctness": {
|
||||
"noUnsafeOptionalChaining": "off"
|
||||
"noUnsafeOptionalChaining": "off",
|
||||
"useExhaustiveDependencies": "off"
|
||||
},
|
||||
"complexity": {
|
||||
"noBannedTypes": "off",
|
||||
"noUselessConstructor": "off",
|
||||
"useOptionalChain": "warn",
|
||||
"noStaticOnlyClass": "off"
|
||||
"noStaticOnlyClass": "off",
|
||||
"noForEach": "off"
|
||||
},
|
||||
"style": {
|
||||
"noNonNullAssertion": "off",
|
||||
@ -26,7 +28,12 @@
|
||||
"noExplicitAny": "off",
|
||||
"noExtraNonNullAssertion": "off",
|
||||
"noRedeclare": "off",
|
||||
"noPrototypeBuiltins": "off"
|
||||
"noPrototypeBuiltins": "off",
|
||||
"noConfusingVoidType": "off"
|
||||
},
|
||||
"performance": {
|
||||
"noAccumulatingSpread": "off",
|
||||
"noDelete": "off"
|
||||
}
|
||||
},
|
||||
"ignore": [
|
||||
@ -77,19 +84,19 @@
|
||||
"website/**/*.js",
|
||||
"coverage"
|
||||
],
|
||||
"indentSize": 4
|
||||
"indentWidth": 4
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"semicolons": "always",
|
||||
"quoteStyle": "single",
|
||||
"jsxQuoteStyle": "single",
|
||||
"indentSize": 4
|
||||
"indentWidth": 4
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"formatter": {
|
||||
"indentSize": 2
|
||||
"indentWidth": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
"gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.2.2",
|
||||
"@biomejs/biome": "^1.3.3",
|
||||
"@codemirror/lang-json": "6.0.1",
|
||||
"@emotion/react": "11.11.1",
|
||||
"@emotion/styled": "11.11.0",
|
||||
|
@ -22,9 +22,8 @@ test('should render authorization error on missing old password', async () => {
|
||||
await user.clear(passwordInput);
|
||||
await user.type(passwordInput, 'IAmThePass1!@');
|
||||
|
||||
const confirmPasswordInput = await screen.findByLabelText(
|
||||
'Confirm password',
|
||||
);
|
||||
const confirmPasswordInput =
|
||||
await screen.findByLabelText('Confirm password');
|
||||
await user.clear(confirmPasswordInput);
|
||||
await user.type(confirmPasswordInput, 'IAmThePass1!@');
|
||||
|
||||
|
@ -489,47 +489,47 @@
|
||||
"@babel/helper-validator-identifier" "^7.22.20"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@biomejs/biome@^1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.2.2.tgz#cfcceae7f4e55ef057a9b9576ef89563ca0c6d07"
|
||||
integrity sha512-fXwXi56ZdaKO/N3rTmhWw41UxstoviODk+wia4WWNSlm23r8xJ/NxjaZ88scV2IsmsFHqc8rmwb2dkrStAdIEw==
|
||||
"@biomejs/biome@^1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.3.3.tgz#aeec38fcc5fe2f9ec299c4f66512cc7bd0044ee8"
|
||||
integrity sha512-vTJn7RBzLWIabUuUIoEopO860YyBrbPEu4Pztfd28jRU5QD074hKZ9IQs24pFO6A2R296gaeYmN62f4u7pUruQ==
|
||||
optionalDependencies:
|
||||
"@biomejs/cli-darwin-arm64" "1.2.2"
|
||||
"@biomejs/cli-darwin-x64" "1.2.2"
|
||||
"@biomejs/cli-linux-arm64" "1.2.2"
|
||||
"@biomejs/cli-linux-x64" "1.2.2"
|
||||
"@biomejs/cli-win32-arm64" "1.2.2"
|
||||
"@biomejs/cli-win32-x64" "1.2.2"
|
||||
"@biomejs/cli-darwin-arm64" "1.3.3"
|
||||
"@biomejs/cli-darwin-x64" "1.3.3"
|
||||
"@biomejs/cli-linux-arm64" "1.3.3"
|
||||
"@biomejs/cli-linux-x64" "1.3.3"
|
||||
"@biomejs/cli-win32-arm64" "1.3.3"
|
||||
"@biomejs/cli-win32-x64" "1.3.3"
|
||||
|
||||
"@biomejs/cli-darwin-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.2.2.tgz#459a337f574d1a78d9d6a443fc00724d82804ffe"
|
||||
integrity sha512-Fx1IURKhoqH6wPawtKLT6wcfMSjRRcNK8+VWau0iDOjXvNtjJpSmICbU89B7Vt/gZRwPqkfDMBkFwm6V5vFTSQ==
|
||||
"@biomejs/cli-darwin-arm64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.3.3.tgz#2efd927d5eef7ce6c874cbda7c05243f689f2d8e"
|
||||
integrity sha512-2X87ZfbmWwe4NGukrUvnoYdI//muSgjNUCAHJ2DO+kS1sB7kDy1s6PN/IYyTJuqRcJtDuOnSpaUDE7KxR1YhtA==
|
||||
|
||||
"@biomejs/cli-darwin-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.2.2.tgz#892ea688b5d5ddbca9d0bc33c24aa2840a62b284"
|
||||
integrity sha512-JNaAFOI/ZisnmzvcFNd73geJxaFaN2L4YsWM6cgBeKyLY/ycl9C/PBTFfEmeB1c7f5XIIal8P2cj47kLJpN5Ig==
|
||||
"@biomejs/cli-darwin-x64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.3.3.tgz#abf6b08aac01503a56a85e12cf21057cf1edfe2a"
|
||||
integrity sha512-t+7DWTCbSgHOBcPsGKuwS1qh1z9zbXFK8i8ktE18yW7iF/W0zI62k44fYqYeFJKlb0Q08aqUvez3L+AQJFsn+w==
|
||||
|
||||
"@biomejs/cli-linux-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.2.2.tgz#b7a00f9d9e999daa36ee4581a37a0b13326ec899"
|
||||
integrity sha512-JHXRnfhOLx8UO/Fcyn2c5pFRri0XKqRZm2wf5oH5GSfLVpckDw2X15dYGbu3nmfM/3pcAaTV46pUpjrCnaAieg==
|
||||
"@biomejs/cli-linux-arm64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.3.3.tgz#e76b00a50707c4c530306c7a6cdbdc3d32c2d86d"
|
||||
integrity sha512-D8CvXaB8lkXXBQ6B3n0MXSSZFiE60+aNHorBLimVTtKiMod8QvAP425oQFZFul5wMXZqPLGTKFjXbAi/rvnc1A==
|
||||
|
||||
"@biomejs/cli-linux-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.2.2.tgz#4c55181f8231e7aa05b2841944a48dd81af443b8"
|
||||
integrity sha512-5Zr+iM7lUKsw81p9PkXRESuH2/AhRZ6RCWkgE+FSLcxMhXy/4RDR+o2YQDsJM6cWKIzOJM05vDHTGrDq7vXE4A==
|
||||
"@biomejs/cli-linux-x64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.3.tgz#fd3e4ed41a42805ec289956b32eaec7b6a10aa2f"
|
||||
integrity sha512-bqB05fwJnRZwRlcm/BS/s4qPickqiXZkiU/nOYvHApfsPeqgSHgv5HWoBYuSUjgqBbX3XZJArsC5dCcVW7vAJw==
|
||||
|
||||
"@biomejs/cli-win32-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.2.2.tgz#6fa05d52903c3fff55bd693c5b1ca778504cd4cc"
|
||||
integrity sha512-HvUcG2p++RvYP0zfOqh+DgiUUH+JI/uETr0kzWlOJ9F3lsG525pkywg4RSd4OvJd7Wpd3wt3UpN/A4IEJaVmbA==
|
||||
"@biomejs/cli-win32-arm64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.3.3.tgz#d6f21a838ffc24d10193e70e5feb42c98fbb62fe"
|
||||
integrity sha512-muFOjAv1ONMfaJDlo4Ds+Qb9lkdSLM2XaxOe3AJPejSq3Vi0aRr51ZnE02BofMnL2sVsOA9cO54wibsuTcopbw==
|
||||
|
||||
"@biomejs/cli-win32-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.2.tgz#583e50d8a1a1cc81381200d3cb2f34669c6afd35"
|
||||
integrity sha512-bfaFJwqJ9ApFga2o88OaROSd3pasYRzRGXHJWAE9VUUKdSNSTYxHOqVrNvV54yYPtL6Kt9xkuZa4HNu9it3TaA==
|
||||
"@biomejs/cli-win32-x64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.3.tgz#0186fba137dc4c4d12680d93ab7e3d6bd3e8f57c"
|
||||
integrity sha512-PMkMhS4smmmTMflxuZUx3REFSazEL9xsGscvZO1dKWI4ET23la+KxEM4TlSpjOyO66UerqSkuUlZecn0QhD63A==
|
||||
|
||||
"@braintree/sanitize-url@^6.0.0":
|
||||
version "6.0.2"
|
||||
|
@ -151,7 +151,7 @@
|
||||
"devDependencies": {
|
||||
"@apidevtools/swagger-parser": "10.1.0",
|
||||
"@babel/core": "7.23.3",
|
||||
"@biomejs/biome": "1.2.2",
|
||||
"@biomejs/biome": "1.3.3",
|
||||
"@swc/core": "1.3.96",
|
||||
"@swc/jest": "0.2.29",
|
||||
"@types/bcryptjs": "2.4.6",
|
||||
|
@ -805,9 +805,8 @@ export class AccessStore implements IAccessStore {
|
||||
}
|
||||
});
|
||||
// no need to pass down the environment in this particular case because it'll be overriden
|
||||
const permissionsWithNames = await this.resolvePermissions(
|
||||
permissionsAsRefs,
|
||||
);
|
||||
const permissionsWithNames =
|
||||
await this.resolvePermissions(permissionsAsRefs);
|
||||
|
||||
const newRoles = permissionsWithNames.map((p) => ({
|
||||
role_id,
|
||||
|
@ -137,9 +137,8 @@ test('increment sort order on each new insert', async () => {
|
||||
});
|
||||
|
||||
const firstStrategy = await featureStrategiesStore.getStrategyById(firstId);
|
||||
const secondStrategy = await featureStrategiesStore.getStrategyById(
|
||||
secondId,
|
||||
);
|
||||
const secondStrategy =
|
||||
await featureStrategiesStore.getStrategyById(secondId);
|
||||
const thirdStrategy = await featureStrategiesStore.getStrategyById(thirdId);
|
||||
|
||||
expect(firstStrategy.sortOrder).toEqual(0);
|
||||
|
@ -151,9 +151,8 @@ test.each([
|
||||
|
||||
await addStrategyToCr(segmentId, FLAG_NAME);
|
||||
|
||||
const result = await readModel.getStrategiesUsedInActiveChangeRequests(
|
||||
segmentId,
|
||||
);
|
||||
const result =
|
||||
await readModel.getStrategiesUsedInActiveChangeRequests(segmentId);
|
||||
if (isActiveCr) {
|
||||
expect(result).toStrictEqual([
|
||||
{
|
||||
@ -188,9 +187,8 @@ test.each([
|
||||
const strategyId = randomId();
|
||||
await updateStrategyInCr(strategyId, segmentId, FLAG_NAME);
|
||||
|
||||
const result = await readModel.getStrategiesUsedInActiveChangeRequests(
|
||||
segmentId,
|
||||
);
|
||||
const result =
|
||||
await readModel.getStrategiesUsedInActiveChangeRequests(segmentId);
|
||||
|
||||
if (isActiveCr) {
|
||||
expect(result).toMatchObject([
|
||||
@ -219,9 +217,8 @@ test(`If the same strategy appears in multiple CRs with the same segment, each s
|
||||
await updateStrategyInCr(strategyId, segmentId, FLAG_NAME, CR_ID);
|
||||
await updateStrategyInCr(strategyId, segmentId, FLAG_NAME, CR_ID_2);
|
||||
|
||||
const result = await readModel.getStrategiesUsedInActiveChangeRequests(
|
||||
segmentId,
|
||||
);
|
||||
const result =
|
||||
await readModel.getStrategiesUsedInActiveChangeRequests(segmentId);
|
||||
|
||||
expect(result).toHaveLength(2);
|
||||
|
||||
|
@ -303,9 +303,8 @@ export default class FeatureController extends Controller {
|
||||
const featureQuery = await this.resolveQuery(req);
|
||||
const q = { ...featureQuery, namePrefix: name };
|
||||
|
||||
const toggles = await this.clientFeatureToggleService.getClientFeatures(
|
||||
q,
|
||||
);
|
||||
const toggles =
|
||||
await this.clientFeatureToggleService.getClientFeatures(q);
|
||||
|
||||
const toggle = toggles.find((t) => t.name === name);
|
||||
if (!toggle) {
|
||||
|
@ -79,9 +79,8 @@ beforeAll(async () => {
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const all = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const all =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
await Promise.all(
|
||||
all
|
||||
.filter((env) => env.environment !== DEFAULT_ENV)
|
||||
|
@ -18,7 +18,8 @@ import { FeaturesReadModel } from '../feature-toggle/features-read-model';
|
||||
import { FakeFeaturesReadModel } from '../feature-toggle/fakes/fake-features-read-model';
|
||||
|
||||
export const createDependentFeaturesService =
|
||||
(config: IUnleashConfig) => (db: Db): DependentFeaturesService => {
|
||||
(config: IUnleashConfig) =>
|
||||
(db: Db): DependentFeaturesService => {
|
||||
const { getLogger, eventBus } = config;
|
||||
const eventStore = new EventStore(db, getLogger);
|
||||
const featureTagStore = new FeatureTagStore(db, eventBus, getLogger);
|
||||
|
@ -51,9 +51,8 @@ export class DependentFeaturesService {
|
||||
}: { featureName: string; newFeatureName: string; projectId: string },
|
||||
user: string,
|
||||
) {
|
||||
const parents = await this.dependentFeaturesReadModel.getParents(
|
||||
featureName,
|
||||
);
|
||||
const parents =
|
||||
await this.dependentFeaturesReadModel.getParents(featureName);
|
||||
await Promise.all(
|
||||
parents.map((parent) =>
|
||||
this.unprotectedUpsertFeatureDependency(
|
||||
|
@ -540,9 +540,8 @@ export default class ExportImportService
|
||||
}
|
||||
|
||||
private async verifyContextFields(dto: ImportTogglesSchema) {
|
||||
const unsupportedContextFields = await this.getUnsupportedContextFields(
|
||||
dto,
|
||||
);
|
||||
const unsupportedContextFields =
|
||||
await this.getUnsupportedContextFields(dto);
|
||||
if (Array.isArray(unsupportedContextFields)) {
|
||||
const [firstError, ...remainingErrors] =
|
||||
unsupportedContextFields.map((field) => {
|
||||
|
@ -799,9 +799,8 @@ test('import features to existing project and environment', async () => {
|
||||
],
|
||||
});
|
||||
|
||||
const { body: importedFeatureEnvironment } = await getFeatureEnvironment(
|
||||
defaultFeatureName,
|
||||
);
|
||||
const { body: importedFeatureEnvironment } =
|
||||
await getFeatureEnvironment(defaultFeatureName);
|
||||
expect(importedFeatureEnvironment).toMatchObject({
|
||||
name: defaultFeatureName,
|
||||
environment: DEFAULT_ENV,
|
||||
@ -882,9 +881,8 @@ test('can update toggles on subsequent import', async () => {
|
||||
variants,
|
||||
});
|
||||
|
||||
const { body: importedFeatureEnvironment } = await getFeatureEnvironment(
|
||||
defaultFeatureName,
|
||||
);
|
||||
const { body: importedFeatureEnvironment } =
|
||||
await getFeatureEnvironment(defaultFeatureName);
|
||||
|
||||
expect(importedFeatureEnvironment).toMatchObject({
|
||||
name: defaultFeatureName,
|
||||
|
@ -6,7 +6,8 @@ import { FeatureSearchService } from './feature-search-service';
|
||||
import FakeFeatureStrategiesStore from '../feature-toggle/fakes/fake-feature-strategies-store';
|
||||
|
||||
export const createFeatureSearchService =
|
||||
(config: IUnleashConfig) => (db: Db): FeatureSearchService => {
|
||||
(config: IUnleashConfig) =>
|
||||
(db: Db): FeatureSearchService => {
|
||||
const { getLogger, eventBus, flagResolver } = config;
|
||||
const featureStrategiesStore = new FeatureStrategiesStore(
|
||||
db,
|
||||
|
@ -221,9 +221,8 @@ class FeatureToggleService {
|
||||
featureNames: string[],
|
||||
projectId: string,
|
||||
): Promise<void> {
|
||||
const features = await this.featureToggleStore.getAllByNames(
|
||||
featureNames,
|
||||
);
|
||||
const features =
|
||||
await this.featureToggleStore.getAllByNames(featureNames);
|
||||
|
||||
const invalidProjects = unique(
|
||||
features
|
||||
@ -790,9 +789,8 @@ class FeatureToggleService {
|
||||
|
||||
if (existingStrategy.id === id) {
|
||||
existingStrategy.parameters[name] = String(value);
|
||||
const existingSegments = await this.segmentService.getByStrategy(
|
||||
id,
|
||||
);
|
||||
const existingSegments =
|
||||
await this.segmentService.getByStrategy(id);
|
||||
const strategy = await this.featureStrategiesStore.updateStrategy(
|
||||
id,
|
||||
existingStrategy,
|
||||
@ -1048,9 +1046,8 @@ class FeatureToggleService {
|
||||
async getPlaygroundFeatures(
|
||||
query?: IFeatureToggleQuery,
|
||||
): Promise<FeatureConfigurationClient[]> {
|
||||
const features = await this.featureToggleStore.getPlaygroundFeatures(
|
||||
query,
|
||||
);
|
||||
const features =
|
||||
await this.featureToggleStore.getPlaygroundFeatures(query);
|
||||
|
||||
return features as FeatureConfigurationClient[];
|
||||
}
|
||||
@ -1320,9 +1317,8 @@ class FeatureToggleService {
|
||||
|
||||
this.logger.info(`${userName} updates feature toggle ${featureName}`);
|
||||
|
||||
const featureData = await featureMetadataSchema.validateAsync(
|
||||
updatedFeature,
|
||||
);
|
||||
const featureData =
|
||||
await featureMetadataSchema.validateAsync(updatedFeature);
|
||||
|
||||
const preData = await this.featureToggleStore.get(featureName);
|
||||
|
||||
@ -1361,9 +1357,8 @@ class FeatureToggleService {
|
||||
}
|
||||
|
||||
async getStrategy(strategyId: string): Promise<Saved<IStrategyConfig>> {
|
||||
const strategy = await this.featureStrategiesStore.getStrategyById(
|
||||
strategyId,
|
||||
);
|
||||
const strategy =
|
||||
await this.featureStrategiesStore.getStrategyById(strategyId);
|
||||
|
||||
const segments = await this.segmentService.getByStrategy(strategyId);
|
||||
let result: Saved<IStrategyConfig> = {
|
||||
@ -1572,9 +1567,8 @@ class FeatureToggleService {
|
||||
this.validateNoOrphanParents(featureNames),
|
||||
]);
|
||||
|
||||
const features = await this.featureToggleStore.getAllByNames(
|
||||
featureNames,
|
||||
);
|
||||
const features =
|
||||
await this.featureToggleStore.getAllByNames(featureNames);
|
||||
await this.featureToggleStore.batchArchive(featureNames);
|
||||
await this.dependentFeaturesService.unprotectedDeleteFeaturesDependencies(
|
||||
featureNames,
|
||||
@ -1602,9 +1596,8 @@ class FeatureToggleService {
|
||||
): Promise<void> {
|
||||
await this.validateFeaturesContext(featureNames, projectId);
|
||||
|
||||
const features = await this.featureToggleStore.getAllByNames(
|
||||
featureNames,
|
||||
);
|
||||
const features =
|
||||
await this.featureToggleStore.getAllByNames(featureNames);
|
||||
const relevantFeatures = features.filter(
|
||||
(feature) => feature.stale !== stale,
|
||||
);
|
||||
@ -1904,9 +1897,8 @@ class FeatureToggleService {
|
||||
await this.validateFeaturesContext(featureNames, projectId);
|
||||
await this.validateNoOrphanParents(featureNames);
|
||||
|
||||
const features = await this.featureToggleStore.getAllByNames(
|
||||
featureNames,
|
||||
);
|
||||
const features =
|
||||
await this.featureToggleStore.getAllByNames(featureNames);
|
||||
const eligibleFeatures = features.filter(
|
||||
(toggle) => toggle.archivedAt !== null,
|
||||
);
|
||||
@ -1942,9 +1934,8 @@ class FeatureToggleService {
|
||||
): Promise<void> {
|
||||
await this.validateFeaturesContext(featureNames, projectId);
|
||||
|
||||
const features = await this.featureToggleStore.getAllByNames(
|
||||
featureNames,
|
||||
);
|
||||
const features =
|
||||
await this.featureToggleStore.getAllByNames(featureNames);
|
||||
const eligibleFeatures = features.filter(
|
||||
(toggle) => toggle.archivedAt !== null,
|
||||
);
|
||||
@ -2096,9 +2087,8 @@ class FeatureToggleService {
|
||||
): Promise<FeatureToggle> {
|
||||
await variantsArraySchema.validateAsync(newVariants);
|
||||
const fixedVariants = this.fixVariantWeights(newVariants);
|
||||
const oldVariants = await this.featureToggleStore.getVariants(
|
||||
featureName,
|
||||
);
|
||||
const oldVariants =
|
||||
await this.featureToggleStore.getVariants(featureName);
|
||||
const featureToggle = await this.featureToggleStore.saveVariants(
|
||||
project,
|
||||
featureName,
|
||||
|
@ -16,9 +16,8 @@ beforeAll(async () => {
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const all = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const all =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
await Promise.all(
|
||||
all
|
||||
.filter((env) => env.environment !== DEFAULT_ENV)
|
||||
|
@ -102,9 +102,8 @@ beforeAll(async () => {
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const all = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const all =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
await Promise.all(
|
||||
all
|
||||
.filter((env) => env.environment !== DEFAULT_ENV)
|
||||
|
@ -267,19 +267,22 @@ export class InstanceStatsService {
|
||||
return [
|
||||
{
|
||||
range: 'allTime',
|
||||
count: await this.clientInstanceStore.getDistinctApplicationsCount(),
|
||||
count:
|
||||
await this.clientInstanceStore.getDistinctApplicationsCount(),
|
||||
},
|
||||
{
|
||||
range: '30d',
|
||||
count: await this.clientInstanceStore.getDistinctApplicationsCount(
|
||||
30,
|
||||
),
|
||||
count:
|
||||
await this.clientInstanceStore.getDistinctApplicationsCount(
|
||||
30,
|
||||
),
|
||||
},
|
||||
{
|
||||
range: '7d',
|
||||
count: await this.clientInstanceStore.getDistinctApplicationsCount(
|
||||
7,
|
||||
),
|
||||
count:
|
||||
await this.clientInstanceStore.getDistinctApplicationsCount(
|
||||
7,
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
@ -412,9 +412,8 @@ export class ApiTokenController extends Controller {
|
||||
if (user.isAPI && user.permissions.includes(ADMIN)) {
|
||||
return allTokens;
|
||||
}
|
||||
const userPermissions = await this.accessService.getPermissionsForUser(
|
||||
user,
|
||||
);
|
||||
const userPermissions =
|
||||
await this.accessService.getPermissionsForUser(user);
|
||||
|
||||
const allowedTokenTypes = [
|
||||
ADMIN,
|
||||
|
@ -225,9 +225,8 @@ export class ContextController extends Controller {
|
||||
): Promise<void> {
|
||||
try {
|
||||
const name = req.params.contextField;
|
||||
const contextField = await this.contextService.getContextField(
|
||||
name,
|
||||
);
|
||||
const contextField =
|
||||
await this.contextService.getContextField(name);
|
||||
this.openApiService.respondWithValidation(
|
||||
200,
|
||||
res,
|
||||
|
@ -169,9 +169,8 @@ class MetricsController extends Controller {
|
||||
): Promise<void> {
|
||||
const { appName } = req.params;
|
||||
|
||||
const appDetails = await this.clientInstanceService.getApplication(
|
||||
appName,
|
||||
);
|
||||
const appDetails =
|
||||
await this.clientInstanceService.getApplication(appName);
|
||||
res.json(appDetails);
|
||||
}
|
||||
}
|
||||
|
@ -60,9 +60,8 @@ export default class ProjectHealthReport extends Controller {
|
||||
res: Response<HealthReportSchema>,
|
||||
): Promise<void> {
|
||||
const { projectId } = req.params;
|
||||
const overview = await this.projectHealthService.getProjectHealthReport(
|
||||
projectId,
|
||||
);
|
||||
const overview =
|
||||
await this.projectHealthService.getProjectHealthReport(projectId);
|
||||
this.openApiService.respondWithValidation(
|
||||
200,
|
||||
res,
|
||||
|
@ -142,9 +142,8 @@ class UserController extends Controller {
|
||||
} else {
|
||||
permissions = await this.accessService.getPermissionsForUser(user);
|
||||
}
|
||||
const feedback = await this.userFeedbackService.getAllUserFeedback(
|
||||
user,
|
||||
);
|
||||
const feedback =
|
||||
await this.userFeedbackService.getAllUserFeedback(user);
|
||||
const splash = await this.userSplashService.getAllUserSplashes(user);
|
||||
|
||||
const responseData: MeSchema = {
|
||||
|
@ -125,9 +125,8 @@ export default class EdgeController extends Controller {
|
||||
);
|
||||
}
|
||||
if (metrics && metrics.length > 0) {
|
||||
const data = await clientMetricsEnvBulkSchema.validateAsync(
|
||||
metrics,
|
||||
);
|
||||
const data =
|
||||
await clientMetricsEnvBulkSchema.validateAsync(metrics);
|
||||
promises.push(this.metricsV2.registerBulkMetrics(data));
|
||||
}
|
||||
await Promise.all(promises);
|
||||
|
@ -472,7 +472,7 @@ export class AccessService {
|
||||
return this.store.getRolesForUserId(userId);
|
||||
}
|
||||
|
||||
async wipeUserPermissions(userId: number): Promise<void[]> {
|
||||
async wipeUserPermissions(userId: number): Promise<Array<void>> {
|
||||
return Promise.all([
|
||||
this.store.unlinkUserRoles(userId),
|
||||
this.store.unlinkUserGroups(userId),
|
||||
|
@ -96,9 +96,8 @@ export default class ClientMetricsServiceV2 {
|
||||
),
|
||||
);
|
||||
|
||||
const validatedToggleNames = await this.filterValidToggleNames(
|
||||
toggleNames,
|
||||
);
|
||||
const validatedToggleNames =
|
||||
await this.filterValidToggleNames(toggleNames);
|
||||
|
||||
this.logger.debug(
|
||||
`Got ${toggleNames.length} (${validatedToggleNames.length} valid) metrics from ${clientIp}`,
|
||||
|
@ -214,9 +214,8 @@ export default class EnvironmentService {
|
||||
environment: string,
|
||||
projectId: string,
|
||||
): Promise<void> {
|
||||
const projectEnvs = await this.projectStore.getEnvironmentsForProject(
|
||||
projectId,
|
||||
);
|
||||
const projectEnvs =
|
||||
await this.projectStore.getEnvironmentsForProject(projectId);
|
||||
|
||||
if (projectEnvs.length > 1) {
|
||||
await this.forceRemoveEnvironmentFromProject(
|
||||
|
@ -78,9 +78,8 @@ class FeatureTagService {
|
||||
removedTags: ITag[],
|
||||
userName: string,
|
||||
): Promise<void> {
|
||||
const featureToggles = await this.featureToggleStore.getAllByNames(
|
||||
featureNames,
|
||||
);
|
||||
const featureToggles =
|
||||
await this.featureToggleStore.getAllByNames(featureNames);
|
||||
await Promise.all(
|
||||
addedTags.map((tag) => this.createTagIfNeeded(tag, userName)),
|
||||
);
|
||||
@ -162,9 +161,8 @@ class FeatureTagService {
|
||||
userName: string,
|
||||
): Promise<void> {
|
||||
const featureToggle = await this.featureToggleStore.get(featureName);
|
||||
const tags = await this.featureTagStore.getAllTagsForFeature(
|
||||
featureName,
|
||||
);
|
||||
const tags =
|
||||
await this.featureTagStore.getAllTagsForFeature(featureName);
|
||||
await this.featureTagStore.untagFeature(featureName, tag);
|
||||
await this.eventService.storeEvent({
|
||||
type: FEATURE_UNTAGGED,
|
||||
|
@ -311,9 +311,8 @@ export default class ProjectService {
|
||||
const featureEnvs = await this.featureEnvironmentStore.getAll({
|
||||
feature_name: feature.name,
|
||||
});
|
||||
const newEnvs = await this.projectStore.getEnvironmentsForProject(
|
||||
newProjectId,
|
||||
);
|
||||
const newEnvs =
|
||||
await this.projectStore.getEnvironmentsForProject(newProjectId);
|
||||
return arraysHaveSameItems(
|
||||
featureEnvs.map((env) => env.environment),
|
||||
newEnvs.map((projectEnv) => projectEnv.environment),
|
||||
@ -439,9 +438,8 @@ export default class ProjectService {
|
||||
userId: number,
|
||||
createdBy: string,
|
||||
): Promise<void> {
|
||||
const { roles, users } = await this.accessService.getProjectRoleAccess(
|
||||
projectId,
|
||||
);
|
||||
const { roles, users } =
|
||||
await this.accessService.getProjectRoleAccess(projectId);
|
||||
const user = await this.accountStore.get(userId);
|
||||
|
||||
const role = roles.find((r) => r.id === roleId);
|
||||
@ -971,9 +969,8 @@ export default class ProjectService {
|
||||
async getProjectUsers(
|
||||
projectId: string,
|
||||
): Promise<Array<Pick<IUser, 'id' | 'email' | 'username'>>> {
|
||||
const { groups, users } = await this.accessService.getProjectRoleAccess(
|
||||
projectId,
|
||||
);
|
||||
const { groups, users } =
|
||||
await this.accessService.getProjectRoleAccess(projectId);
|
||||
const actualUsers = users.map((user) => ({
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
|
@ -211,9 +211,8 @@ export class SegmentService implements ISegmentService {
|
||||
sourceStrategyId: string,
|
||||
targetStrategyId: string,
|
||||
): Promise<void> {
|
||||
const sourceStrategySegments = await this.getByStrategy(
|
||||
sourceStrategyId,
|
||||
);
|
||||
const sourceStrategySegments =
|
||||
await this.getByStrategy(sourceStrategyId);
|
||||
await Promise.all(
|
||||
sourceStrategySegments.map((sourceStrategySegment) => {
|
||||
return this.addToStrategy(
|
||||
|
@ -797,9 +797,8 @@ test('Importing states with deprecated strategies should keep their deprecated s
|
||||
dropBeforeImport: true,
|
||||
keepExisting: false,
|
||||
});
|
||||
const deprecatedStrategy = await stores.strategyStore.get(
|
||||
'deprecatedstrat',
|
||||
);
|
||||
const deprecatedStrategy =
|
||||
await stores.strategyStore.get('deprecatedstrat');
|
||||
expect(deprecatedStrategy.deprecated).toBe(true);
|
||||
});
|
||||
|
||||
|
@ -460,9 +460,8 @@ export default class StateService {
|
||||
);
|
||||
let importedEnvs = [];
|
||||
if (envsImport.length > 0) {
|
||||
importedEnvs = await this.environmentStore.importEnvironments(
|
||||
envsImport,
|
||||
);
|
||||
importedEnvs =
|
||||
await this.environmentStore.importEnvironments(envsImport);
|
||||
const importedEnvironmentEvents = importedEnvs.map((env) => ({
|
||||
type: ENVIRONMENT_IMPORT,
|
||||
createdBy: userName,
|
||||
@ -594,9 +593,8 @@ export default class StateService {
|
||||
: true,
|
||||
);
|
||||
if (featureTagsToInsert.length > 0) {
|
||||
const importedFeatureTags = await this.featureTagStore.tagFeatures(
|
||||
featureTagsToInsert,
|
||||
);
|
||||
const importedFeatureTags =
|
||||
await this.featureTagStore.tagFeatures(featureTagsToInsert);
|
||||
const importedFeatureTagEvents = importedFeatureTags.map((tag) => ({
|
||||
type: FEATURE_TAG_IMPORT,
|
||||
createdBy: userName,
|
||||
@ -643,9 +641,8 @@ export default class StateService {
|
||||
: true,
|
||||
);
|
||||
if (tagTypesToInsert.length > 0) {
|
||||
const importedTagTypes = await this.tagTypeStore.bulkImport(
|
||||
tagTypesToInsert,
|
||||
);
|
||||
const importedTagTypes =
|
||||
await this.tagTypeStore.bulkImport(tagTypesToInsert);
|
||||
const importedTagTypeEvents = importedTagTypes.map((tagType) => ({
|
||||
type: TAG_TYPE_IMPORT,
|
||||
createdBy: userName,
|
||||
|
@ -404,9 +404,8 @@ class UserService {
|
||||
}
|
||||
|
||||
async getUserForToken(token: string): Promise<TokenUserSchema> {
|
||||
const { createdBy, userId } = await this.resetTokenService.isValid(
|
||||
token,
|
||||
);
|
||||
const { createdBy, userId } =
|
||||
await this.resetTokenService.isValid(token);
|
||||
const user = await this.getUser(userId);
|
||||
const role = await this.accessService.getRoleData(user.rootRole);
|
||||
return {
|
||||
|
@ -25,9 +25,8 @@ beforeAll(async () => {
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const all = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const all =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
await Promise.all(
|
||||
all
|
||||
.filter((env) => env.environment !== DEFAULT_ENV)
|
||||
@ -56,9 +55,8 @@ test('Should add environment to project', async () => {
|
||||
.send({ environment: 'test' })
|
||||
.expect(200);
|
||||
|
||||
const envs = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const envs =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
|
||||
const environment = envs.find((env) => env.environment === 'test');
|
||||
|
||||
@ -92,9 +90,8 @@ test('Should remove environment from project', async () => {
|
||||
.delete(`/api/admin/projects/default/environments/${name}`)
|
||||
.expect(200);
|
||||
|
||||
const envs = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const envs =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
|
||||
expect(envs).toHaveLength(1);
|
||||
});
|
||||
@ -109,9 +106,8 @@ test('Should not remove environment from project if project only has one environ
|
||||
);
|
||||
});
|
||||
|
||||
const envs = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const envs =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
|
||||
expect(envs).toHaveLength(1);
|
||||
});
|
||||
@ -132,9 +128,8 @@ test('Should add default strategy to environment', async () => {
|
||||
})
|
||||
.expect(200);
|
||||
|
||||
const envs = await db.stores.projectStore.getEnvironmentsForProject(
|
||||
'default',
|
||||
);
|
||||
const envs =
|
||||
await db.stores.projectStore.getEnvironmentsForProject('default');
|
||||
|
||||
expect(envs).toHaveLength(1);
|
||||
expect(envs[0]).toStrictEqual({
|
||||
|
@ -330,9 +330,10 @@ test(`Importing version 2 replaces :global: environment with 'default'`, async (
|
||||
.expect(202);
|
||||
const env = await app.services.environmentService.get(DEFAULT_ENV);
|
||||
expect(env).toBeTruthy();
|
||||
const feature = await app.services.featureToggleServiceV2.getFeatureToggle(
|
||||
'this-is-fun',
|
||||
);
|
||||
const feature =
|
||||
await app.services.featureToggleServiceV2.getFeatureToggle(
|
||||
'this-is-fun',
|
||||
);
|
||||
expect(feature.environments).toHaveLength(1);
|
||||
expect(feature.environments[0].name).toBe(DEFAULT_ENV);
|
||||
});
|
||||
|
@ -1165,9 +1165,8 @@ test('if user has two roles user has union of permissions from the two roles', a
|
||||
secondRole.id,
|
||||
]);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
const permissionNameSet = new Set(
|
||||
assignedPermissions.map((p) => p.permission),
|
||||
);
|
||||
@ -1206,9 +1205,8 @@ test('calling set for user overwrites existing roles', async () => {
|
||||
secondRole.id,
|
||||
]);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
const permissionNameSet = new Set(
|
||||
assignedPermissions.map((p) => p.permission),
|
||||
);
|
||||
@ -1219,9 +1217,8 @@ test('calling set for user overwrites existing roles', async () => {
|
||||
firstRole.id,
|
||||
]);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(2);
|
||||
expect(newAssignedPermissions).toContainEqual({
|
||||
@ -1271,9 +1268,8 @@ test('if group has two roles user has union of permissions from the two roles',
|
||||
'testusr',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
const permissionNameSet = new Set(
|
||||
assignedPermissions.map((p) => p.permission),
|
||||
);
|
||||
@ -1318,9 +1314,8 @@ test('calling set for group overwrites existing roles', async () => {
|
||||
'testusr',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
const permissionNameSet = new Set(
|
||||
assignedPermissions.map((p) => p.permission),
|
||||
);
|
||||
@ -1334,9 +1329,8 @@ test('calling set for group overwrites existing roles', async () => {
|
||||
'testusr',
|
||||
);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(2);
|
||||
expect(newAssignedPermissions).toContainEqual({
|
||||
@ -1373,9 +1367,8 @@ test('group with root role can be assigned a project specific role', async () =>
|
||||
'testusr',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(assignedPermissions).toContainEqual({
|
||||
project: projectName,
|
||||
@ -1397,9 +1390,8 @@ test('calling add access with invalid project role ids should not assign those r
|
||||
'some-admin-user',
|
||||
);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1415,9 +1407,8 @@ test('calling set roles for user with invalid project role ids should not assign
|
||||
9999,
|
||||
]);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1437,17 +1428,15 @@ test('calling set roles for user with empty role array removes all roles', async
|
||||
role.id,
|
||||
]);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(1);
|
||||
|
||||
await accessService.setProjectRolesForUser(projectName, emptyUser.id, []);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1471,17 +1460,15 @@ test('calling set roles for user with empty role array should not remove root ro
|
||||
firstRole.id,
|
||||
]);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(3);
|
||||
|
||||
await accessService.setProjectRolesForUser(projectName, adminUser.id, []);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(1);
|
||||
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);
|
||||
@ -1514,17 +1501,15 @@ test('remove user access should remove all project roles', async () => {
|
||||
secondRole.id,
|
||||
]);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(3);
|
||||
|
||||
await accessService.removeUserAccess(projectName, emptyUser.id);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1556,17 +1541,15 @@ test('remove user access should remove all project roles, while leaving root rol
|
||||
secondRole.id,
|
||||
]);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(4);
|
||||
|
||||
await accessService.removeUserAccess(projectName, adminUser.id);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(1);
|
||||
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);
|
||||
@ -1589,9 +1572,8 @@ test('calling set roles for group with invalid project role ids should not assig
|
||||
'admin',
|
||||
);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1618,9 +1600,8 @@ test('calling set roles for group with empty role array removes all roles', asyn
|
||||
'admin',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(1);
|
||||
|
||||
@ -1631,9 +1612,8 @@ test('calling set roles for group with empty role array removes all roles', asyn
|
||||
'admin',
|
||||
);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1664,9 +1644,8 @@ test('calling set roles for group with empty role array should not remove root r
|
||||
'admin',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(3);
|
||||
|
||||
@ -1677,9 +1656,8 @@ test('calling set roles for group with empty role array should not remove root r
|
||||
'admin',
|
||||
);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(1);
|
||||
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);
|
||||
@ -1717,17 +1695,15 @@ test('remove group access should remove all project roles', async () => {
|
||||
'admin',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(3);
|
||||
|
||||
await accessService.removeGroupAccess(projectName, group.id);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
emptyUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(emptyUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(0);
|
||||
});
|
||||
@ -1764,17 +1740,15 @@ test('remove group access should remove all project roles, while leaving root ro
|
||||
'admin',
|
||||
);
|
||||
|
||||
const assignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const assignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(assignedPermissions.length).toBe(4);
|
||||
|
||||
await accessService.removeGroupAccess(projectName, group.id);
|
||||
|
||||
const newAssignedPermissions = await accessService.getPermissionsForUser(
|
||||
adminUser,
|
||||
);
|
||||
const newAssignedPermissions =
|
||||
await accessService.getPermissionsForUser(adminUser);
|
||||
|
||||
expect(newAssignedPermissions.length).toBe(1);
|
||||
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);
|
||||
|
@ -816,6 +816,7 @@ describe('the playground service (e2e)', () => {
|
||||
segment.result === true,
|
||||
),
|
||||
).toBeTruthy();
|
||||
break;
|
||||
case false:
|
||||
// empty -- all segments can be true and
|
||||
// the toggle still not enabled. We
|
||||
|
@ -58,9 +58,8 @@ test('Project with no stale toggles should have 100% health rating', async () =>
|
||||
description: 'new too',
|
||||
stale: false,
|
||||
});
|
||||
const rating = await projectHealthService.calculateHealthRating(
|
||||
savedProject,
|
||||
);
|
||||
const rating =
|
||||
await projectHealthService.calculateHealthRating(savedProject);
|
||||
expect(rating).toBe(100);
|
||||
});
|
||||
|
||||
@ -91,9 +90,8 @@ test('Project with two stale toggles and two non stale should have 50% health ra
|
||||
description: 'stale too',
|
||||
stale: true,
|
||||
});
|
||||
const rating = await projectHealthService.calculateHealthRating(
|
||||
savedProject,
|
||||
);
|
||||
const rating =
|
||||
await projectHealthService.calculateHealthRating(savedProject);
|
||||
expect(rating).toBe(50);
|
||||
});
|
||||
|
||||
@ -121,8 +119,7 @@ test('Project with one non-stale, one potentially stale and one stale should hav
|
||||
description: 'stale',
|
||||
stale: true,
|
||||
});
|
||||
const rating = await projectHealthService.calculateHealthRating(
|
||||
savedProject,
|
||||
);
|
||||
const rating =
|
||||
await projectHealthService.calculateHealthRating(savedProject);
|
||||
expect(rating).toBe(33);
|
||||
});
|
||||
|
@ -188,9 +188,8 @@ test('Importing states with deprecated strategies should keep their deprecated s
|
||||
dropBeforeImport: true,
|
||||
keepExisting: false,
|
||||
});
|
||||
const deprecatedStrategy = await stores.strategyStore.get(
|
||||
'deprecatedstrat',
|
||||
);
|
||||
const deprecatedStrategy =
|
||||
await stores.strategyStore.get('deprecatedstrat');
|
||||
expect(deprecatedStrategy.deprecated).toBe(true);
|
||||
});
|
||||
|
||||
|
@ -188,9 +188,8 @@ test('Should get toggle metrics', async () => {
|
||||
}
|
||||
|
||||
await clientMetricsStore.batchInsertMetrics(metrics);
|
||||
const savedMetrics = await clientMetricsStore.getMetricsForFeatureToggle(
|
||||
'demo',
|
||||
);
|
||||
const savedMetrics =
|
||||
await clientMetricsStore.getMetricsForFeatureToggle('demo');
|
||||
|
||||
expect(savedMetrics).toHaveLength(1);
|
||||
expect(savedMetrics[0].yes).toBe(4950);
|
||||
|
68
yarn.lock
68
yarn.lock
@ -616,47 +616,47 @@
|
||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@biomejs/biome@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.2.2.tgz#cfcceae7f4e55ef057a9b9576ef89563ca0c6d07"
|
||||
integrity sha512-fXwXi56ZdaKO/N3rTmhWw41UxstoviODk+wia4WWNSlm23r8xJ/NxjaZ88scV2IsmsFHqc8rmwb2dkrStAdIEw==
|
||||
"@biomejs/biome@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.3.3.tgz#aeec38fcc5fe2f9ec299c4f66512cc7bd0044ee8"
|
||||
integrity sha512-vTJn7RBzLWIabUuUIoEopO860YyBrbPEu4Pztfd28jRU5QD074hKZ9IQs24pFO6A2R296gaeYmN62f4u7pUruQ==
|
||||
optionalDependencies:
|
||||
"@biomejs/cli-darwin-arm64" "1.2.2"
|
||||
"@biomejs/cli-darwin-x64" "1.2.2"
|
||||
"@biomejs/cli-linux-arm64" "1.2.2"
|
||||
"@biomejs/cli-linux-x64" "1.2.2"
|
||||
"@biomejs/cli-win32-arm64" "1.2.2"
|
||||
"@biomejs/cli-win32-x64" "1.2.2"
|
||||
"@biomejs/cli-darwin-arm64" "1.3.3"
|
||||
"@biomejs/cli-darwin-x64" "1.3.3"
|
||||
"@biomejs/cli-linux-arm64" "1.3.3"
|
||||
"@biomejs/cli-linux-x64" "1.3.3"
|
||||
"@biomejs/cli-win32-arm64" "1.3.3"
|
||||
"@biomejs/cli-win32-x64" "1.3.3"
|
||||
|
||||
"@biomejs/cli-darwin-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.2.2.tgz#459a337f574d1a78d9d6a443fc00724d82804ffe"
|
||||
integrity sha512-Fx1IURKhoqH6wPawtKLT6wcfMSjRRcNK8+VWau0iDOjXvNtjJpSmICbU89B7Vt/gZRwPqkfDMBkFwm6V5vFTSQ==
|
||||
"@biomejs/cli-darwin-arm64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.3.3.tgz#2efd927d5eef7ce6c874cbda7c05243f689f2d8e"
|
||||
integrity sha512-2X87ZfbmWwe4NGukrUvnoYdI//muSgjNUCAHJ2DO+kS1sB7kDy1s6PN/IYyTJuqRcJtDuOnSpaUDE7KxR1YhtA==
|
||||
|
||||
"@biomejs/cli-darwin-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.2.2.tgz#892ea688b5d5ddbca9d0bc33c24aa2840a62b284"
|
||||
integrity sha512-JNaAFOI/ZisnmzvcFNd73geJxaFaN2L4YsWM6cgBeKyLY/ycl9C/PBTFfEmeB1c7f5XIIal8P2cj47kLJpN5Ig==
|
||||
"@biomejs/cli-darwin-x64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.3.3.tgz#abf6b08aac01503a56a85e12cf21057cf1edfe2a"
|
||||
integrity sha512-t+7DWTCbSgHOBcPsGKuwS1qh1z9zbXFK8i8ktE18yW7iF/W0zI62k44fYqYeFJKlb0Q08aqUvez3L+AQJFsn+w==
|
||||
|
||||
"@biomejs/cli-linux-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.2.2.tgz#b7a00f9d9e999daa36ee4581a37a0b13326ec899"
|
||||
integrity sha512-JHXRnfhOLx8UO/Fcyn2c5pFRri0XKqRZm2wf5oH5GSfLVpckDw2X15dYGbu3nmfM/3pcAaTV46pUpjrCnaAieg==
|
||||
"@biomejs/cli-linux-arm64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.3.3.tgz#e76b00a50707c4c530306c7a6cdbdc3d32c2d86d"
|
||||
integrity sha512-D8CvXaB8lkXXBQ6B3n0MXSSZFiE60+aNHorBLimVTtKiMod8QvAP425oQFZFul5wMXZqPLGTKFjXbAi/rvnc1A==
|
||||
|
||||
"@biomejs/cli-linux-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.2.2.tgz#4c55181f8231e7aa05b2841944a48dd81af443b8"
|
||||
integrity sha512-5Zr+iM7lUKsw81p9PkXRESuH2/AhRZ6RCWkgE+FSLcxMhXy/4RDR+o2YQDsJM6cWKIzOJM05vDHTGrDq7vXE4A==
|
||||
"@biomejs/cli-linux-x64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.3.tgz#fd3e4ed41a42805ec289956b32eaec7b6a10aa2f"
|
||||
integrity sha512-bqB05fwJnRZwRlcm/BS/s4qPickqiXZkiU/nOYvHApfsPeqgSHgv5HWoBYuSUjgqBbX3XZJArsC5dCcVW7vAJw==
|
||||
|
||||
"@biomejs/cli-win32-arm64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.2.2.tgz#6fa05d52903c3fff55bd693c5b1ca778504cd4cc"
|
||||
integrity sha512-HvUcG2p++RvYP0zfOqh+DgiUUH+JI/uETr0kzWlOJ9F3lsG525pkywg4RSd4OvJd7Wpd3wt3UpN/A4IEJaVmbA==
|
||||
"@biomejs/cli-win32-arm64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.3.3.tgz#d6f21a838ffc24d10193e70e5feb42c98fbb62fe"
|
||||
integrity sha512-muFOjAv1ONMfaJDlo4Ds+Qb9lkdSLM2XaxOe3AJPejSq3Vi0aRr51ZnE02BofMnL2sVsOA9cO54wibsuTcopbw==
|
||||
|
||||
"@biomejs/cli-win32-x64@1.2.2":
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.2.tgz#583e50d8a1a1cc81381200d3cb2f34669c6afd35"
|
||||
integrity sha512-bfaFJwqJ9ApFga2o88OaROSd3pasYRzRGXHJWAE9VUUKdSNSTYxHOqVrNvV54yYPtL6Kt9xkuZa4HNu9it3TaA==
|
||||
"@biomejs/cli-win32-x64@1.3.3":
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.3.tgz#0186fba137dc4c4d12680d93ab7e3d6bd3e8f57c"
|
||||
integrity sha512-PMkMhS4smmmTMflxuZUx3REFSazEL9xsGscvZO1dKWI4ET23la+KxEM4TlSpjOyO66UerqSkuUlZecn0QhD63A==
|
||||
|
||||
"@colors/colors@1.5.0":
|
||||
version "1.5.0"
|
||||
|
Loading…
Reference in New Issue
Block a user