1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +02:00

Fix: feature schema (#3456)

This commit is contained in:
Tymoteusz Czech 2023-04-07 11:16:00 +02:00 committed by GitHub
parent 2949db161f
commit 8f278cb726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 166 additions and 472 deletions

View File

@ -1,368 +0,0 @@
// Vitest Snapshot v1
exports[`renders correctly with one feature 1`] = `
[
<div>
<div
className="makeStyles-searchBarContainer-3"
>
<form
className="makeStyles-container-6"
role="search"
>
<div
className="makeStyles-search-7 makeStyles-searchBar-4"
>
<svg
aria-hidden={true}
className="MuiSvgIcon-root makeStyles-searchIcon-8"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
/>
</svg>
<div
className="MuiInputBase-root makeStyles-inputRoot-9"
onClick={[Function]}
onKeyPress={[Function]}
>
<input
aria-label="search"
className="MuiInputBase-input MuiInputBase-inputTypeSearch"
onAnimationStart={[Function]}
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
placeholder="Search..."
type="search"
value=""
/>
</div>
</div>
</form>
<a
href="/archive"
onClick={[Function]}
>
Archive
</a>
</div>
<div
className="MuiPaper-root MuiPaper-elevation1 MuiPaper-rounded"
style={
{
"borderRadius": "10px",
"boxShadow": "none",
}
}
>
<div
className="makeStyles-headerContainer-10"
>
<div
className="makeStyles-headerTitleContainer-14"
>
<div
className=""
data-loading={true}
>
<h1
className="MuiTypography-root makeStyles-headerTitle-15 MuiTypography-h1"
>
Feature toggles
</h1>
</div>
<div
className="makeStyles-headerActions-16"
>
<div
className="makeStyles-actionsContainer-1"
>
<div
className="makeStyles-actions-17"
>
<p
className="MuiTypography-root MuiTypography-body2"
data-loading={true}
>
Sorted by:
</p>
<button
aria-controls="sorting"
aria-haspopup="true"
className="MuiButtonBase-root MuiButton-root MuiButton-text"
data-loading={true}
disabled={false}
id="sorting"
onBlur={[Function]}
onClick={[Function]}
onDragLeave={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseDown={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
onTouchStart={[Function]}
style={
{
"fontWeight": "normal",
"textTransform": "lowercase",
}
}
tabIndex={0}
title="Sort by"
type="button"
>
<span
className="MuiButton-label"
>
By Name
<span
className="MuiButton-endIcon MuiButton-iconSizeMedium"
>
<span
aria-hidden={true}
className="material-icons MuiIcon-root"
>
<svg
className="MuiSvgIcon-root"
focusable="false"
role="img"
viewBox="0 0 24 24"
>
<path
d="M7 10l5 5 5-5z"
/>
<title>
Toggle
</title>
</svg>
</span>
</span>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
<div
className="makeStyles-bodyContainer-11"
>
<ul
className="MuiList-root MuiList-padding"
>
<ListItem
feature={
{
"name": "Another",
"reviveName": "Another",
}
}
flags={{}}
hasAccess={[Function]}
/>
</ul>
</div>
</div>
</div>,
<div
aria-atomic={true}
aria-live="polite"
className="makeStyles-container-18"
data-testid="ANNOUNCER_ELEMENT_TEST_ID"
role="status"
/>,
]
`;
exports[`renders correctly with one feature without permissions 1`] = `
[
<div>
<div
className="makeStyles-searchBarContainer-3"
>
<form
className="makeStyles-container-6"
role="search"
>
<div
className="makeStyles-search-7 makeStyles-searchBar-4"
>
<svg
aria-hidden={true}
className="MuiSvgIcon-root makeStyles-searchIcon-8"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
/>
</svg>
<div
className="MuiInputBase-root makeStyles-inputRoot-9"
onClick={[Function]}
onKeyPress={[Function]}
>
<input
aria-label="search"
className="MuiInputBase-input MuiInputBase-inputTypeSearch"
onAnimationStart={[Function]}
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
placeholder="Search..."
type="search"
value=""
/>
</div>
</div>
</form>
<a
href="/archive"
onClick={[Function]}
>
Archive
</a>
</div>
<div
className="MuiPaper-root MuiPaper-elevation1 MuiPaper-rounded"
style={
{
"borderRadius": "10px",
"boxShadow": "none",
}
}
>
<div
className="makeStyles-headerContainer-10"
>
<div
className="makeStyles-headerTitleContainer-14"
>
<div
className=""
data-loading={true}
>
<h1
className="MuiTypography-root makeStyles-headerTitle-15 MuiTypography-h1"
>
Feature toggles
</h1>
</div>
<div
className="makeStyles-headerActions-16"
>
<div
className="makeStyles-actionsContainer-1"
>
<div
className="makeStyles-actions-17"
>
<p
className="MuiTypography-root MuiTypography-body2"
data-loading={true}
>
Sorted by:
</p>
<button
aria-controls="sorting"
aria-haspopup="true"
className="MuiButtonBase-root MuiButton-root MuiButton-text"
data-loading={true}
disabled={false}
id="sorting"
onBlur={[Function]}
onClick={[Function]}
onDragLeave={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseDown={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
onTouchStart={[Function]}
style={
{
"fontWeight": "normal",
"textTransform": "lowercase",
}
}
tabIndex={0}
title="Sort by"
type="button"
>
<span
className="MuiButton-label"
>
By Name
<span
className="MuiButton-endIcon MuiButton-iconSizeMedium"
>
<span
aria-hidden={true}
className="material-icons MuiIcon-root"
>
<svg
className="MuiSvgIcon-root"
focusable="false"
role="img"
viewBox="0 0 24 24"
>
<path
d="M7 10l5 5 5-5z"
/>
<title>
Toggle
</title>
</svg>
</span>
</span>
</span>
<span
className="MuiTouchRipple-root"
/>
</button>
</div>
</div>
</div>
</div>
</div>
<div
className="makeStyles-bodyContainer-11"
>
<ul
className="MuiList-root MuiList-padding"
>
<ListItem
feature={
{
"name": "Another",
"reviveName": "Another",
}
}
flags={{}}
hasAccess={[Function]}
/>
</ul>
</div>
</div>
</div>,
<div
aria-atomic={true}
aria-live="polite"
className="makeStyles-container-18"
data-testid="ANNOUNCER_ELEMENT_TEST_ID"
role="status"
>
Navigated to Feature toggles
</div>,
]
`;

View File

@ -3,9 +3,14 @@
* Do not edit manually. * Do not edit manually.
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { CreateProjectSchemaMode } from './createProjectSchemaMode';
export interface CreateProjectSchema { export interface CreateProjectSchema {
id: string; id: string;
name: string; name: string;
description?: string; description?: string;
/** A mode of the project affecting what actions are possible in this project */
mode?: CreateProjectSchemaMode;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: string;
} }

View File

@ -0,0 +1,17 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A mode of the project affecting what actions are possible in this project
*/
export type CreateProjectSchemaMode =
typeof CreateProjectSchemaMode[keyof typeof CreateProjectSchemaMode];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const CreateProjectSchemaMode = {
open: 'open',
protected: 'protected',
} as const;

View File

@ -4,12 +4,22 @@
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
/**
* Describes a project's configuration in a given environment.
*/
export interface EnvironmentProjectSchema { export interface EnvironmentProjectSchema {
/** The name of the environment */
name: string; name: string;
/** The [type of environment](https://docs.getunleash.io/reference/environments#environment-types). */
type: string; type: string;
/** `true` if the environment is enabled for the project, otherwise `false` */
enabled: boolean; enabled: boolean;
protected?: boolean; /** `true` if the environment is protected, otherwise `false`. A *protected* environment can not be deleted. */
sortOrder?: number; protected: boolean;
projectApiTokenCount?: number | null; /** Priority of the environment in a list of environments, the lower the value, the higher up in the list the environment will appear */
projectEnabledToggleCount?: number | null; sortOrder: number;
/** The number of client and front-end API tokens that have access to this project */
projectApiTokenCount?: number;
/** The number of features enabled in this environment for this project */
projectEnabledToggleCount?: number;
} }

View File

@ -10,13 +10,14 @@
export interface EnvironmentSchema { export interface EnvironmentSchema {
/** The name of the environment */ /** The name of the environment */
name: string; name: string;
/** The type of the environment */ /** The [type of environment](https://docs.getunleash.io/reference/environments#environment-types). */
type: string; type: string;
/** `true` if the environment is enabled for the project, otherwise `false`. */ /** `true` if the environment is enabled for the project, otherwise `false`. */
enabled: boolean; enabled: boolean;
protected?: boolean; /** `true` if the environment is protected, otherwise `false`. A *protected* environment can not be deleted. */
/** The sort order of the environment in the environments list */ protected: boolean;
sortOrder?: number; /** Priority of the environment in a list of environments, the lower the value, the higher up in the list the environment will appear. Needs to be an integer */
sortOrder: number;
/** The number of projects with this environment */ /** The number of projects with this environment */
projectCount?: number | null; projectCount?: number | null;
/** The number of API tokens for the project environment */ /** The number of API tokens for the project environment */

View File

@ -5,6 +5,9 @@
*/ */
import type { EnvironmentProjectSchema } from './environmentProjectSchema'; import type { EnvironmentProjectSchema } from './environmentProjectSchema';
/**
* Environments defined for a given project
*/
export interface EnvironmentsProjectSchema { export interface EnvironmentsProjectSchema {
version: number; version: number;
environments: EnvironmentProjectSchema[]; environments: EnvironmentProjectSchema[];

View File

@ -31,9 +31,15 @@ export interface FeatureSchema {
lastSeenAt?: string | null; lastSeenAt?: string | null;
/** The list of environments where the feature can be used */ /** The list of environments where the feature can be used */
environments?: FeatureEnvironmentSchema[]; environments?: FeatureEnvironmentSchema[];
/** The list of feature variants */ /**
* The list of feature variants
* @deprecated
*/
variants?: VariantSchema[]; variants?: VariantSchema[];
/** This is a legacy field that will be deprecated */ /**
* This is a legacy field that will be deprecated
* @deprecated
*/
strategies?: FeatureSchemaStrategiesItem[]; strategies?: FeatureSchemaStrategiesItem[];
/** The list of feature tags */ /** The list of feature tags */
tags?: TagSchema[] | null; tags?: TagSchema[] | null;

View File

@ -3,7 +3,6 @@
* Do not edit manually. * Do not edit manually.
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { HealthOverviewSchemaDefaultStickiness } from './healthOverviewSchemaDefaultStickiness';
import type { HealthOverviewSchemaMode } from './healthOverviewSchemaMode'; import type { HealthOverviewSchemaMode } from './healthOverviewSchemaMode';
import type { FeatureSchema } from './featureSchema'; import type { FeatureSchema } from './featureSchema';
import type { ProjectStatsSchema } from './projectStatsSchema'; import type { ProjectStatsSchema } from './projectStatsSchema';
@ -13,8 +12,8 @@ export interface HealthOverviewSchema {
name: string; name: string;
description?: string | null; description?: string | null;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */ /** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: HealthOverviewSchemaDefaultStickiness; defaultStickiness?: string;
/** A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` */ /** The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not. */
mode?: HealthOverviewSchemaMode; mode?: HealthOverviewSchemaMode;
members?: number; members?: number;
health?: number; health?: number;

View File

@ -1,19 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy
*/
export type HealthOverviewSchemaDefaultStickiness =
typeof HealthOverviewSchemaDefaultStickiness[keyof typeof HealthOverviewSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const HealthOverviewSchemaDefaultStickiness = {
default: 'default',
userId: 'userId',
sessionId: 'sessionId',
random: 'random',
} as const;

View File

@ -5,7 +5,7 @@
*/ */
/** /**
* A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` * The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not.
*/ */
export type HealthOverviewSchemaMode = export type HealthOverviewSchemaMode =
typeof HealthOverviewSchemaMode[keyof typeof HealthOverviewSchemaMode]; typeof HealthOverviewSchemaMode[keyof typeof HealthOverviewSchemaMode];
@ -14,5 +14,4 @@ export type HealthOverviewSchemaMode =
export const HealthOverviewSchemaMode = { export const HealthOverviewSchemaMode = {
open: 'open', open: 'open',
protected: 'protected', protected: 'protected',
null: null,
} as const; } as const;

View File

@ -3,7 +3,6 @@
* Do not edit manually. * Do not edit manually.
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { HealthReportSchemaDefaultStickiness } from './healthReportSchemaDefaultStickiness';
import type { HealthReportSchemaMode } from './healthReportSchemaMode'; import type { HealthReportSchemaMode } from './healthReportSchemaMode';
import type { FeatureSchema } from './featureSchema'; import type { FeatureSchema } from './featureSchema';
import type { ProjectStatsSchema } from './projectStatsSchema'; import type { ProjectStatsSchema } from './projectStatsSchema';
@ -13,8 +12,8 @@ export interface HealthReportSchema {
name: string; name: string;
description?: string | null; description?: string | null;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */ /** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: HealthReportSchemaDefaultStickiness; defaultStickiness?: string;
/** A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` */ /** The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not. */
mode?: HealthReportSchemaMode; mode?: HealthReportSchemaMode;
members?: number; members?: number;
health?: number; health?: number;

View File

@ -1,19 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy
*/
export type HealthReportSchemaDefaultStickiness =
typeof HealthReportSchemaDefaultStickiness[keyof typeof HealthReportSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const HealthReportSchemaDefaultStickiness = {
default: 'default',
userId: 'userId',
sessionId: 'sessionId',
random: 'random',
} as const;

View File

@ -5,7 +5,7 @@
*/ */
/** /**
* A mode of the project affecting what actions are possible in this project. During a rollout of project modes this feature can be optional or `null` * The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not.
*/ */
export type HealthReportSchemaMode = export type HealthReportSchemaMode =
typeof HealthReportSchemaMode[keyof typeof HealthReportSchemaMode]; typeof HealthReportSchemaMode[keyof typeof HealthReportSchemaMode];
@ -14,5 +14,4 @@ export type HealthReportSchemaMode =
export const HealthReportSchemaMode = { export const HealthReportSchemaMode = {
open: 'open', open: 'open',
protected: 'protected', protected: 'protected',
null: null,
} as const; } as const;

View File

@ -78,6 +78,7 @@ export * from './createFeatureSchema';
export * from './createFeatureStrategySchema'; export * from './createFeatureStrategySchema';
export * from './createInvitedUserSchema'; export * from './createInvitedUserSchema';
export * from './createProjectSchema'; export * from './createProjectSchema';
export * from './createProjectSchemaMode';
export * from './createRoleWithPermissionsSchema'; export * from './createRoleWithPermissionsSchema';
export * from './createRoleWithPermissionsSchemaPermissionsItem'; export * from './createRoleWithPermissionsSchemaPermissionsItem';
export * from './createServiceAccountSchema'; export * from './createServiceAccountSchema';
@ -120,10 +121,8 @@ export * from './groupsSchema';
export * from './healthCheckSchema'; export * from './healthCheckSchema';
export * from './healthCheckSchemaHealth'; export * from './healthCheckSchemaHealth';
export * from './healthOverviewSchema'; export * from './healthOverviewSchema';
export * from './healthOverviewSchemaDefaultStickiness';
export * from './healthOverviewSchemaMode'; export * from './healthOverviewSchemaMode';
export * from './healthReportSchema'; export * from './healthReportSchema';
export * from './healthReportSchemaDefaultStickiness';
export * from './healthReportSchemaMode'; export * from './healthReportSchemaMode';
export * from './idSchema'; export * from './idSchema';
export * from './importTogglesSchema'; export * from './importTogglesSchema';
@ -179,11 +178,14 @@ export * from './playgroundStrategySchemaResultAnyOfFourEvaluationStatus';
export * from './profileSchema'; export * from './profileSchema';
export * from './projectAccessSchema'; export * from './projectAccessSchema';
export * from './projectCreatedSchema'; export * from './projectCreatedSchema';
export * from './projectCreatedSchemaMode';
export * from './projectEnvironmentSchema'; export * from './projectEnvironmentSchema';
export * from './projectOverviewSchema'; export * from './projectOverviewSchema';
export * from './projectSchema'; export * from './projectSchema';
export * from './projectSchemaDefaultStickiness';
export * from './projectSchemaMode'; export * from './projectSchemaMode';
export * from './projectSettingsSchema';
export * from './projectSettingsSchemaDefaultStickiness';
export * from './projectSettingsSchemaMode';
export * from './projectStatsSchema'; export * from './projectStatsSchema';
export * from './projectUsers'; export * from './projectUsers';
export * from './projectsSchema'; export * from './projectsSchema';

View File

@ -3,6 +3,7 @@
* Do not edit manually. * Do not edit manually.
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { ProjectCreatedSchemaMode } from './projectCreatedSchemaMode';
/** /**
* Details about the newly created project. * Details about the newly created project.
@ -14,4 +15,8 @@ export interface ProjectCreatedSchema {
name: string; name: string;
/** The project's description. */ /** The project's description. */
description?: string | null; description?: string | null;
/** A mode of the project affecting what actions are possible in this project */
mode?: ProjectCreatedSchemaMode;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: string;
} }

View File

@ -0,0 +1,17 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A mode of the project affecting what actions are possible in this project
*/
export type ProjectCreatedSchemaMode =
typeof ProjectCreatedSchemaMode[keyof typeof ProjectCreatedSchemaMode];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProjectCreatedSchemaMode = {
open: 'open',
protected: 'protected',
} as const;

View File

@ -4,7 +4,6 @@
* See `gen:api` script in package.json * See `gen:api` script in package.json
*/ */
import type { ProjectSchemaMode } from './projectSchemaMode'; import type { ProjectSchemaMode } from './projectSchemaMode';
import type { ProjectSchemaDefaultStickiness } from './projectSchemaDefaultStickiness';
/** /**
* A definition of the project used for projects listing purposes * A definition of the project used for projects listing purposes
@ -26,8 +25,8 @@ export interface ProjectSchema {
updatedAt?: string | null; updatedAt?: string | null;
/** `true` if the project was favorited, otherwise `false`. */ /** `true` if the project was favorited, otherwise `false`. */
favorite?: boolean; favorite?: boolean;
/** A mode of the project affecting what actions are possible in this project */ /** The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not. */
mode?: ProjectSchemaMode; mode?: ProjectSchemaMode;
/** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */ /** A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy */
defaultStickiness?: ProjectSchemaDefaultStickiness; defaultStickiness?: string;
} }

View File

@ -1,19 +0,0 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* A default stickiness for the project affecting the default stickiness value for variants and Gradual Rollout strategy
*/
export type ProjectSchemaDefaultStickiness =
typeof ProjectSchemaDefaultStickiness[keyof typeof ProjectSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProjectSchemaDefaultStickiness = {
default: 'default',
userId: 'userId',
sessionId: 'sessionId',
random: 'random',
} as const;

View File

@ -5,7 +5,7 @@
*/ */
/** /**
* A mode of the project affecting what actions are possible in this project * The project's [collaboration mode](https://docs.getunleash.io/reference/project-collaboration-mode). Determines whether non-project members can submit change requests or not.
*/ */
export type ProjectSchemaMode = export type ProjectSchemaMode =
typeof ProjectSchemaMode[keyof typeof ProjectSchemaMode]; typeof ProjectSchemaMode[keyof typeof ProjectSchemaMode];

View File

@ -0,0 +1,13 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
import type { ProjectSettingsSchemaDefaultStickiness } from './projectSettingsSchemaDefaultStickiness';
import type { ProjectSettingsSchemaMode } from './projectSettingsSchemaMode';
export interface ProjectSettingsSchema {
/** Default stickiness for project */
defaultStickiness: ProjectSettingsSchemaDefaultStickiness;
mode: ProjectSettingsSchemaMode;
}

View File

@ -0,0 +1,20 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
/**
* Default stickiness for project
*/
export type ProjectSettingsSchemaDefaultStickiness =
typeof ProjectSettingsSchemaDefaultStickiness[keyof typeof ProjectSettingsSchemaDefaultStickiness];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProjectSettingsSchemaDefaultStickiness = {
default: 'default',
sessionId: 'sessionId',
userId: 'userId',
random: 'random',
null: null,
} as const;

View File

@ -0,0 +1,15 @@
/**
* Generated by Orval
* Do not edit manually.
* See `gen:api` script in package.json
*/
export type ProjectSettingsSchemaMode =
typeof ProjectSettingsSchemaMode[keyof typeof ProjectSettingsSchemaMode];
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const ProjectSettingsSchemaMode = {
open: 'open',
protected: 'protected',
null: null,
} as const;

View File

@ -466,10 +466,12 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
let selectColumns = [ let selectColumns = [
'features.name as feature_name', 'features.name as feature_name',
'features.description as description',
'features.type as type', 'features.type as type',
'features.created_at as created_at', 'features.created_at as created_at',
'features.last_seen_at as last_seen_at', 'features.last_seen_at as last_seen_at',
'features.stale as stale', 'features.stale as stale',
'features.impression_data as impression_data',
'feature_environments.enabled as enabled', 'feature_environments.enabled as enabled',
'feature_environments.environment as environment', 'feature_environments.environment as environment',
'feature_environments.variants as variants', 'feature_environments.variants as variants',
@ -499,28 +501,30 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
const rows = await query; const rows = await query;
if (rows.length > 0) { if (rows.length > 0) {
const overview = rows.reduce((acc, r) => { const overview = rows.reduce((acc, row) => {
if (acc[r.feature_name] !== undefined) { if (acc[row.feature_name] !== undefined) {
acc[r.feature_name].environments.push( acc[row.feature_name].environments.push(
FeatureStrategiesStore.getEnvironment(r), FeatureStrategiesStore.getEnvironment(row),
); );
if (this.isNewTag(acc[r.feature_name], r)) { if (this.isNewTag(acc[row.feature_name], row)) {
this.addTag(acc[r.feature_name], r); this.addTag(acc[row.feature_name], row);
} }
} else { } else {
acc[r.feature_name] = { acc[row.feature_name] = {
type: r.type, type: row.type,
favorite: r.favorite, description: row.description,
name: r.feature_name, favorite: row.favorite,
createdAt: r.created_at, name: row.feature_name,
lastSeenAt: r.last_seen_at, createdAt: row.created_at,
stale: r.stale, lastSeenAt: row.last_seen_at,
stale: row.stale,
impressionData: row.impression_data,
environments: [ environments: [
FeatureStrategiesStore.getEnvironment(r), FeatureStrategiesStore.getEnvironment(row),
], ],
}; };
if (this.isNewTag(acc[r.feature_name], r)) { if (this.isNewTag(acc[row.feature_name], row)) {
this.addTag(acc[r.feature_name], r); this.addTag(acc[row.feature_name], row);
} }
} }
return acc; return acc;

View File

@ -34,8 +34,7 @@ export const featureSchema = {
archived: { archived: {
type: 'boolean', type: 'boolean',
example: true, example: true,
description: description: '`true` if the feature is archived',
'`true` if the feature is archived, otherwise `false`.',
}, },
project: { project: {
type: 'string', type: 'string',
@ -96,6 +95,7 @@ export const featureSchema = {
$ref: '#/components/schemas/variantSchema', $ref: '#/components/schemas/variantSchema',
}, },
description: 'The list of feature variants', description: 'The list of feature variants',
deprecated: true,
}, },
strategies: { strategies: {
type: 'array', type: 'array',
@ -103,6 +103,7 @@ export const featureSchema = {
type: 'object', type: 'object',
}, },
description: 'This is a legacy field that will be deprecated', description: 'This is a legacy field that will be deprecated',
deprecated: true,
}, },
tags: { tags: {
type: 'array', type: 'array',

View File

@ -417,7 +417,10 @@ export default class ProjectFeaturesController extends Controller {
): Promise<void> { ): Promise<void> {
const { projectId } = req.params; const { projectId } = req.params;
const query = await this.prepQuery(req.query, projectId); const query = await this.prepQuery(req.query, projectId);
const features = await this.featureService.getFeatureOverview(query); const features = await this.featureService.getFeatureOverview({
...query,
userId: req.user.id,
});
this.openApiService.respondWithValidation( this.openApiService.respondWithValidation(
200, 200,
res, res,

View File

@ -1459,7 +1459,7 @@ exports[`should serve the OpenAPI spec 1`] = `
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"archived": { "archived": {
"description": "\`true\` if the feature is archived, otherwise \`false\`.", "description": "\`true\` if the feature is archived",
"example": true, "example": true,
"type": "boolean", "type": "boolean",
}, },
@ -1524,6 +1524,7 @@ exports[`should serve the OpenAPI spec 1`] = `
"type": "boolean", "type": "boolean",
}, },
"strategies": { "strategies": {
"deprecated": true,
"description": "This is a legacy field that will be deprecated", "description": "This is a legacy field that will be deprecated",
"items": { "items": {
"type": "object", "type": "object",
@ -1544,6 +1545,7 @@ exports[`should serve the OpenAPI spec 1`] = `
"type": "string", "type": "string",
}, },
"variants": { "variants": {
"deprecated": true,
"description": "The list of feature variants", "description": "The list of feature variants",
"items": { "items": {
"$ref": "#/components/schemas/variantSchema", "$ref": "#/components/schemas/variantSchema",