1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-03 01:18:43 +02: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:
Christopher Kolstad 2023-11-27 13:42:58 +01:00 committed by GitHub
parent 0a6055b7e0
commit c179c8ad5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 262 additions and 327 deletions

View File

@ -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": { "linter": {
"enabled": true, "enabled": true,
"rules": { "rules": {
@ -8,13 +8,15 @@
"noDelete": "off" "noDelete": "off"
}, },
"correctness": { "correctness": {
"noUnsafeOptionalChaining": "off" "noUnsafeOptionalChaining": "off",
"useExhaustiveDependencies": "off"
}, },
"complexity": { "complexity": {
"noBannedTypes": "off", "noBannedTypes": "off",
"noUselessConstructor": "off", "noUselessConstructor": "off",
"useOptionalChain": "warn", "useOptionalChain": "warn",
"noStaticOnlyClass": "off" "noStaticOnlyClass": "off",
"noForEach": "off"
}, },
"style": { "style": {
"noNonNullAssertion": "off", "noNonNullAssertion": "off",
@ -26,7 +28,12 @@
"noExplicitAny": "off", "noExplicitAny": "off",
"noExtraNonNullAssertion": "off", "noExtraNonNullAssertion": "off",
"noRedeclare": "off", "noRedeclare": "off",
"noPrototypeBuiltins": "off" "noPrototypeBuiltins": "off",
"noConfusingVoidType": "off"
},
"performance": {
"noAccumulatingSpread": "off",
"noDelete": "off"
} }
}, },
"ignore": [ "ignore": [
@ -77,19 +84,19 @@
"website/**/*.js", "website/**/*.js",
"coverage" "coverage"
], ],
"indentSize": 4 "indentWidth": 4
}, },
"javascript": { "javascript": {
"formatter": { "formatter": {
"semicolons": "always", "semicolons": "always",
"quoteStyle": "single", "quoteStyle": "single",
"jsxQuoteStyle": "single", "jsxQuoteStyle": "single",
"indentSize": 4 "indentWidth": 4
} }
}, },
"json": { "json": {
"formatter": { "formatter": {
"indentSize": 2 "indentWidth": 2
} }
} }
} }

View File

@ -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" "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": { "devDependencies": {
"@biomejs/biome": "^1.2.2", "@biomejs/biome": "^1.3.3",
"@codemirror/lang-json": "6.0.1", "@codemirror/lang-json": "6.0.1",
"@emotion/react": "11.11.1", "@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0", "@emotion/styled": "11.11.0",

View File

@ -22,9 +22,8 @@ test('should render authorization error on missing old password', async () => {
await user.clear(passwordInput); await user.clear(passwordInput);
await user.type(passwordInput, 'IAmThePass1!@'); await user.type(passwordInput, 'IAmThePass1!@');
const confirmPasswordInput = await screen.findByLabelText( const confirmPasswordInput =
'Confirm password', await screen.findByLabelText('Confirm password');
);
await user.clear(confirmPasswordInput); await user.clear(confirmPasswordInput);
await user.type(confirmPasswordInput, 'IAmThePass1!@'); await user.type(confirmPasswordInput, 'IAmThePass1!@');

View File

@ -489,47 +489,47 @@
"@babel/helper-validator-identifier" "^7.22.20" "@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0" to-fast-properties "^2.0.0"
"@biomejs/biome@^1.2.2": "@biomejs/biome@^1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.2.2.tgz#cfcceae7f4e55ef057a9b9576ef89563ca0c6d07" resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.3.3.tgz#aeec38fcc5fe2f9ec299c4f66512cc7bd0044ee8"
integrity sha512-fXwXi56ZdaKO/N3rTmhWw41UxstoviODk+wia4WWNSlm23r8xJ/NxjaZ88scV2IsmsFHqc8rmwb2dkrStAdIEw== integrity sha512-vTJn7RBzLWIabUuUIoEopO860YyBrbPEu4Pztfd28jRU5QD074hKZ9IQs24pFO6A2R296gaeYmN62f4u7pUruQ==
optionalDependencies: optionalDependencies:
"@biomejs/cli-darwin-arm64" "1.2.2" "@biomejs/cli-darwin-arm64" "1.3.3"
"@biomejs/cli-darwin-x64" "1.2.2" "@biomejs/cli-darwin-x64" "1.3.3"
"@biomejs/cli-linux-arm64" "1.2.2" "@biomejs/cli-linux-arm64" "1.3.3"
"@biomejs/cli-linux-x64" "1.2.2" "@biomejs/cli-linux-x64" "1.3.3"
"@biomejs/cli-win32-arm64" "1.2.2" "@biomejs/cli-win32-arm64" "1.3.3"
"@biomejs/cli-win32-x64" "1.2.2" "@biomejs/cli-win32-x64" "1.3.3"
"@biomejs/cli-darwin-arm64@1.2.2": "@biomejs/cli-darwin-arm64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.2.2.tgz#459a337f574d1a78d9d6a443fc00724d82804ffe" resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.3.3.tgz#2efd927d5eef7ce6c874cbda7c05243f689f2d8e"
integrity sha512-Fx1IURKhoqH6wPawtKLT6wcfMSjRRcNK8+VWau0iDOjXvNtjJpSmICbU89B7Vt/gZRwPqkfDMBkFwm6V5vFTSQ== integrity sha512-2X87ZfbmWwe4NGukrUvnoYdI//muSgjNUCAHJ2DO+kS1sB7kDy1s6PN/IYyTJuqRcJtDuOnSpaUDE7KxR1YhtA==
"@biomejs/cli-darwin-x64@1.2.2": "@biomejs/cli-darwin-x64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.2.2.tgz#892ea688b5d5ddbca9d0bc33c24aa2840a62b284" resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.3.3.tgz#abf6b08aac01503a56a85e12cf21057cf1edfe2a"
integrity sha512-JNaAFOI/ZisnmzvcFNd73geJxaFaN2L4YsWM6cgBeKyLY/ycl9C/PBTFfEmeB1c7f5XIIal8P2cj47kLJpN5Ig== integrity sha512-t+7DWTCbSgHOBcPsGKuwS1qh1z9zbXFK8i8ktE18yW7iF/W0zI62k44fYqYeFJKlb0Q08aqUvez3L+AQJFsn+w==
"@biomejs/cli-linux-arm64@1.2.2": "@biomejs/cli-linux-arm64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.2.2.tgz#b7a00f9d9e999daa36ee4581a37a0b13326ec899" resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.3.3.tgz#e76b00a50707c4c530306c7a6cdbdc3d32c2d86d"
integrity sha512-JHXRnfhOLx8UO/Fcyn2c5pFRri0XKqRZm2wf5oH5GSfLVpckDw2X15dYGbu3nmfM/3pcAaTV46pUpjrCnaAieg== integrity sha512-D8CvXaB8lkXXBQ6B3n0MXSSZFiE60+aNHorBLimVTtKiMod8QvAP425oQFZFul5wMXZqPLGTKFjXbAi/rvnc1A==
"@biomejs/cli-linux-x64@1.2.2": "@biomejs/cli-linux-x64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.2.2.tgz#4c55181f8231e7aa05b2841944a48dd81af443b8" resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.3.tgz#fd3e4ed41a42805ec289956b32eaec7b6a10aa2f"
integrity sha512-5Zr+iM7lUKsw81p9PkXRESuH2/AhRZ6RCWkgE+FSLcxMhXy/4RDR+o2YQDsJM6cWKIzOJM05vDHTGrDq7vXE4A== integrity sha512-bqB05fwJnRZwRlcm/BS/s4qPickqiXZkiU/nOYvHApfsPeqgSHgv5HWoBYuSUjgqBbX3XZJArsC5dCcVW7vAJw==
"@biomejs/cli-win32-arm64@1.2.2": "@biomejs/cli-win32-arm64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.2.2.tgz#6fa05d52903c3fff55bd693c5b1ca778504cd4cc" resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.3.3.tgz#d6f21a838ffc24d10193e70e5feb42c98fbb62fe"
integrity sha512-HvUcG2p++RvYP0zfOqh+DgiUUH+JI/uETr0kzWlOJ9F3lsG525pkywg4RSd4OvJd7Wpd3wt3UpN/A4IEJaVmbA== integrity sha512-muFOjAv1ONMfaJDlo4Ds+Qb9lkdSLM2XaxOe3AJPejSq3Vi0aRr51ZnE02BofMnL2sVsOA9cO54wibsuTcopbw==
"@biomejs/cli-win32-x64@1.2.2": "@biomejs/cli-win32-x64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.2.tgz#583e50d8a1a1cc81381200d3cb2f34669c6afd35" resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.3.tgz#0186fba137dc4c4d12680d93ab7e3d6bd3e8f57c"
integrity sha512-bfaFJwqJ9ApFga2o88OaROSd3pasYRzRGXHJWAE9VUUKdSNSTYxHOqVrNvV54yYPtL6Kt9xkuZa4HNu9it3TaA== integrity sha512-PMkMhS4smmmTMflxuZUx3REFSazEL9xsGscvZO1dKWI4ET23la+KxEM4TlSpjOyO66UerqSkuUlZecn0QhD63A==
"@braintree/sanitize-url@^6.0.0": "@braintree/sanitize-url@^6.0.0":
version "6.0.2" version "6.0.2"

View File

@ -151,7 +151,7 @@
"devDependencies": { "devDependencies": {
"@apidevtools/swagger-parser": "10.1.0", "@apidevtools/swagger-parser": "10.1.0",
"@babel/core": "7.23.3", "@babel/core": "7.23.3",
"@biomejs/biome": "1.2.2", "@biomejs/biome": "1.3.3",
"@swc/core": "1.3.96", "@swc/core": "1.3.96",
"@swc/jest": "0.2.29", "@swc/jest": "0.2.29",
"@types/bcryptjs": "2.4.6", "@types/bcryptjs": "2.4.6",

View File

@ -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 // no need to pass down the environment in this particular case because it'll be overriden
const permissionsWithNames = await this.resolvePermissions( const permissionsWithNames =
permissionsAsRefs, await this.resolvePermissions(permissionsAsRefs);
);
const newRoles = permissionsWithNames.map((p) => ({ const newRoles = permissionsWithNames.map((p) => ({
role_id, role_id,

View File

@ -137,9 +137,8 @@ test('increment sort order on each new insert', async () => {
}); });
const firstStrategy = await featureStrategiesStore.getStrategyById(firstId); const firstStrategy = await featureStrategiesStore.getStrategyById(firstId);
const secondStrategy = await featureStrategiesStore.getStrategyById( const secondStrategy =
secondId, await featureStrategiesStore.getStrategyById(secondId);
);
const thirdStrategy = await featureStrategiesStore.getStrategyById(thirdId); const thirdStrategy = await featureStrategiesStore.getStrategyById(thirdId);
expect(firstStrategy.sortOrder).toEqual(0); expect(firstStrategy.sortOrder).toEqual(0);

View File

@ -151,9 +151,8 @@ test.each([
await addStrategyToCr(segmentId, FLAG_NAME); await addStrategyToCr(segmentId, FLAG_NAME);
const result = await readModel.getStrategiesUsedInActiveChangeRequests( const result =
segmentId, await readModel.getStrategiesUsedInActiveChangeRequests(segmentId);
);
if (isActiveCr) { if (isActiveCr) {
expect(result).toStrictEqual([ expect(result).toStrictEqual([
{ {
@ -188,9 +187,8 @@ test.each([
const strategyId = randomId(); const strategyId = randomId();
await updateStrategyInCr(strategyId, segmentId, FLAG_NAME); await updateStrategyInCr(strategyId, segmentId, FLAG_NAME);
const result = await readModel.getStrategiesUsedInActiveChangeRequests( const result =
segmentId, await readModel.getStrategiesUsedInActiveChangeRequests(segmentId);
);
if (isActiveCr) { if (isActiveCr) {
expect(result).toMatchObject([ 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);
await updateStrategyInCr(strategyId, segmentId, FLAG_NAME, CR_ID_2); await updateStrategyInCr(strategyId, segmentId, FLAG_NAME, CR_ID_2);
const result = await readModel.getStrategiesUsedInActiveChangeRequests( const result =
segmentId, await readModel.getStrategiesUsedInActiveChangeRequests(segmentId);
);
expect(result).toHaveLength(2); expect(result).toHaveLength(2);

View File

@ -303,9 +303,8 @@ export default class FeatureController extends Controller {
const featureQuery = await this.resolveQuery(req); const featureQuery = await this.resolveQuery(req);
const q = { ...featureQuery, namePrefix: name }; const q = { ...featureQuery, namePrefix: name };
const toggles = await this.clientFeatureToggleService.getClientFeatures( const toggles =
q, await this.clientFeatureToggleService.getClientFeatures(q);
);
const toggle = toggles.find((t) => t.name === name); const toggle = toggles.find((t) => t.name === name);
if (!toggle) { if (!toggle) {

View File

@ -79,9 +79,8 @@ beforeAll(async () => {
}); });
afterEach(async () => { afterEach(async () => {
const all = await db.stores.projectStore.getEnvironmentsForProject( const all =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
await Promise.all( await Promise.all(
all all
.filter((env) => env.environment !== DEFAULT_ENV) .filter((env) => env.environment !== DEFAULT_ENV)

View File

@ -18,7 +18,8 @@ import { FeaturesReadModel } from '../feature-toggle/features-read-model';
import { FakeFeaturesReadModel } from '../feature-toggle/fakes/fake-features-read-model'; import { FakeFeaturesReadModel } from '../feature-toggle/fakes/fake-features-read-model';
export const createDependentFeaturesService = export const createDependentFeaturesService =
(config: IUnleashConfig) => (db: Db): DependentFeaturesService => { (config: IUnleashConfig) =>
(db: Db): DependentFeaturesService => {
const { getLogger, eventBus } = config; const { getLogger, eventBus } = config;
const eventStore = new EventStore(db, getLogger); const eventStore = new EventStore(db, getLogger);
const featureTagStore = new FeatureTagStore(db, eventBus, getLogger); const featureTagStore = new FeatureTagStore(db, eventBus, getLogger);

View File

@ -51,9 +51,8 @@ export class DependentFeaturesService {
}: { featureName: string; newFeatureName: string; projectId: string }, }: { featureName: string; newFeatureName: string; projectId: string },
user: string, user: string,
) { ) {
const parents = await this.dependentFeaturesReadModel.getParents( const parents =
featureName, await this.dependentFeaturesReadModel.getParents(featureName);
);
await Promise.all( await Promise.all(
parents.map((parent) => parents.map((parent) =>
this.unprotectedUpsertFeatureDependency( this.unprotectedUpsertFeatureDependency(

View File

@ -540,9 +540,8 @@ export default class ExportImportService
} }
private async verifyContextFields(dto: ImportTogglesSchema) { private async verifyContextFields(dto: ImportTogglesSchema) {
const unsupportedContextFields = await this.getUnsupportedContextFields( const unsupportedContextFields =
dto, await this.getUnsupportedContextFields(dto);
);
if (Array.isArray(unsupportedContextFields)) { if (Array.isArray(unsupportedContextFields)) {
const [firstError, ...remainingErrors] = const [firstError, ...remainingErrors] =
unsupportedContextFields.map((field) => { unsupportedContextFields.map((field) => {

View File

@ -799,9 +799,8 @@ test('import features to existing project and environment', async () => {
], ],
}); });
const { body: importedFeatureEnvironment } = await getFeatureEnvironment( const { body: importedFeatureEnvironment } =
defaultFeatureName, await getFeatureEnvironment(defaultFeatureName);
);
expect(importedFeatureEnvironment).toMatchObject({ expect(importedFeatureEnvironment).toMatchObject({
name: defaultFeatureName, name: defaultFeatureName,
environment: DEFAULT_ENV, environment: DEFAULT_ENV,
@ -882,9 +881,8 @@ test('can update toggles on subsequent import', async () => {
variants, variants,
}); });
const { body: importedFeatureEnvironment } = await getFeatureEnvironment( const { body: importedFeatureEnvironment } =
defaultFeatureName, await getFeatureEnvironment(defaultFeatureName);
);
expect(importedFeatureEnvironment).toMatchObject({ expect(importedFeatureEnvironment).toMatchObject({
name: defaultFeatureName, name: defaultFeatureName,

View File

@ -6,7 +6,8 @@ import { FeatureSearchService } from './feature-search-service';
import FakeFeatureStrategiesStore from '../feature-toggle/fakes/fake-feature-strategies-store'; import FakeFeatureStrategiesStore from '../feature-toggle/fakes/fake-feature-strategies-store';
export const createFeatureSearchService = export const createFeatureSearchService =
(config: IUnleashConfig) => (db: Db): FeatureSearchService => { (config: IUnleashConfig) =>
(db: Db): FeatureSearchService => {
const { getLogger, eventBus, flagResolver } = config; const { getLogger, eventBus, flagResolver } = config;
const featureStrategiesStore = new FeatureStrategiesStore( const featureStrategiesStore = new FeatureStrategiesStore(
db, db,

View File

@ -221,9 +221,8 @@ class FeatureToggleService {
featureNames: string[], featureNames: string[],
projectId: string, projectId: string,
): Promise<void> { ): Promise<void> {
const features = await this.featureToggleStore.getAllByNames( const features =
featureNames, await this.featureToggleStore.getAllByNames(featureNames);
);
const invalidProjects = unique( const invalidProjects = unique(
features features
@ -790,9 +789,8 @@ class FeatureToggleService {
if (existingStrategy.id === id) { if (existingStrategy.id === id) {
existingStrategy.parameters[name] = String(value); existingStrategy.parameters[name] = String(value);
const existingSegments = await this.segmentService.getByStrategy( const existingSegments =
id, await this.segmentService.getByStrategy(id);
);
const strategy = await this.featureStrategiesStore.updateStrategy( const strategy = await this.featureStrategiesStore.updateStrategy(
id, id,
existingStrategy, existingStrategy,
@ -1048,9 +1046,8 @@ class FeatureToggleService {
async getPlaygroundFeatures( async getPlaygroundFeatures(
query?: IFeatureToggleQuery, query?: IFeatureToggleQuery,
): Promise<FeatureConfigurationClient[]> { ): Promise<FeatureConfigurationClient[]> {
const features = await this.featureToggleStore.getPlaygroundFeatures( const features =
query, await this.featureToggleStore.getPlaygroundFeatures(query);
);
return features as FeatureConfigurationClient[]; return features as FeatureConfigurationClient[];
} }
@ -1320,9 +1317,8 @@ class FeatureToggleService {
this.logger.info(`${userName} updates feature toggle ${featureName}`); this.logger.info(`${userName} updates feature toggle ${featureName}`);
const featureData = await featureMetadataSchema.validateAsync( const featureData =
updatedFeature, await featureMetadataSchema.validateAsync(updatedFeature);
);
const preData = await this.featureToggleStore.get(featureName); const preData = await this.featureToggleStore.get(featureName);
@ -1361,9 +1357,8 @@ class FeatureToggleService {
} }
async getStrategy(strategyId: string): Promise<Saved<IStrategyConfig>> { async getStrategy(strategyId: string): Promise<Saved<IStrategyConfig>> {
const strategy = await this.featureStrategiesStore.getStrategyById( const strategy =
strategyId, await this.featureStrategiesStore.getStrategyById(strategyId);
);
const segments = await this.segmentService.getByStrategy(strategyId); const segments = await this.segmentService.getByStrategy(strategyId);
let result: Saved<IStrategyConfig> = { let result: Saved<IStrategyConfig> = {
@ -1572,9 +1567,8 @@ class FeatureToggleService {
this.validateNoOrphanParents(featureNames), this.validateNoOrphanParents(featureNames),
]); ]);
const features = await this.featureToggleStore.getAllByNames( const features =
featureNames, await this.featureToggleStore.getAllByNames(featureNames);
);
await this.featureToggleStore.batchArchive(featureNames); await this.featureToggleStore.batchArchive(featureNames);
await this.dependentFeaturesService.unprotectedDeleteFeaturesDependencies( await this.dependentFeaturesService.unprotectedDeleteFeaturesDependencies(
featureNames, featureNames,
@ -1602,9 +1596,8 @@ class FeatureToggleService {
): Promise<void> { ): Promise<void> {
await this.validateFeaturesContext(featureNames, projectId); await this.validateFeaturesContext(featureNames, projectId);
const features = await this.featureToggleStore.getAllByNames( const features =
featureNames, await this.featureToggleStore.getAllByNames(featureNames);
);
const relevantFeatures = features.filter( const relevantFeatures = features.filter(
(feature) => feature.stale !== stale, (feature) => feature.stale !== stale,
); );
@ -1904,9 +1897,8 @@ class FeatureToggleService {
await this.validateFeaturesContext(featureNames, projectId); await this.validateFeaturesContext(featureNames, projectId);
await this.validateNoOrphanParents(featureNames); await this.validateNoOrphanParents(featureNames);
const features = await this.featureToggleStore.getAllByNames( const features =
featureNames, await this.featureToggleStore.getAllByNames(featureNames);
);
const eligibleFeatures = features.filter( const eligibleFeatures = features.filter(
(toggle) => toggle.archivedAt !== null, (toggle) => toggle.archivedAt !== null,
); );
@ -1942,9 +1934,8 @@ class FeatureToggleService {
): Promise<void> { ): Promise<void> {
await this.validateFeaturesContext(featureNames, projectId); await this.validateFeaturesContext(featureNames, projectId);
const features = await this.featureToggleStore.getAllByNames( const features =
featureNames, await this.featureToggleStore.getAllByNames(featureNames);
);
const eligibleFeatures = features.filter( const eligibleFeatures = features.filter(
(toggle) => toggle.archivedAt !== null, (toggle) => toggle.archivedAt !== null,
); );
@ -2096,9 +2087,8 @@ class FeatureToggleService {
): Promise<FeatureToggle> { ): Promise<FeatureToggle> {
await variantsArraySchema.validateAsync(newVariants); await variantsArraySchema.validateAsync(newVariants);
const fixedVariants = this.fixVariantWeights(newVariants); const fixedVariants = this.fixVariantWeights(newVariants);
const oldVariants = await this.featureToggleStore.getVariants( const oldVariants =
featureName, await this.featureToggleStore.getVariants(featureName);
);
const featureToggle = await this.featureToggleStore.saveVariants( const featureToggle = await this.featureToggleStore.saveVariants(
project, project,
featureName, featureName,

View File

@ -16,9 +16,8 @@ beforeAll(async () => {
}); });
afterEach(async () => { afterEach(async () => {
const all = await db.stores.projectStore.getEnvironmentsForProject( const all =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
await Promise.all( await Promise.all(
all all
.filter((env) => env.environment !== DEFAULT_ENV) .filter((env) => env.environment !== DEFAULT_ENV)

View File

@ -102,9 +102,8 @@ beforeAll(async () => {
}); });
afterEach(async () => { afterEach(async () => {
const all = await db.stores.projectStore.getEnvironmentsForProject( const all =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
await Promise.all( await Promise.all(
all all
.filter((env) => env.environment !== DEFAULT_ENV) .filter((env) => env.environment !== DEFAULT_ENV)

View File

@ -267,17 +267,20 @@ export class InstanceStatsService {
return [ return [
{ {
range: 'allTime', range: 'allTime',
count: await this.clientInstanceStore.getDistinctApplicationsCount(), count:
await this.clientInstanceStore.getDistinctApplicationsCount(),
}, },
{ {
range: '30d', range: '30d',
count: await this.clientInstanceStore.getDistinctApplicationsCount( count:
await this.clientInstanceStore.getDistinctApplicationsCount(
30, 30,
), ),
}, },
{ {
range: '7d', range: '7d',
count: await this.clientInstanceStore.getDistinctApplicationsCount( count:
await this.clientInstanceStore.getDistinctApplicationsCount(
7, 7,
), ),
}, },

View File

@ -412,9 +412,8 @@ export class ApiTokenController extends Controller {
if (user.isAPI && user.permissions.includes(ADMIN)) { if (user.isAPI && user.permissions.includes(ADMIN)) {
return allTokens; return allTokens;
} }
const userPermissions = await this.accessService.getPermissionsForUser( const userPermissions =
user, await this.accessService.getPermissionsForUser(user);
);
const allowedTokenTypes = [ const allowedTokenTypes = [
ADMIN, ADMIN,

View File

@ -225,9 +225,8 @@ export class ContextController extends Controller {
): Promise<void> { ): Promise<void> {
try { try {
const name = req.params.contextField; const name = req.params.contextField;
const contextField = await this.contextService.getContextField( const contextField =
name, await this.contextService.getContextField(name);
);
this.openApiService.respondWithValidation( this.openApiService.respondWithValidation(
200, 200,
res, res,

View File

@ -169,9 +169,8 @@ class MetricsController extends Controller {
): Promise<void> { ): Promise<void> {
const { appName } = req.params; const { appName } = req.params;
const appDetails = await this.clientInstanceService.getApplication( const appDetails =
appName, await this.clientInstanceService.getApplication(appName);
);
res.json(appDetails); res.json(appDetails);
} }
} }

View File

@ -60,9 +60,8 @@ export default class ProjectHealthReport extends Controller {
res: Response<HealthReportSchema>, res: Response<HealthReportSchema>,
): Promise<void> { ): Promise<void> {
const { projectId } = req.params; const { projectId } = req.params;
const overview = await this.projectHealthService.getProjectHealthReport( const overview =
projectId, await this.projectHealthService.getProjectHealthReport(projectId);
);
this.openApiService.respondWithValidation( this.openApiService.respondWithValidation(
200, 200,
res, res,

View File

@ -142,9 +142,8 @@ class UserController extends Controller {
} else { } else {
permissions = await this.accessService.getPermissionsForUser(user); permissions = await this.accessService.getPermissionsForUser(user);
} }
const feedback = await this.userFeedbackService.getAllUserFeedback( const feedback =
user, await this.userFeedbackService.getAllUserFeedback(user);
);
const splash = await this.userSplashService.getAllUserSplashes(user); const splash = await this.userSplashService.getAllUserSplashes(user);
const responseData: MeSchema = { const responseData: MeSchema = {

View File

@ -125,9 +125,8 @@ export default class EdgeController extends Controller {
); );
} }
if (metrics && metrics.length > 0) { if (metrics && metrics.length > 0) {
const data = await clientMetricsEnvBulkSchema.validateAsync( const data =
metrics, await clientMetricsEnvBulkSchema.validateAsync(metrics);
);
promises.push(this.metricsV2.registerBulkMetrics(data)); promises.push(this.metricsV2.registerBulkMetrics(data));
} }
await Promise.all(promises); await Promise.all(promises);

View File

@ -472,7 +472,7 @@ export class AccessService {
return this.store.getRolesForUserId(userId); return this.store.getRolesForUserId(userId);
} }
async wipeUserPermissions(userId: number): Promise<void[]> { async wipeUserPermissions(userId: number): Promise<Array<void>> {
return Promise.all([ return Promise.all([
this.store.unlinkUserRoles(userId), this.store.unlinkUserRoles(userId),
this.store.unlinkUserGroups(userId), this.store.unlinkUserGroups(userId),

View File

@ -96,9 +96,8 @@ export default class ClientMetricsServiceV2 {
), ),
); );
const validatedToggleNames = await this.filterValidToggleNames( const validatedToggleNames =
toggleNames, await this.filterValidToggleNames(toggleNames);
);
this.logger.debug( this.logger.debug(
`Got ${toggleNames.length} (${validatedToggleNames.length} valid) metrics from ${clientIp}`, `Got ${toggleNames.length} (${validatedToggleNames.length} valid) metrics from ${clientIp}`,

View File

@ -214,9 +214,8 @@ export default class EnvironmentService {
environment: string, environment: string,
projectId: string, projectId: string,
): Promise<void> { ): Promise<void> {
const projectEnvs = await this.projectStore.getEnvironmentsForProject( const projectEnvs =
projectId, await this.projectStore.getEnvironmentsForProject(projectId);
);
if (projectEnvs.length > 1) { if (projectEnvs.length > 1) {
await this.forceRemoveEnvironmentFromProject( await this.forceRemoveEnvironmentFromProject(

View File

@ -78,9 +78,8 @@ class FeatureTagService {
removedTags: ITag[], removedTags: ITag[],
userName: string, userName: string,
): Promise<void> { ): Promise<void> {
const featureToggles = await this.featureToggleStore.getAllByNames( const featureToggles =
featureNames, await this.featureToggleStore.getAllByNames(featureNames);
);
await Promise.all( await Promise.all(
addedTags.map((tag) => this.createTagIfNeeded(tag, userName)), addedTags.map((tag) => this.createTagIfNeeded(tag, userName)),
); );
@ -162,9 +161,8 @@ class FeatureTagService {
userName: string, userName: string,
): Promise<void> { ): Promise<void> {
const featureToggle = await this.featureToggleStore.get(featureName); const featureToggle = await this.featureToggleStore.get(featureName);
const tags = await this.featureTagStore.getAllTagsForFeature( const tags =
featureName, await this.featureTagStore.getAllTagsForFeature(featureName);
);
await this.featureTagStore.untagFeature(featureName, tag); await this.featureTagStore.untagFeature(featureName, tag);
await this.eventService.storeEvent({ await this.eventService.storeEvent({
type: FEATURE_UNTAGGED, type: FEATURE_UNTAGGED,

View File

@ -311,9 +311,8 @@ export default class ProjectService {
const featureEnvs = await this.featureEnvironmentStore.getAll({ const featureEnvs = await this.featureEnvironmentStore.getAll({
feature_name: feature.name, feature_name: feature.name,
}); });
const newEnvs = await this.projectStore.getEnvironmentsForProject( const newEnvs =
newProjectId, await this.projectStore.getEnvironmentsForProject(newProjectId);
);
return arraysHaveSameItems( return arraysHaveSameItems(
featureEnvs.map((env) => env.environment), featureEnvs.map((env) => env.environment),
newEnvs.map((projectEnv) => projectEnv.environment), newEnvs.map((projectEnv) => projectEnv.environment),
@ -439,9 +438,8 @@ export default class ProjectService {
userId: number, userId: number,
createdBy: string, createdBy: string,
): Promise<void> { ): Promise<void> {
const { roles, users } = await this.accessService.getProjectRoleAccess( const { roles, users } =
projectId, await this.accessService.getProjectRoleAccess(projectId);
);
const user = await this.accountStore.get(userId); const user = await this.accountStore.get(userId);
const role = roles.find((r) => r.id === roleId); const role = roles.find((r) => r.id === roleId);
@ -971,9 +969,8 @@ export default class ProjectService {
async getProjectUsers( async getProjectUsers(
projectId: string, projectId: string,
): Promise<Array<Pick<IUser, 'id' | 'email' | 'username'>>> { ): Promise<Array<Pick<IUser, 'id' | 'email' | 'username'>>> {
const { groups, users } = await this.accessService.getProjectRoleAccess( const { groups, users } =
projectId, await this.accessService.getProjectRoleAccess(projectId);
);
const actualUsers = users.map((user) => ({ const actualUsers = users.map((user) => ({
id: user.id, id: user.id,
email: user.email, email: user.email,

View File

@ -211,9 +211,8 @@ export class SegmentService implements ISegmentService {
sourceStrategyId: string, sourceStrategyId: string,
targetStrategyId: string, targetStrategyId: string,
): Promise<void> { ): Promise<void> {
const sourceStrategySegments = await this.getByStrategy( const sourceStrategySegments =
sourceStrategyId, await this.getByStrategy(sourceStrategyId);
);
await Promise.all( await Promise.all(
sourceStrategySegments.map((sourceStrategySegment) => { sourceStrategySegments.map((sourceStrategySegment) => {
return this.addToStrategy( return this.addToStrategy(

View File

@ -797,9 +797,8 @@ test('Importing states with deprecated strategies should keep their deprecated s
dropBeforeImport: true, dropBeforeImport: true,
keepExisting: false, keepExisting: false,
}); });
const deprecatedStrategy = await stores.strategyStore.get( const deprecatedStrategy =
'deprecatedstrat', await stores.strategyStore.get('deprecatedstrat');
);
expect(deprecatedStrategy.deprecated).toBe(true); expect(deprecatedStrategy.deprecated).toBe(true);
}); });

View File

@ -460,9 +460,8 @@ export default class StateService {
); );
let importedEnvs = []; let importedEnvs = [];
if (envsImport.length > 0) { if (envsImport.length > 0) {
importedEnvs = await this.environmentStore.importEnvironments( importedEnvs =
envsImport, await this.environmentStore.importEnvironments(envsImport);
);
const importedEnvironmentEvents = importedEnvs.map((env) => ({ const importedEnvironmentEvents = importedEnvs.map((env) => ({
type: ENVIRONMENT_IMPORT, type: ENVIRONMENT_IMPORT,
createdBy: userName, createdBy: userName,
@ -594,9 +593,8 @@ export default class StateService {
: true, : true,
); );
if (featureTagsToInsert.length > 0) { if (featureTagsToInsert.length > 0) {
const importedFeatureTags = await this.featureTagStore.tagFeatures( const importedFeatureTags =
featureTagsToInsert, await this.featureTagStore.tagFeatures(featureTagsToInsert);
);
const importedFeatureTagEvents = importedFeatureTags.map((tag) => ({ const importedFeatureTagEvents = importedFeatureTags.map((tag) => ({
type: FEATURE_TAG_IMPORT, type: FEATURE_TAG_IMPORT,
createdBy: userName, createdBy: userName,
@ -643,9 +641,8 @@ export default class StateService {
: true, : true,
); );
if (tagTypesToInsert.length > 0) { if (tagTypesToInsert.length > 0) {
const importedTagTypes = await this.tagTypeStore.bulkImport( const importedTagTypes =
tagTypesToInsert, await this.tagTypeStore.bulkImport(tagTypesToInsert);
);
const importedTagTypeEvents = importedTagTypes.map((tagType) => ({ const importedTagTypeEvents = importedTagTypes.map((tagType) => ({
type: TAG_TYPE_IMPORT, type: TAG_TYPE_IMPORT,
createdBy: userName, createdBy: userName,

View File

@ -404,9 +404,8 @@ class UserService {
} }
async getUserForToken(token: string): Promise<TokenUserSchema> { async getUserForToken(token: string): Promise<TokenUserSchema> {
const { createdBy, userId } = await this.resetTokenService.isValid( const { createdBy, userId } =
token, await this.resetTokenService.isValid(token);
);
const user = await this.getUser(userId); const user = await this.getUser(userId);
const role = await this.accessService.getRoleData(user.rootRole); const role = await this.accessService.getRoleData(user.rootRole);
return { return {

View File

@ -25,9 +25,8 @@ beforeAll(async () => {
}); });
afterEach(async () => { afterEach(async () => {
const all = await db.stores.projectStore.getEnvironmentsForProject( const all =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
await Promise.all( await Promise.all(
all all
.filter((env) => env.environment !== DEFAULT_ENV) .filter((env) => env.environment !== DEFAULT_ENV)
@ -56,9 +55,8 @@ test('Should add environment to project', async () => {
.send({ environment: 'test' }) .send({ environment: 'test' })
.expect(200); .expect(200);
const envs = await db.stores.projectStore.getEnvironmentsForProject( const envs =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
const environment = envs.find((env) => env.environment === 'test'); 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}`) .delete(`/api/admin/projects/default/environments/${name}`)
.expect(200); .expect(200);
const envs = await db.stores.projectStore.getEnvironmentsForProject( const envs =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
expect(envs).toHaveLength(1); 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( const envs =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
expect(envs).toHaveLength(1); expect(envs).toHaveLength(1);
}); });
@ -132,9 +128,8 @@ test('Should add default strategy to environment', async () => {
}) })
.expect(200); .expect(200);
const envs = await db.stores.projectStore.getEnvironmentsForProject( const envs =
'default', await db.stores.projectStore.getEnvironmentsForProject('default');
);
expect(envs).toHaveLength(1); expect(envs).toHaveLength(1);
expect(envs[0]).toStrictEqual({ expect(envs[0]).toStrictEqual({

View File

@ -330,7 +330,8 @@ test(`Importing version 2 replaces :global: environment with 'default'`, async (
.expect(202); .expect(202);
const env = await app.services.environmentService.get(DEFAULT_ENV); const env = await app.services.environmentService.get(DEFAULT_ENV);
expect(env).toBeTruthy(); expect(env).toBeTruthy();
const feature = await app.services.featureToggleServiceV2.getFeatureToggle( const feature =
await app.services.featureToggleServiceV2.getFeatureToggle(
'this-is-fun', 'this-is-fun',
); );
expect(feature.environments).toHaveLength(1); expect(feature.environments).toHaveLength(1);

View File

@ -1165,9 +1165,8 @@ test('if user has two roles user has union of permissions from the two roles', a
secondRole.id, secondRole.id,
]); ]);
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
const permissionNameSet = new Set( const permissionNameSet = new Set(
assignedPermissions.map((p) => p.permission), assignedPermissions.map((p) => p.permission),
); );
@ -1206,9 +1205,8 @@ test('calling set for user overwrites existing roles', async () => {
secondRole.id, secondRole.id,
]); ]);
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
const permissionNameSet = new Set( const permissionNameSet = new Set(
assignedPermissions.map((p) => p.permission), assignedPermissions.map((p) => p.permission),
); );
@ -1219,9 +1217,8 @@ test('calling set for user overwrites existing roles', async () => {
firstRole.id, firstRole.id,
]); ]);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(2); expect(newAssignedPermissions.length).toBe(2);
expect(newAssignedPermissions).toContainEqual({ expect(newAssignedPermissions).toContainEqual({
@ -1271,9 +1268,8 @@ test('if group has two roles user has union of permissions from the two roles',
'testusr', 'testusr',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
const permissionNameSet = new Set( const permissionNameSet = new Set(
assignedPermissions.map((p) => p.permission), assignedPermissions.map((p) => p.permission),
); );
@ -1318,9 +1314,8 @@ test('calling set for group overwrites existing roles', async () => {
'testusr', 'testusr',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
const permissionNameSet = new Set( const permissionNameSet = new Set(
assignedPermissions.map((p) => p.permission), assignedPermissions.map((p) => p.permission),
); );
@ -1334,9 +1329,8 @@ test('calling set for group overwrites existing roles', async () => {
'testusr', 'testusr',
); );
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(2); expect(newAssignedPermissions.length).toBe(2);
expect(newAssignedPermissions).toContainEqual({ expect(newAssignedPermissions).toContainEqual({
@ -1373,9 +1367,8 @@ test('group with root role can be assigned a project specific role', async () =>
'testusr', 'testusr',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(assignedPermissions).toContainEqual({ expect(assignedPermissions).toContainEqual({
project: projectName, project: projectName,
@ -1397,9 +1390,8 @@ test('calling add access with invalid project role ids should not assign those r
'some-admin-user', 'some-admin-user',
); );
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); expect(newAssignedPermissions.length).toBe(0);
}); });
@ -1415,9 +1407,8 @@ test('calling set roles for user with invalid project role ids should not assign
9999, 9999,
]); ]);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); 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, role.id,
]); ]);
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(assignedPermissions.length).toBe(1); expect(assignedPermissions.length).toBe(1);
await accessService.setProjectRolesForUser(projectName, emptyUser.id, []); await accessService.setProjectRolesForUser(projectName, emptyUser.id, []);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); 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, firstRole.id,
]); ]);
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(assignedPermissions.length).toBe(3); expect(assignedPermissions.length).toBe(3);
await accessService.setProjectRolesForUser(projectName, adminUser.id, []); await accessService.setProjectRolesForUser(projectName, adminUser.id, []);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(newAssignedPermissions.length).toBe(1); expect(newAssignedPermissions.length).toBe(1);
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN); expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);
@ -1514,17 +1501,15 @@ test('remove user access should remove all project roles', async () => {
secondRole.id, secondRole.id,
]); ]);
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(assignedPermissions.length).toBe(3); expect(assignedPermissions.length).toBe(3);
await accessService.removeUserAccess(projectName, emptyUser.id); await accessService.removeUserAccess(projectName, emptyUser.id);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); expect(newAssignedPermissions.length).toBe(0);
}); });
@ -1556,17 +1541,15 @@ test('remove user access should remove all project roles, while leaving root rol
secondRole.id, secondRole.id,
]); ]);
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(assignedPermissions.length).toBe(4); expect(assignedPermissions.length).toBe(4);
await accessService.removeUserAccess(projectName, adminUser.id); await accessService.removeUserAccess(projectName, adminUser.id);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(newAssignedPermissions.length).toBe(1); expect(newAssignedPermissions.length).toBe(1);
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN); 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', 'admin',
); );
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); expect(newAssignedPermissions.length).toBe(0);
}); });
@ -1618,9 +1600,8 @@ test('calling set roles for group with empty role array removes all roles', asyn
'admin', 'admin',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(assignedPermissions.length).toBe(1); expect(assignedPermissions.length).toBe(1);
@ -1631,9 +1612,8 @@ test('calling set roles for group with empty role array removes all roles', asyn
'admin', 'admin',
); );
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); 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', 'admin',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(assignedPermissions.length).toBe(3); 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', 'admin',
); );
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(newAssignedPermissions.length).toBe(1); expect(newAssignedPermissions.length).toBe(1);
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN); expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);
@ -1717,17 +1695,15 @@ test('remove group access should remove all project roles', async () => {
'admin', 'admin',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(assignedPermissions.length).toBe(3); expect(assignedPermissions.length).toBe(3);
await accessService.removeGroupAccess(projectName, group.id); await accessService.removeGroupAccess(projectName, group.id);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
emptyUser, await accessService.getPermissionsForUser(emptyUser);
);
expect(newAssignedPermissions.length).toBe(0); expect(newAssignedPermissions.length).toBe(0);
}); });
@ -1764,17 +1740,15 @@ test('remove group access should remove all project roles, while leaving root ro
'admin', 'admin',
); );
const assignedPermissions = await accessService.getPermissionsForUser( const assignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(assignedPermissions.length).toBe(4); expect(assignedPermissions.length).toBe(4);
await accessService.removeGroupAccess(projectName, group.id); await accessService.removeGroupAccess(projectName, group.id);
const newAssignedPermissions = await accessService.getPermissionsForUser( const newAssignedPermissions =
adminUser, await accessService.getPermissionsForUser(adminUser);
);
expect(newAssignedPermissions.length).toBe(1); expect(newAssignedPermissions.length).toBe(1);
expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN); expect(newAssignedPermissions[0].permission).toBe(permissions.ADMIN);

View File

@ -816,6 +816,7 @@ describe('the playground service (e2e)', () => {
segment.result === true, segment.result === true,
), ),
).toBeTruthy(); ).toBeTruthy();
break;
case false: case false:
// empty -- all segments can be true and // empty -- all segments can be true and
// the toggle still not enabled. We // the toggle still not enabled. We

View File

@ -58,9 +58,8 @@ test('Project with no stale toggles should have 100% health rating', async () =>
description: 'new too', description: 'new too',
stale: false, stale: false,
}); });
const rating = await projectHealthService.calculateHealthRating( const rating =
savedProject, await projectHealthService.calculateHealthRating(savedProject);
);
expect(rating).toBe(100); 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', description: 'stale too',
stale: true, stale: true,
}); });
const rating = await projectHealthService.calculateHealthRating( const rating =
savedProject, await projectHealthService.calculateHealthRating(savedProject);
);
expect(rating).toBe(50); expect(rating).toBe(50);
}); });
@ -121,8 +119,7 @@ test('Project with one non-stale, one potentially stale and one stale should hav
description: 'stale', description: 'stale',
stale: true, stale: true,
}); });
const rating = await projectHealthService.calculateHealthRating( const rating =
savedProject, await projectHealthService.calculateHealthRating(savedProject);
);
expect(rating).toBe(33); expect(rating).toBe(33);
}); });

View File

@ -188,9 +188,8 @@ test('Importing states with deprecated strategies should keep their deprecated s
dropBeforeImport: true, dropBeforeImport: true,
keepExisting: false, keepExisting: false,
}); });
const deprecatedStrategy = await stores.strategyStore.get( const deprecatedStrategy =
'deprecatedstrat', await stores.strategyStore.get('deprecatedstrat');
);
expect(deprecatedStrategy.deprecated).toBe(true); expect(deprecatedStrategy.deprecated).toBe(true);
}); });

View File

@ -188,9 +188,8 @@ test('Should get toggle metrics', async () => {
} }
await clientMetricsStore.batchInsertMetrics(metrics); await clientMetricsStore.batchInsertMetrics(metrics);
const savedMetrics = await clientMetricsStore.getMetricsForFeatureToggle( const savedMetrics =
'demo', await clientMetricsStore.getMetricsForFeatureToggle('demo');
);
expect(savedMetrics).toHaveLength(1); expect(savedMetrics).toHaveLength(1);
expect(savedMetrics[0].yes).toBe(4950); expect(savedMetrics[0].yes).toBe(4950);

View File

@ -616,47 +616,47 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@biomejs/biome@1.2.2": "@biomejs/biome@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.2.2.tgz#cfcceae7f4e55ef057a9b9576ef89563ca0c6d07" resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.3.3.tgz#aeec38fcc5fe2f9ec299c4f66512cc7bd0044ee8"
integrity sha512-fXwXi56ZdaKO/N3rTmhWw41UxstoviODk+wia4WWNSlm23r8xJ/NxjaZ88scV2IsmsFHqc8rmwb2dkrStAdIEw== integrity sha512-vTJn7RBzLWIabUuUIoEopO860YyBrbPEu4Pztfd28jRU5QD074hKZ9IQs24pFO6A2R296gaeYmN62f4u7pUruQ==
optionalDependencies: optionalDependencies:
"@biomejs/cli-darwin-arm64" "1.2.2" "@biomejs/cli-darwin-arm64" "1.3.3"
"@biomejs/cli-darwin-x64" "1.2.2" "@biomejs/cli-darwin-x64" "1.3.3"
"@biomejs/cli-linux-arm64" "1.2.2" "@biomejs/cli-linux-arm64" "1.3.3"
"@biomejs/cli-linux-x64" "1.2.2" "@biomejs/cli-linux-x64" "1.3.3"
"@biomejs/cli-win32-arm64" "1.2.2" "@biomejs/cli-win32-arm64" "1.3.3"
"@biomejs/cli-win32-x64" "1.2.2" "@biomejs/cli-win32-x64" "1.3.3"
"@biomejs/cli-darwin-arm64@1.2.2": "@biomejs/cli-darwin-arm64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.2.2.tgz#459a337f574d1a78d9d6a443fc00724d82804ffe" resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.3.3.tgz#2efd927d5eef7ce6c874cbda7c05243f689f2d8e"
integrity sha512-Fx1IURKhoqH6wPawtKLT6wcfMSjRRcNK8+VWau0iDOjXvNtjJpSmICbU89B7Vt/gZRwPqkfDMBkFwm6V5vFTSQ== integrity sha512-2X87ZfbmWwe4NGukrUvnoYdI//muSgjNUCAHJ2DO+kS1sB7kDy1s6PN/IYyTJuqRcJtDuOnSpaUDE7KxR1YhtA==
"@biomejs/cli-darwin-x64@1.2.2": "@biomejs/cli-darwin-x64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.2.2.tgz#892ea688b5d5ddbca9d0bc33c24aa2840a62b284" resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.3.3.tgz#abf6b08aac01503a56a85e12cf21057cf1edfe2a"
integrity sha512-JNaAFOI/ZisnmzvcFNd73geJxaFaN2L4YsWM6cgBeKyLY/ycl9C/PBTFfEmeB1c7f5XIIal8P2cj47kLJpN5Ig== integrity sha512-t+7DWTCbSgHOBcPsGKuwS1qh1z9zbXFK8i8ktE18yW7iF/W0zI62k44fYqYeFJKlb0Q08aqUvez3L+AQJFsn+w==
"@biomejs/cli-linux-arm64@1.2.2": "@biomejs/cli-linux-arm64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.2.2.tgz#b7a00f9d9e999daa36ee4581a37a0b13326ec899" resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.3.3.tgz#e76b00a50707c4c530306c7a6cdbdc3d32c2d86d"
integrity sha512-JHXRnfhOLx8UO/Fcyn2c5pFRri0XKqRZm2wf5oH5GSfLVpckDw2X15dYGbu3nmfM/3pcAaTV46pUpjrCnaAieg== integrity sha512-D8CvXaB8lkXXBQ6B3n0MXSSZFiE60+aNHorBLimVTtKiMod8QvAP425oQFZFul5wMXZqPLGTKFjXbAi/rvnc1A==
"@biomejs/cli-linux-x64@1.2.2": "@biomejs/cli-linux-x64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.2.2.tgz#4c55181f8231e7aa05b2841944a48dd81af443b8" resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.3.tgz#fd3e4ed41a42805ec289956b32eaec7b6a10aa2f"
integrity sha512-5Zr+iM7lUKsw81p9PkXRESuH2/AhRZ6RCWkgE+FSLcxMhXy/4RDR+o2YQDsJM6cWKIzOJM05vDHTGrDq7vXE4A== integrity sha512-bqB05fwJnRZwRlcm/BS/s4qPickqiXZkiU/nOYvHApfsPeqgSHgv5HWoBYuSUjgqBbX3XZJArsC5dCcVW7vAJw==
"@biomejs/cli-win32-arm64@1.2.2": "@biomejs/cli-win32-arm64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.2.2.tgz#6fa05d52903c3fff55bd693c5b1ca778504cd4cc" resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.3.3.tgz#d6f21a838ffc24d10193e70e5feb42c98fbb62fe"
integrity sha512-HvUcG2p++RvYP0zfOqh+DgiUUH+JI/uETr0kzWlOJ9F3lsG525pkywg4RSd4OvJd7Wpd3wt3UpN/A4IEJaVmbA== integrity sha512-muFOjAv1ONMfaJDlo4Ds+Qb9lkdSLM2XaxOe3AJPejSq3Vi0aRr51ZnE02BofMnL2sVsOA9cO54wibsuTcopbw==
"@biomejs/cli-win32-x64@1.2.2": "@biomejs/cli-win32-x64@1.3.3":
version "1.2.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.2.tgz#583e50d8a1a1cc81381200d3cb2f34669c6afd35" resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.3.tgz#0186fba137dc4c4d12680d93ab7e3d6bd3e8f57c"
integrity sha512-bfaFJwqJ9ApFga2o88OaROSd3pasYRzRGXHJWAE9VUUKdSNSTYxHOqVrNvV54yYPtL6Kt9xkuZa4HNu9it3TaA== integrity sha512-PMkMhS4smmmTMflxuZUx3REFSazEL9xsGscvZO1dKWI4ET23la+KxEM4TlSpjOyO66UerqSkuUlZecn0QhD63A==
"@colors/colors@1.5.0": "@colors/colors@1.5.0":
version "1.5.0" version "1.5.0"