2022-04-25 14:17:59 +02:00
|
|
|
import { OpenAPIV3 } from 'openapi-types';
|
2022-11-17 12:02:40 +01:00
|
|
|
import {
|
2023-04-28 13:59:04 +02:00
|
|
|
addonCreateUpdateSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
addonParameterSchema,
|
|
|
|
addonSchema,
|
|
|
|
addonsSchema,
|
|
|
|
addonTypeSchema,
|
2023-05-23 16:56:34 +02:00
|
|
|
adminCountSchema,
|
2023-09-19 13:24:26 +02:00
|
|
|
adminSegmentSchema,
|
2023-04-28 13:59:04 +02:00
|
|
|
adminFeaturesQuerySchema,
|
2023-06-14 11:05:08 +02:00
|
|
|
advancedPlaygroundRequestSchema,
|
|
|
|
advancedPlaygroundResponseSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
apiTokenSchema,
|
|
|
|
apiTokensSchema,
|
|
|
|
applicationSchema,
|
2023-08-23 11:00:22 +02:00
|
|
|
applicationUsageSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
applicationsSchema,
|
2023-03-15 07:37:06 +01:00
|
|
|
batchFeaturesSchema,
|
2023-05-17 10:21:08 +02:00
|
|
|
bulkToggleFeaturesSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
changePasswordSchema,
|
|
|
|
clientApplicationSchema,
|
|
|
|
clientFeatureSchema,
|
|
|
|
clientFeaturesQuerySchema,
|
|
|
|
clientFeaturesSchema,
|
|
|
|
clientMetricsSchema,
|
|
|
|
cloneFeatureSchema,
|
|
|
|
constraintSchema,
|
|
|
|
contextFieldSchema,
|
|
|
|
contextFieldsSchema,
|
|
|
|
createApiTokenSchema,
|
|
|
|
createFeatureSchema,
|
|
|
|
createFeatureStrategySchema,
|
|
|
|
createInvitedUserSchema,
|
|
|
|
createUserSchema,
|
|
|
|
dateSchema,
|
|
|
|
edgeTokenSchema,
|
|
|
|
emailSchema,
|
|
|
|
environmentProjectSchema,
|
|
|
|
environmentSchema,
|
|
|
|
environmentsProjectSchema,
|
|
|
|
environmentsSchema,
|
|
|
|
eventSchema,
|
|
|
|
eventsSchema,
|
2023-01-11 16:00:20 +01:00
|
|
|
exportQuerySchema,
|
2023-04-28 13:59:04 +02:00
|
|
|
exportResultSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
featureEnvironmentMetricsSchema,
|
|
|
|
featureEnvironmentSchema,
|
|
|
|
featureEventsSchema,
|
|
|
|
featureMetricsSchema,
|
|
|
|
featureSchema,
|
|
|
|
featuresSchema,
|
|
|
|
featureStrategySchema,
|
|
|
|
featureStrategySegmentSchema,
|
|
|
|
featureTagSchema,
|
|
|
|
featureTypeSchema,
|
|
|
|
featureTypesSchema,
|
|
|
|
featureUsageSchema,
|
|
|
|
featureVariantsSchema,
|
2023-07-13 13:27:52 +02:00
|
|
|
feedbackCreateSchema,
|
|
|
|
feedbackUpdateSchema,
|
|
|
|
feedbackResponseSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
groupSchema,
|
|
|
|
groupsSchema,
|
|
|
|
groupUserModelSchema,
|
|
|
|
healthCheckSchema,
|
|
|
|
healthOverviewSchema,
|
|
|
|
healthReportSchema,
|
|
|
|
idSchema,
|
2023-04-28 13:59:04 +02:00
|
|
|
importTogglesSchema,
|
|
|
|
importTogglesValidateItemSchema,
|
|
|
|
importTogglesValidateSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
instanceAdminStatsSchema,
|
|
|
|
legalValueSchema,
|
|
|
|
loginSchema,
|
|
|
|
meSchema,
|
|
|
|
nameSchema,
|
|
|
|
overrideSchema,
|
|
|
|
parametersSchema,
|
|
|
|
passwordSchema,
|
|
|
|
patchesSchema,
|
|
|
|
patchSchema,
|
2024-02-01 15:28:46 +01:00
|
|
|
createPatSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
patSchema,
|
|
|
|
patsSchema,
|
|
|
|
permissionSchema,
|
|
|
|
playgroundConstraintSchema,
|
|
|
|
playgroundFeatureSchema,
|
|
|
|
playgroundRequestSchema,
|
|
|
|
playgroundResponseSchema,
|
|
|
|
playgroundSegmentSchema,
|
|
|
|
playgroundStrategySchema,
|
|
|
|
profileSchema,
|
|
|
|
projectEnvironmentSchema,
|
2023-04-28 13:59:04 +02:00
|
|
|
projectOverviewSchema,
|
2023-12-01 10:20:24 +01:00
|
|
|
deprecatedProjectOverviewSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
projectSchema,
|
|
|
|
projectsSchema,
|
2023-04-28 13:59:04 +02:00
|
|
|
projectStatsSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
proxyClientSchema,
|
|
|
|
proxyFeatureSchema,
|
|
|
|
proxyFeaturesSchema,
|
|
|
|
publicSignupTokenCreateSchema,
|
|
|
|
publicSignupTokenSchema,
|
|
|
|
publicSignupTokensSchema,
|
|
|
|
publicSignupTokenUpdateSchema,
|
2023-01-20 10:30:20 +01:00
|
|
|
pushVariantsSchema,
|
2022-12-12 14:05:56 +01:00
|
|
|
requestsPerSecondSchema,
|
|
|
|
requestsPerSecondSegmentedSchema,
|
2023-04-28 13:59:04 +02:00
|
|
|
resetPasswordSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
roleSchema,
|
|
|
|
sdkContextSchema,
|
2023-09-15 09:30:54 +02:00
|
|
|
sdkFlatContextSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
searchEventsSchema,
|
|
|
|
segmentSchema,
|
|
|
|
setStrategySortOrderSchema,
|
|
|
|
setUiConfigSchema,
|
|
|
|
sortOrderSchema,
|
2023-07-13 10:29:54 +02:00
|
|
|
splashRequestSchema,
|
|
|
|
splashResponseSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
stateSchema,
|
|
|
|
strategiesSchema,
|
|
|
|
strategySchema,
|
2023-03-08 09:07:06 +01:00
|
|
|
tagsBulkAddSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
tagSchema,
|
|
|
|
tagsSchema,
|
|
|
|
tagTypeSchema,
|
|
|
|
tagTypesSchema,
|
|
|
|
tagWithVersionSchema,
|
2023-04-14 15:39:39 +02:00
|
|
|
tokenStringListSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
tokenUserSchema,
|
|
|
|
uiConfigSchema,
|
|
|
|
updateApiTokenSchema,
|
|
|
|
updateFeatureSchema,
|
|
|
|
updateFeatureStrategySchema,
|
|
|
|
updateTagTypeSchema,
|
|
|
|
updateUserSchema,
|
2023-07-28 09:25:34 +02:00
|
|
|
createContextFieldSchema,
|
|
|
|
updateContextFieldSchema,
|
2023-03-15 14:58:19 +01:00
|
|
|
upsertSegmentSchema,
|
2023-07-04 14:21:09 +02:00
|
|
|
createStrategySchema,
|
|
|
|
updateStrategySchema,
|
2023-07-18 11:00:51 +02:00
|
|
|
updateFeatureTypeLifetimeSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
userSchema,
|
|
|
|
usersGroupsBaseSchema,
|
|
|
|
usersSchema,
|
2023-07-06 08:24:46 +02:00
|
|
|
createUserResponseSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
usersSearchSchema,
|
2023-04-14 15:39:39 +02:00
|
|
|
validatedEdgeTokensSchema,
|
2023-07-11 14:17:10 +02:00
|
|
|
validateFeatureSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
validatePasswordSchema,
|
|
|
|
validateTagTypeSchema,
|
|
|
|
variantSchema,
|
2023-05-18 10:38:59 +02:00
|
|
|
variantFlagSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
variantsSchema,
|
|
|
|
versionSchema,
|
2023-06-14 11:05:08 +02:00
|
|
|
advancedPlaygroundFeatureSchema,
|
feat/telemetry opt out (#4035)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->
Adds a UI that shows current status of version and feature usage
collection configuration, and a presence in the configuration menu +
menu bar.
Configuring these features is done by setting environment variables. The
version info collection is an existing feature that we're making more
visible, the feature usage collection feature is a new feature that has
it's own environment configuration but also depends on version info
collection being active to work.
When version collection is turned off and the experimental feature flag
for feature usage collection is turned off:
<img width="1269" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/435a07da-d238-4b5b-a150-07e3bd6b816f">
When version collection is turned on and the experimental feature flag
is off:
<img width="1249" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/8d1a76c5-99c9-4551-9a4f-86d477bbbf6f">
When the experimental feature flag is enabled, and version+telemetry is
turned off:
<img width="1239" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/e0bc532b-be94-4076-bee1-faef9bc48a5b">
When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned off:
<img width="1234" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/1bd190c1-08fe-4402-bde3-56f863a33289">
When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1229" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/848912cd-30bd-43cf-9b81-c58a4cbad1e4">
When version collection is turned off, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1241" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/d2b981f2-033f-4fae-a115-f93e0653729b">
---------
Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-30 08:43:58 +02:00
|
|
|
telemetrySettingsSchema,
|
2023-07-13 13:50:03 +02:00
|
|
|
strategyVariantSchema,
|
|
|
|
createStrategyVariantSchema,
|
2023-07-14 13:25:31 +02:00
|
|
|
clientSegmentSchema,
|
2023-07-24 11:05:55 +02:00
|
|
|
createGroupSchema,
|
2023-08-30 14:39:43 +02:00
|
|
|
doraFeaturesSchema,
|
|
|
|
projectDoraMetricsSchema,
|
2023-09-19 13:24:26 +02:00
|
|
|
segmentsSchema,
|
|
|
|
updateFeatureStrategySegmentsSchema,
|
2023-09-19 10:04:05 +02:00
|
|
|
dependentFeatureSchema,
|
|
|
|
createDependentFeatureSchema,
|
2023-09-26 14:03:24 +02:00
|
|
|
parentFeatureOptionsSchema,
|
2023-10-16 20:56:06 +02:00
|
|
|
dependenciesExistSchema,
|
2023-10-20 08:58:03 +02:00
|
|
|
validateArchiveFeaturesSchema,
|
2023-10-25 10:50:59 +02:00
|
|
|
searchFeaturesSchema,
|
2023-12-01 10:20:24 +01:00
|
|
|
featureTypeCountSchema,
|
2023-12-05 10:25:56 +01:00
|
|
|
featureSearchResponseSchema,
|
2024-02-05 14:07:38 +01:00
|
|
|
inactiveUserSchema,
|
|
|
|
inactiveUsersSchema,
|
|
|
|
idsSchema,
|
2022-11-17 12:02:40 +01:00
|
|
|
} from './spec';
|
2022-09-30 13:01:32 +02:00
|
|
|
import { IServerOption } from '../types';
|
2022-11-17 12:02:40 +01:00
|
|
|
import { mapValues, omitKeys } from '../util';
|
|
|
|
import { openApiTags } from './util';
|
2022-09-30 13:01:32 +02:00
|
|
|
import { URL } from 'url';
|
Fix(#1391): Expose API version even when not running via npm/yarn (#2062)
* Fix(#1391): Expose API version even when not running via npm/yarn
## What
Expose the current Unleash version in the generated OpenAPI docs, even
when running via docker or other processes.
## Why
An OpenAPI spec without a version isn't valid. This causes some of our
generation tools (such as the one for documentation) to fail.
## How
By changing how we fetch the current version:
Previously, we used `process.env.npm_package_version!`. However, when
you're not running with yarn or npm, this is `undefined`. That causes
the version number to not be included when running tests and when
running using the official docker image.
Instead, we now use `version` from `lib/util/version`. This is the
same version as the one used by the UI config endpoint, so it should
be the same one as what the front end displays. To the best of my
knowledge, this _is_ the version of the API.
## Discussion
It _may_ be that I have misunderstood what the version represents, but
from what I can tell, it just exports what's listed as the version in
package.json.
The source code of the `lib/util/version` file is:
```ts
// export module version
require('pkginfo')(module, 'version');
const { version } = module.exports;
export default version;
module.exports = version;
```
* Refactor(#1391): rename imported variable for clarity
2022-09-15 12:22:21 +02:00
|
|
|
import apiVersion from '../util/version';
|
2022-12-21 12:23:44 +01:00
|
|
|
import { maintenanceSchema } from './spec/maintenance-schema';
|
2023-04-10 09:55:29 +02:00
|
|
|
import { toggleMaintenanceSchema } from './spec/toggle-maintenance-schema';
|
2023-02-15 09:13:32 +01:00
|
|
|
import { bulkRegistrationSchema } from './spec/bulk-registration-schema';
|
|
|
|
import { bulkMetricsSchema } from './spec/bulk-metrics-schema';
|
2023-03-01 13:08:08 +01:00
|
|
|
import { clientMetricsEnvSchema } from './spec/client-metrics-env-schema';
|
2023-03-07 15:50:01 +01:00
|
|
|
import { updateTagsSchema } from './spec/update-tags-schema';
|
2023-03-15 07:37:06 +01:00
|
|
|
import { batchStaleSchema } from './spec/batch-stale-schema';
|
2023-04-26 12:10:57 +02:00
|
|
|
import { createApplicationSchema } from './spec/create-application-schema';
|
2023-06-09 11:00:17 +02:00
|
|
|
import { contextFieldStrategiesSchema } from './spec/context-field-strategies-schema';
|
2023-06-14 11:05:08 +02:00
|
|
|
import { advancedPlaygroundEnvironmentFeatureSchema } from './spec/advanced-playground-environment-feature-schema';
|
2023-09-04 13:53:33 +02:00
|
|
|
import { createFeatureNamingPatternSchema } from './spec/create-feature-naming-pattern-schema';
|
2023-12-11 12:01:47 +01:00
|
|
|
import { segmentStrategiesSchema } from './spec/segment-strategies-schema';
|
2023-10-12 11:56:10 +02:00
|
|
|
import { featureDependenciesSchema } from './spec/feature-dependencies-schema';
|
2022-06-08 08:01:14 +02:00
|
|
|
|
2023-04-14 10:37:17 +02:00
|
|
|
// Schemas must have an $id property on the form "#/components/schemas/mySchema".
|
chore(deps): update dependency @biomejs/biome to v1.4.0 (#5288)
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@biomejs/biome](https://biomejs.dev)
([source](https://togithub.com/biomejs/biome)) | [`1.3.3` ->
`1.4.0`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/1.3.3/1.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@biomejs%2fbiome/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@biomejs%2fbiome/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@biomejs%2fbiome/1.3.3/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@biomejs%2fbiome/1.3.3/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
---
### Release Notes
<details>
<summary>biomejs/biome (@​biomejs/biome)</summary>
###
[`v1.4.0`](https://togithub.com/biomejs/biome/blob/HEAD/CHANGELOG.md#140-2023-11-27)
[Compare
Source](https://togithub.com/biomejs/biome/compare/af24597c1877c7b5a96bb7cc59bab655a577116f...889593e3f983a6fec642d20eea3c7f94d58fc7e1)
##### CLI
- Remove the CLI options from the `lsp-proxy`, as they were never meant
to be passed to that command. Contributed by
[@​ematipico](https://togithub.com/ematipico)
- Add option `--config-path` to `lsp-proxy` and `start` commands. It's
now possible to tell the Daemon server to load `biome.json` from a
custom path. Contributed by
[@​ematipico](https://togithub.com/ematipico)
- Add new `--diagnostic-level` option to let users control the level of
diagnostics printed by the CLI. Possible values are: `"info"`, `"warn"`,
`"hint"`. Contributed by
[@​simonxabris](https://togithub.com/simonxabris)
- Add option `--line-feed` to the `format` command. Contributed by
[@​SuperchupuDev](https://togithub.com/SuperchupuDev)
- Add option `--bracket-same-line` to the `format` command. Contributed
by [@​faultyserve](https://togithub.com/faultyserve)
- Add option `--bracket-spacing` to the `format` command. Contributed by
[@​faultyserve](https://togithub.com/faultyserve)
##### Bug fixes
- Fix the command `format`, now it returns a non-zero exit code when if
there pending diffs. Contributed by
[@​ematipico](https://togithub.com/ematipico)
##### Configuration
- Add option `formatter.lineFeed`. Contributed by
[@​SuperchupuDev](https://togithub.com/SuperchupuDev)
- Add option `javascript.formatter.bracketSameLine`. Contributed by
[@​faultyserve](https://togithub.com/faultyserve)
- Add option `javascript.formatter.bracketSpacing`. Contributed by
[@​faultyserve](https://togithub.com/faultyserve)
##### Formatter
##### New features
- Add a new option
[`--line-ending`](https://biomejs.dev/reference/configuration/#formatterlineending).
This option allows changing the type of line endings. Contributed by
[@​SuperchupuDev](https://togithub.com/SuperchupuDev)
- Added a new option called `--bracket-spacing` to the formatter. This
option allows you to control whether spaces are inserted around the
brackets of object literals.
[#​627](https://togithub.com/biomejs/biome/issues/627).
Contributed by [@​faultyserver](https://togithub.com/faultyserver)
- Added a new option called `--bracket-same-line` to the formatter. This
option allows you to control whether spaces are inserted around the
brackets of object literals.
[#​627](https://togithub.com/biomejs/biome/issues/627).
Contributed by [@​faultyserver](https://togithub.com/faultyserver)
##### Bug fixes
- Fix [#​832](https://togithub.com/biomejs/biome/issues/832), the
formatter no longer keeps an unnecessary trailing comma in type
parameter lists. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​301](https://togithub.com/biomejs/biome/issues/301), the
formatter should not break before the `in` keyword. Contributed by
[@​ematipico](https://togithub.com/ematipico)
##### Linter
##### Promoted rules
-
[a11y/noInteractiveElementToNoninteractiveRole](https://biomejs.dev/linter/rules/no-interactive-element-to-noninteractive-role)
-
[complexity/noThisInStatic](https://biomejs.dev/linter/rules/no-this-in-static)
-
[complexity/useArrowFunction](https://biomejs.dev/linter/rules/use-arrow-function)
-
[correctness/noEmptyCharacterClassInRegex](https://biomejs.dev/linter/rules/no-empty-character-class-in-regex)
-
[correctness/noInvalidNewBuiltin](https://biomejs.dev/linter/rules/no-invalid-new-builtin)
-
[style/noUselessElse](https://biomejs.dev/linter/rules/no-useless-else)
-
[style/useAsConstAssertion](https://biomejs.dev/linter/rules/use-as-const-assertion)
-
[style/useShorthandAssign](https://biomejs.dev/linter/rules/use-shorthand-assign)
-
[suspicious/noApproximativeNumericConstant](https://biomejs.dev/linter/rules/no-approximative-numeric-constant)
-
[suspicious/noMisleadingInstantiator](https://biomejs.dev/linter/rules/no-misleading-instantiator)
-
[suspicious/noMisrefactoredShorthandAssign](https://biomejs.dev/linter/rules/no-misrefactored-shorthand-assign)
The following rules are now recommended:
- [a11y/noAccessKey](https://biomejs.dev/linter/rules/no-access-key)
-
[a11y/useHeadingContent](https://biomejs.dev/linter/rules/use-heading-content)
-
[complexity/useSimpleNumberKeys](https://biomejs.dev/linter/use-simple-number-keys)
The following rules are now deprecated:
-
[correctness/noNewSymbol](https://biomejs.dev/linter/rules/no-new-symbol)
The rule is replaced by
[correctness/noInvalidNewBuiltin](https://biomejs.dev/linter/rules/no-invalid-new-builtin)
##### New features
- Add
[noDefaultExport](https://biomejs.dev/linter/rules/no-default-export)
which disallows `export default`. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Add
[noAriaHiddenOnFocusable](https://biomejs.dev/linter/rules/no-aria-hidden-on-focusable)
which reports hidden and focusable elements. Contributed by
[@​vasucp1207](https://togithub.com/vasucp1207)
- Add
[noImplicitAnyLet](https://biomejs.dev/linter/rules/no-implicit-any-let)
that reports variables declared with `let` and without initialization
and type annotation. Contributed by
[@​TaKO8Ki](https://togithub.com/TaKO8Ki) and
[@​b4s36t4](https://togithub.com/b4s36t4)
- Add [useAwait](https://biomejs.dev/linter/rules/use-await) that
reports `async` functions that don't use an `await` expression.
- Add
[useValidAriaRole](https://biomejs.dev/linter/rules/use-valid-aria-role).
Contributed by [@​vasucp1207](https://togithub.com/vasucp1207)
- Add [useRegexLiterals](https://biomejs.dev/linter/use-regex-literals)
that suggests turning call to the regex constructor into regex literals.
COntributed by [@​Yuiki](https://togithub.com/Yuiki)
##### Enhancements
- Add an unsafe code fix for
[a11y/useAriaActivedescendantWithTabindex](https://biomejs.dev/linter/rules/use-aria-activedescendant-with-tabindex)
##### Bug fixes
- Fix [#​639](https://togithub.com/biomejs/biome/issues/639) by
ignoring unused TypeScript's mapped key. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​565](https://togithub.com/biomejs/biome/issues/565) by
handling several `infer` with the same name in extends clauses of
TypeScript's conditional types. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​653](https://togithub.com/biomejs/biome/issues/653).
[noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports)
now correctly removes the entire line where the unused `import` is.
Contributed by [@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​607](https://togithub.com/biomejs/biome/issues/609)
`useExhaustiveDependencies`, ignore optional chaining, Contributed by
[@​msdlisper](https://togithub.com/msdlisper)
- Fix [#​676](https://togithub.com/biomejs/biome/issues/676), by
using the correct node for the `"noreferrer"` when applying the code
action. Contributed by
[@​ematipico](https://togithub.com/ematipico)
- Fix [#​455](https://togithub.com/biomejs/biome/issues/455). The
CLI can now print complex emojis to the console correctly.
- Fix [#​727](https://togithub.com/biomejs/biome/issues/727).
[noInferrableTypes](https://biomejs.dev/linter/rules/no-inferrable-types)
now correctly keeps type annotations when the initialization expression
is `null`. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​784](https://togithub.com/biomejs/biome/issues/784),
[noSvgWithoutTitle](https://biomejs.dev/linter/rules/no-svg-without-title)
fixes false-positives to `aria-label` and reports svg's role attribute
is implicit. Contributed by
[@​unvalley](https://togithub.com/unvalley)
- Fix [#​834](https://togithub.com/biomejs/biome/issues/834) that
made
[noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements)
reports block statements of switch clauses. Contributed by
[@​vasucp1207](https://togithub.com/vasucp1207)
- Fix [#​783](https://togithub.com/biomejs/biome/issues/834) that
made
[noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements)
reports block statements of `try-catch` structures. Contributed by
[@​hougesen](https://togithub.com/hougesen)
- Fix [#​69](https://togithub.com/biomejs/biome/issues/69) that
made
[correctness/noUnnecessaryContinue](https://biomejs.dev/linter/rules/no-unnecessary-continue)
incorrectly reports a `continue` used to break a switch clause.
Contributed by [@​TaKO8Ki](https://togithub.com/TaKO8Ki)
- Fix [#​664](https://togithub.com/biomejs/biome/issues/664) by
improving the diagnostic of
[style/useNamingConvention](https://biomejs.dev/linter/use-naming-convention)
when double capital are detected in strict camel case mode. Contributed
by [@​vasucp1207](https://togithub.com/vasucp1207)
- Fix [#​643](https://togithub.com/biomejs/biome/issues/643) that
erroneously parsed the option of
[complexity/useExhaustiveDependencies](https://biomejs.dev/linter/use-naming-convention).
Contributed by [@​arendjr](https://togithub.com/arendjr)
##### Parser
##### Bug fixes
- Fix [#​846](https://togithub.com/biomejs/biome/issues/846) that
erroneously parsed `<const T,>() => {}` as a JSX tag instead of an arrow
function when both TypeScript and JSX are enabled.
##### VSCode
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Unleash/unleash).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.io>
2023-11-28 10:32:00 +01:00
|
|
|
export type SchemaId = (typeof schemas)[keyof typeof schemas]['$id'];
|
2023-04-14 10:37:17 +02:00
|
|
|
|
|
|
|
// Schemas must list all their $refs in `components`, including nested schemas.
|
chore(deps): update dependency @biomejs/biome to v1.4.0 (#5288)
[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@biomejs/biome](https://biomejs.dev)
([source](https://togithub.com/biomejs/biome)) | [`1.3.3` ->
`1.4.0`](https://renovatebot.com/diffs/npm/@biomejs%2fbiome/1.3.3/1.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@biomejs%2fbiome/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@biomejs%2fbiome/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@biomejs%2fbiome/1.3.3/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@biomejs%2fbiome/1.3.3/1.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
---
### Release Notes
<details>
<summary>biomejs/biome (@​biomejs/biome)</summary>
###
[`v1.4.0`](https://togithub.com/biomejs/biome/blob/HEAD/CHANGELOG.md#140-2023-11-27)
[Compare
Source](https://togithub.com/biomejs/biome/compare/af24597c1877c7b5a96bb7cc59bab655a577116f...889593e3f983a6fec642d20eea3c7f94d58fc7e1)
##### CLI
- Remove the CLI options from the `lsp-proxy`, as they were never meant
to be passed to that command. Contributed by
[@​ematipico](https://togithub.com/ematipico)
- Add option `--config-path` to `lsp-proxy` and `start` commands. It's
now possible to tell the Daemon server to load `biome.json` from a
custom path. Contributed by
[@​ematipico](https://togithub.com/ematipico)
- Add new `--diagnostic-level` option to let users control the level of
diagnostics printed by the CLI. Possible values are: `"info"`, `"warn"`,
`"hint"`. Contributed by
[@​simonxabris](https://togithub.com/simonxabris)
- Add option `--line-feed` to the `format` command. Contributed by
[@​SuperchupuDev](https://togithub.com/SuperchupuDev)
- Add option `--bracket-same-line` to the `format` command. Contributed
by [@​faultyserve](https://togithub.com/faultyserve)
- Add option `--bracket-spacing` to the `format` command. Contributed by
[@​faultyserve](https://togithub.com/faultyserve)
##### Bug fixes
- Fix the command `format`, now it returns a non-zero exit code when if
there pending diffs. Contributed by
[@​ematipico](https://togithub.com/ematipico)
##### Configuration
- Add option `formatter.lineFeed`. Contributed by
[@​SuperchupuDev](https://togithub.com/SuperchupuDev)
- Add option `javascript.formatter.bracketSameLine`. Contributed by
[@​faultyserve](https://togithub.com/faultyserve)
- Add option `javascript.formatter.bracketSpacing`. Contributed by
[@​faultyserve](https://togithub.com/faultyserve)
##### Formatter
##### New features
- Add a new option
[`--line-ending`](https://biomejs.dev/reference/configuration/#formatterlineending).
This option allows changing the type of line endings. Contributed by
[@​SuperchupuDev](https://togithub.com/SuperchupuDev)
- Added a new option called `--bracket-spacing` to the formatter. This
option allows you to control whether spaces are inserted around the
brackets of object literals.
[#​627](https://togithub.com/biomejs/biome/issues/627).
Contributed by [@​faultyserver](https://togithub.com/faultyserver)
- Added a new option called `--bracket-same-line` to the formatter. This
option allows you to control whether spaces are inserted around the
brackets of object literals.
[#​627](https://togithub.com/biomejs/biome/issues/627).
Contributed by [@​faultyserver](https://togithub.com/faultyserver)
##### Bug fixes
- Fix [#​832](https://togithub.com/biomejs/biome/issues/832), the
formatter no longer keeps an unnecessary trailing comma in type
parameter lists. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​301](https://togithub.com/biomejs/biome/issues/301), the
formatter should not break before the `in` keyword. Contributed by
[@​ematipico](https://togithub.com/ematipico)
##### Linter
##### Promoted rules
-
[a11y/noInteractiveElementToNoninteractiveRole](https://biomejs.dev/linter/rules/no-interactive-element-to-noninteractive-role)
-
[complexity/noThisInStatic](https://biomejs.dev/linter/rules/no-this-in-static)
-
[complexity/useArrowFunction](https://biomejs.dev/linter/rules/use-arrow-function)
-
[correctness/noEmptyCharacterClassInRegex](https://biomejs.dev/linter/rules/no-empty-character-class-in-regex)
-
[correctness/noInvalidNewBuiltin](https://biomejs.dev/linter/rules/no-invalid-new-builtin)
-
[style/noUselessElse](https://biomejs.dev/linter/rules/no-useless-else)
-
[style/useAsConstAssertion](https://biomejs.dev/linter/rules/use-as-const-assertion)
-
[style/useShorthandAssign](https://biomejs.dev/linter/rules/use-shorthand-assign)
-
[suspicious/noApproximativeNumericConstant](https://biomejs.dev/linter/rules/no-approximative-numeric-constant)
-
[suspicious/noMisleadingInstantiator](https://biomejs.dev/linter/rules/no-misleading-instantiator)
-
[suspicious/noMisrefactoredShorthandAssign](https://biomejs.dev/linter/rules/no-misrefactored-shorthand-assign)
The following rules are now recommended:
- [a11y/noAccessKey](https://biomejs.dev/linter/rules/no-access-key)
-
[a11y/useHeadingContent](https://biomejs.dev/linter/rules/use-heading-content)
-
[complexity/useSimpleNumberKeys](https://biomejs.dev/linter/use-simple-number-keys)
The following rules are now deprecated:
-
[correctness/noNewSymbol](https://biomejs.dev/linter/rules/no-new-symbol)
The rule is replaced by
[correctness/noInvalidNewBuiltin](https://biomejs.dev/linter/rules/no-invalid-new-builtin)
##### New features
- Add
[noDefaultExport](https://biomejs.dev/linter/rules/no-default-export)
which disallows `export default`. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Add
[noAriaHiddenOnFocusable](https://biomejs.dev/linter/rules/no-aria-hidden-on-focusable)
which reports hidden and focusable elements. Contributed by
[@​vasucp1207](https://togithub.com/vasucp1207)
- Add
[noImplicitAnyLet](https://biomejs.dev/linter/rules/no-implicit-any-let)
that reports variables declared with `let` and without initialization
and type annotation. Contributed by
[@​TaKO8Ki](https://togithub.com/TaKO8Ki) and
[@​b4s36t4](https://togithub.com/b4s36t4)
- Add [useAwait](https://biomejs.dev/linter/rules/use-await) that
reports `async` functions that don't use an `await` expression.
- Add
[useValidAriaRole](https://biomejs.dev/linter/rules/use-valid-aria-role).
Contributed by [@​vasucp1207](https://togithub.com/vasucp1207)
- Add [useRegexLiterals](https://biomejs.dev/linter/use-regex-literals)
that suggests turning call to the regex constructor into regex literals.
COntributed by [@​Yuiki](https://togithub.com/Yuiki)
##### Enhancements
- Add an unsafe code fix for
[a11y/useAriaActivedescendantWithTabindex](https://biomejs.dev/linter/rules/use-aria-activedescendant-with-tabindex)
##### Bug fixes
- Fix [#​639](https://togithub.com/biomejs/biome/issues/639) by
ignoring unused TypeScript's mapped key. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​565](https://togithub.com/biomejs/biome/issues/565) by
handling several `infer` with the same name in extends clauses of
TypeScript's conditional types. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​653](https://togithub.com/biomejs/biome/issues/653).
[noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports)
now correctly removes the entire line where the unused `import` is.
Contributed by [@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​607](https://togithub.com/biomejs/biome/issues/609)
`useExhaustiveDependencies`, ignore optional chaining, Contributed by
[@​msdlisper](https://togithub.com/msdlisper)
- Fix [#​676](https://togithub.com/biomejs/biome/issues/676), by
using the correct node for the `"noreferrer"` when applying the code
action. Contributed by
[@​ematipico](https://togithub.com/ematipico)
- Fix [#​455](https://togithub.com/biomejs/biome/issues/455). The
CLI can now print complex emojis to the console correctly.
- Fix [#​727](https://togithub.com/biomejs/biome/issues/727).
[noInferrableTypes](https://biomejs.dev/linter/rules/no-inferrable-types)
now correctly keeps type annotations when the initialization expression
is `null`. Contributed by
[@​Conaclos](https://togithub.com/Conaclos)
- Fix [#​784](https://togithub.com/biomejs/biome/issues/784),
[noSvgWithoutTitle](https://biomejs.dev/linter/rules/no-svg-without-title)
fixes false-positives to `aria-label` and reports svg's role attribute
is implicit. Contributed by
[@​unvalley](https://togithub.com/unvalley)
- Fix [#​834](https://togithub.com/biomejs/biome/issues/834) that
made
[noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements)
reports block statements of switch clauses. Contributed by
[@​vasucp1207](https://togithub.com/vasucp1207)
- Fix [#​783](https://togithub.com/biomejs/biome/issues/834) that
made
[noUselessLoneBlockStatements](https://biomejs.dev/linter/rules/no-useless-lone-block-statements)
reports block statements of `try-catch` structures. Contributed by
[@​hougesen](https://togithub.com/hougesen)
- Fix [#​69](https://togithub.com/biomejs/biome/issues/69) that
made
[correctness/noUnnecessaryContinue](https://biomejs.dev/linter/rules/no-unnecessary-continue)
incorrectly reports a `continue` used to break a switch clause.
Contributed by [@​TaKO8Ki](https://togithub.com/TaKO8Ki)
- Fix [#​664](https://togithub.com/biomejs/biome/issues/664) by
improving the diagnostic of
[style/useNamingConvention](https://biomejs.dev/linter/use-naming-convention)
when double capital are detected in strict camel case mode. Contributed
by [@​vasucp1207](https://togithub.com/vasucp1207)
- Fix [#​643](https://togithub.com/biomejs/biome/issues/643) that
erroneously parsed the option of
[complexity/useExhaustiveDependencies](https://biomejs.dev/linter/use-naming-convention).
Contributed by [@​arendjr](https://togithub.com/arendjr)
##### Parser
##### Bug fixes
- Fix [#​846](https://togithub.com/biomejs/biome/issues/846) that
erroneously parsed `<const T,>() => {}` as a JSX tag instead of an arrow
function when both TypeScript and JSX are enabled.
##### VSCode
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Unleash/unleash).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40Ni4wIiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.io>
2023-11-28 10:32:00 +01:00
|
|
|
export type SchemaRef = (typeof schemas)[keyof typeof schemas]['components'];
|
2023-04-14 10:37:17 +02:00
|
|
|
|
|
|
|
// JSON schema properties that should not be included in the OpenAPI spec.
|
|
|
|
export interface JsonSchemaProps {
|
|
|
|
$id: string;
|
|
|
|
components: object;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SchemaWithMandatoryFields = Partial<
|
|
|
|
Omit<
|
|
|
|
OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject,
|
|
|
|
'$id' | 'components'
|
|
|
|
>
|
|
|
|
> &
|
|
|
|
JsonSchemaProps;
|
|
|
|
|
|
|
|
interface UnleashSchemas {
|
|
|
|
[name: string]: SchemaWithMandatoryFields;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface OpenAPIV3DocumentWithServers extends OpenAPIV3.Document {
|
|
|
|
servers: OpenAPIV3.ServerObject[];
|
|
|
|
}
|
|
|
|
|
2022-06-13 11:23:36 +02:00
|
|
|
// All schemas in `openapi/spec` should be listed here.
|
2023-04-14 10:37:17 +02:00
|
|
|
export const schemas: UnleashSchemas = {
|
2023-05-23 16:56:34 +02:00
|
|
|
adminCountSchema,
|
2022-12-16 12:05:18 +01:00
|
|
|
adminFeaturesQuerySchema,
|
2023-09-19 13:24:26 +02:00
|
|
|
adminSegmentSchema,
|
2023-12-11 12:01:47 +01:00
|
|
|
segmentStrategiesSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
addonParameterSchema,
|
2022-06-22 12:49:18 +02:00
|
|
|
addonSchema,
|
OpenAPI: addon operations (#3421)
This PR updates the OpenAPI schemas for all the operations tagged with
"addons". In doing so, I also uncovered a few bugs and inconsistencies.
These have also been fixed.
## Changes
I've added inline comments to the changed files to call out anything
that I think is worth clarifying specifically. As an overall
description, this PR does the following:
Splits `addon-schema` into `addon-schema` and
`addon-create-update-schema`. The former is used when describing addons
that exist within Unleash and contain IDs and `created_at` timestamps.
The latter is used when creating or updating addons.
Adds examples and descriptions to all relevant schemas (and their
dependencies).
Updates addons operations descriptions and response codes (including the
recently introduced 413 and 415).
Fixes a bug where the server would crash if it didn't recognize the
addon provider (test added).
Fixes a bug where updating an addon wouldn't return anything, even if
the API said that it would. (test added)
Resolves some inconsistencies in handling of addon description. (tests
added)
### Addon descriptions
when creating addons, descriptions are optional. The original
`addonSchema` said they could be `null | string | undefined`. This
caused some inconsistencies in return values. Sometimes they were
returned, other times not. I've made it so that `descriptions` are now
always returned from the API. If it's not defined or if it's set to
`null`, the API will return `description: null`.
### `IAddonDto`
`IAddonDto`, the type we used internally to model the incoming addons
(for create and update) says that `description` is required. This hasn't
been true at least since we introduced OpenAPI schemas. As such, the
update and insert methods that the service uses were incompatible with
the **actual** data that we require.
I've changed the type to reflect reality for now. Assuming the tests
pass, this **should** all be good, but I'd like the reviewer(s) to give
this a think too.
---------
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2023-04-18 12:50:34 +02:00
|
|
|
addonCreateUpdateSchema,
|
2022-06-22 12:49:18 +02:00
|
|
|
addonsSchema,
|
|
|
|
addonTypeSchema,
|
2023-06-14 11:05:08 +02:00
|
|
|
advancedPlaygroundEnvironmentFeatureSchema,
|
|
|
|
advancedPlaygroundFeatureSchema,
|
|
|
|
advancedPlaygroundRequestSchema,
|
|
|
|
advancedPlaygroundResponseSchema,
|
2022-06-17 21:35:26 +02:00
|
|
|
apiTokenSchema,
|
|
|
|
apiTokensSchema,
|
2022-06-21 09:12:40 +02:00
|
|
|
applicationSchema,
|
2023-08-23 11:00:22 +02:00
|
|
|
applicationUsageSchema,
|
2022-06-21 09:12:40 +02:00
|
|
|
applicationsSchema,
|
2023-03-15 07:37:06 +01:00
|
|
|
batchFeaturesSchema,
|
|
|
|
batchStaleSchema,
|
2023-02-15 09:13:32 +01:00
|
|
|
bulkRegistrationSchema,
|
|
|
|
bulkMetricsSchema,
|
2023-05-17 10:21:08 +02:00
|
|
|
bulkToggleFeaturesSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
changePasswordSchema,
|
2022-06-24 15:29:27 +02:00
|
|
|
clientApplicationSchema,
|
2022-06-30 11:54:14 +02:00
|
|
|
clientFeatureSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
clientFeaturesQuerySchema,
|
2022-06-30 11:54:14 +02:00
|
|
|
clientFeaturesSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
clientMetricsSchema,
|
2023-03-01 13:08:08 +01:00
|
|
|
clientMetricsEnvSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
cloneFeatureSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
constraintSchema,
|
2022-06-17 11:11:55 +02:00
|
|
|
contextFieldSchema,
|
|
|
|
contextFieldsSchema,
|
2022-06-17 21:35:26 +02:00
|
|
|
createApiTokenSchema,
|
2023-04-26 12:10:57 +02:00
|
|
|
createApplicationSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
createFeatureSchema,
|
2022-06-23 08:10:20 +02:00
|
|
|
createFeatureStrategySchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
createInvitedUserSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
createUserSchema,
|
2022-06-30 12:27:12 +02:00
|
|
|
dateSchema,
|
2022-09-14 14:29:12 +02:00
|
|
|
edgeTokenSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
emailSchema,
|
2022-06-08 15:31:34 +02:00
|
|
|
environmentSchema,
|
2022-11-11 11:24:56 +01:00
|
|
|
environmentProjectSchema,
|
2022-06-10 10:04:56 +02:00
|
|
|
environmentsSchema,
|
2022-11-11 11:24:56 +01:00
|
|
|
environmentsProjectSchema,
|
2022-06-30 10:12:34 +02:00
|
|
|
eventSchema,
|
|
|
|
eventsSchema,
|
2023-01-11 16:00:20 +01:00
|
|
|
exportResultSchema,
|
|
|
|
exportQuerySchema,
|
2022-06-27 10:17:44 +02:00
|
|
|
featureEnvironmentMetricsSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
featureEnvironmentSchema,
|
2022-06-30 10:12:34 +02:00
|
|
|
featureEventsSchema,
|
2022-06-27 10:17:44 +02:00
|
|
|
featureMetricsSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
featureSchema,
|
|
|
|
featuresSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
featureStrategySchema,
|
2022-06-22 09:09:49 +02:00
|
|
|
featureStrategySegmentSchema,
|
|
|
|
featureTagSchema,
|
2022-06-09 13:17:13 +02:00
|
|
|
featureTypeSchema,
|
|
|
|
featureTypesSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
featureUsageSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
featureVariantsSchema,
|
2023-07-13 13:27:52 +02:00
|
|
|
feedbackCreateSchema,
|
|
|
|
feedbackUpdateSchema,
|
|
|
|
feedbackResponseSchema,
|
2022-07-21 16:23:56 +02:00
|
|
|
groupSchema,
|
|
|
|
groupsSchema,
|
|
|
|
groupUserModelSchema,
|
2022-06-20 12:22:41 +02:00
|
|
|
healthCheckSchema,
|
2022-06-08 15:31:34 +02:00
|
|
|
healthOverviewSchema,
|
|
|
|
healthReportSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
idSchema,
|
2024-02-05 14:07:38 +01:00
|
|
|
idsSchema,
|
2022-10-25 13:10:27 +02:00
|
|
|
instanceAdminStatsSchema,
|
2022-06-17 11:11:55 +02:00
|
|
|
legalValueSchema,
|
2022-06-23 09:40:25 +02:00
|
|
|
loginSchema,
|
2022-12-21 12:23:44 +01:00
|
|
|
maintenanceSchema,
|
2023-04-10 09:55:29 +02:00
|
|
|
toggleMaintenanceSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
meSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
nameSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
overrideSchema,
|
|
|
|
parametersSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
passwordSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
patchesSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
patchSchema,
|
2024-02-01 15:28:46 +01:00
|
|
|
createPatSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
patSchema,
|
|
|
|
patsSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
permissionSchema,
|
feat(#1873/playground): Return detailed information on feature toggle evaluation (#1839)
* Feat: return reasons why a feature evaluated to true or false
Note: this is very rough and just straight ripped from the nodejs
client. It will need a lot of work, but is a good place to start
* Feat: add suggested shape for new payload
* Chore: minor cleanup
* Wip: make server compile again
* Remove unused schema ref
* Export new schemas
* Chore: fix some tests to use sub property
* Fix: fix some tests
* Refactor: rename some variables, uncomment some stuff
* Add segments type to bootstrap options
* Add segments capability to offline feature evaluator
* Fix function calls after turning params into an option abject
* Feat: test strategy order, etc
* Feat: add test to check that all strats are returned correctly
* Feat: allow you to include strategy ids in clients
* Wip: hook up segments in the offline client.
Note: compared to regular clients, they still fail
* Feat: add segments validation
* Fix: fix test case invariant.
* Chore: revert to returning only `boolean` from strategies.
This _should_ make it work with custom strategies too 🤞
* Feat: make more properties of the returned feature required
* Wip: add some comments and unfinished tests for edge cases
* Feat: add `isEnabledInCurrentEnvironment` prop
* Feat: consider more strategy failure cases
* Feat: test that isenabledinenvironment matches expectations
* Feat: add unknown strategies
* Fix: fix property access typo
* Feat: add unknown strategy for fallback purposes
* Feat: test edge case: all unknown strategies
* Feat: add custom strategy to arbitrary
* Feat: test that features can be true, even if not enabled in env
* Chore: add some comments
* Wip: fix sdk tests
* Remove comments, improve test logging
* Feat: add descriptions and examples to playground feature schema
* Switch `examples` for `example`
* Update schemas with descriptions and examples
* Fix: update snapshot
* Fix: openapi example
* Fix: merge issues
* Fix: fix issue where feature evaluation state was wrong
* Chore: update openapi spec
* Fix: fix broken offline client tests
* Refactor: move schemas into separate files
* Refactor: remove "reason" for incomplete evaluation.
The only instances where evaluation is incomplete is when we don't
know what the strategy is.
* Refactor: move unleash node client into test and dev dependencies
* Wip: further removal of stuff
* Chore: remove a bunch of code that we don't use
* Chore: remove comment
* Chore: remove unused code
* Fix: fix some prettier errors
* Type parameters in strategies to avoid `any`
* Fix: remove commented out code
* Feat: make `id` required on playground strategies
* Chore: remove redundant type
* Fix: remove redundant if and fix fallback evaluation
* Refactor: reduce nesting and remove duplication
* Fix: remove unused helper function
* Refactor: type `parameters` as `unknown`
* Chore: remove redundant comment
* Refactor: move constraint code into a separate file
* Refactor: rename `unleash` -> `feature-evaluator`
* Rename class `Unleash` -> `FeatureEvaluator`
* Refactor: remove this.ready and sync logic from feature evaluator
* Refactor: remove unused code, rename config type
* Refactor: remove event emission from the Unleash client
* Remove unlistened-for events in feature evaluator
* Refactor: make offline client synchronous; remove code
* Fix: update openapi snapshot after adding required strategy ids
* Feat: change `strategies` format.
This commit changes the format of a playground feature's `strategies`
properties from a list of strategies to an object with properties
`result` and `data`. It looks a bit like this:
```ts
type Strategies = {
result: boolean | "unknown",
data: Strategy[]
}
```
The reason is that this allows us to avoid the breaking change that
was previously suggested in the PR:
`feature.isEnabled` used to be a straight boolean. Then, when we found
out we couldn't necessarily evaluate all strategies (custom strats are
hard!) we changed it to `boolean | 'unevaluated'`. However, this is
confusing on a few levels as the playground results are no longer the
same as the SDK would be, nor are they strictly boolean anymore.
This change reverts the `isEnabled` functionality to what it was
before (so it's always a mirror of what the SDK would show).
The equivalent of `feature.isEnabled === 'unevaluated'` now becomes
`feature.isEnabled && strategy.result === 'unknown'`.
* Fix: Fold long string descriptions over multiple lines.
* Fix: update snapshot after adding line breaks to descriptions
2022-08-04 15:41:52 +02:00
|
|
|
playgroundConstraintSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
playgroundFeatureSchema,
|
2022-07-12 13:01:10 +02:00
|
|
|
playgroundRequestSchema,
|
2022-07-26 14:16:30 +02:00
|
|
|
playgroundResponseSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
playgroundSegmentSchema,
|
|
|
|
playgroundStrategySchema,
|
2022-09-29 15:27:54 +02:00
|
|
|
profileSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
projectEnvironmentSchema,
|
|
|
|
projectSchema,
|
|
|
|
projectsSchema,
|
2022-09-14 14:29:12 +02:00
|
|
|
proxyClientSchema,
|
|
|
|
proxyFeatureSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
proxyFeaturesSchema,
|
|
|
|
publicSignupTokenCreateSchema,
|
|
|
|
publicSignupTokenSchema,
|
|
|
|
publicSignupTokensSchema,
|
|
|
|
publicSignupTokenUpdateSchema,
|
2023-01-20 10:30:20 +01:00
|
|
|
pushVariantsSchema,
|
2023-01-27 13:13:41 +01:00
|
|
|
projectStatsSchema,
|
2022-06-22 13:31:41 +02:00
|
|
|
resetPasswordSchema,
|
2022-12-12 14:05:56 +01:00
|
|
|
requestsPerSecondSchema,
|
|
|
|
requestsPerSecondSegmentedSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
roleSchema,
|
2022-07-12 13:01:10 +02:00
|
|
|
sdkContextSchema,
|
2023-09-15 09:30:54 +02:00
|
|
|
sdkFlatContextSchema,
|
2022-08-09 16:14:50 +02:00
|
|
|
searchEventsSchema,
|
2022-06-22 09:09:49 +02:00
|
|
|
segmentSchema,
|
2022-07-26 14:16:30 +02:00
|
|
|
setStrategySortOrderSchema,
|
2022-08-26 09:09:48 +02:00
|
|
|
setUiConfigSchema,
|
2022-06-10 10:04:56 +02:00
|
|
|
sortOrderSchema,
|
2023-07-13 10:29:54 +02:00
|
|
|
splashRequestSchema,
|
|
|
|
splashResponseSchema,
|
2022-06-22 09:09:49 +02:00
|
|
|
stateSchema,
|
2022-06-23 08:10:20 +02:00
|
|
|
strategiesSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
strategySchema,
|
2023-03-08 09:07:06 +01:00
|
|
|
tagsBulkAddSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
tagSchema,
|
|
|
|
tagsSchema,
|
2022-06-14 09:06:41 +02:00
|
|
|
tagTypeSchema,
|
|
|
|
tagTypesSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
tagWithVersionSchema,
|
2022-06-22 13:31:41 +02:00
|
|
|
tokenUserSchema,
|
2023-04-14 15:39:39 +02:00
|
|
|
tokenStringListSchema,
|
2022-06-08 14:57:39 +02:00
|
|
|
uiConfigSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
updateApiTokenSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
updateFeatureSchema,
|
2022-06-23 08:10:20 +02:00
|
|
|
updateFeatureStrategySchema,
|
2022-06-14 09:06:41 +02:00
|
|
|
updateTagTypeSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
updateUserSchema,
|
2023-03-07 15:50:01 +01:00
|
|
|
updateTagsSchema,
|
2023-07-28 09:25:34 +02:00
|
|
|
createContextFieldSchema,
|
|
|
|
updateContextFieldSchema,
|
2023-03-15 14:58:19 +01:00
|
|
|
upsertSegmentSchema,
|
2023-07-04 14:21:09 +02:00
|
|
|
createStrategySchema,
|
|
|
|
updateStrategySchema,
|
2023-07-18 11:00:51 +02:00
|
|
|
updateFeatureTypeLifetimeSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
userSchema,
|
2023-07-06 08:24:46 +02:00
|
|
|
createUserResponseSchema,
|
2022-09-30 13:01:32 +02:00
|
|
|
usersGroupsBaseSchema,
|
2022-06-22 14:55:43 +02:00
|
|
|
usersSchema,
|
|
|
|
usersSearchSchema,
|
2023-04-14 15:39:39 +02:00
|
|
|
validatedEdgeTokensSchema,
|
2023-07-11 14:17:10 +02:00
|
|
|
validateFeatureSchema,
|
2022-06-30 14:21:40 +02:00
|
|
|
validatePasswordSchema,
|
|
|
|
validateTagTypeSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
variantSchema,
|
2023-05-18 10:38:59 +02:00
|
|
|
variantFlagSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
variantsSchema,
|
2022-06-08 14:57:39 +02:00
|
|
|
versionSchema,
|
2023-12-01 10:20:24 +01:00
|
|
|
deprecatedProjectOverviewSchema,
|
2023-02-16 08:08:51 +01:00
|
|
|
importTogglesSchema,
|
|
|
|
importTogglesValidateSchema,
|
|
|
|
importTogglesValidateItemSchema,
|
2023-06-09 11:00:17 +02:00
|
|
|
contextFieldStrategiesSchema,
|
feat/telemetry opt out (#4035)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->
Adds a UI that shows current status of version and feature usage
collection configuration, and a presence in the configuration menu +
menu bar.
Configuring these features is done by setting environment variables. The
version info collection is an existing feature that we're making more
visible, the feature usage collection feature is a new feature that has
it's own environment configuration but also depends on version info
collection being active to work.
When version collection is turned off and the experimental feature flag
for feature usage collection is turned off:
<img width="1269" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/435a07da-d238-4b5b-a150-07e3bd6b816f">
When version collection is turned on and the experimental feature flag
is off:
<img width="1249" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/8d1a76c5-99c9-4551-9a4f-86d477bbbf6f">
When the experimental feature flag is enabled, and version+telemetry is
turned off:
<img width="1239" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/e0bc532b-be94-4076-bee1-faef9bc48a5b">
When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned off:
<img width="1234" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/1bd190c1-08fe-4402-bde3-56f863a33289">
When version collection is turned on, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1229" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/848912cd-30bd-43cf-9b81-c58a4cbad1e4">
When version collection is turned off, the experimental feature flag is
enabled, and telemetry collection is turned on:
<img width="1241" alt="image"
src="https://github.com/Unleash/unleash/assets/707867/d2b981f2-033f-4fae-a115-f93e0653729b">
---------
Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-06-30 08:43:58 +02:00
|
|
|
telemetrySettingsSchema,
|
2023-07-13 13:50:03 +02:00
|
|
|
strategyVariantSchema,
|
|
|
|
createStrategyVariantSchema,
|
2023-07-14 13:25:31 +02:00
|
|
|
clientSegmentSchema,
|
2023-07-24 11:05:55 +02:00
|
|
|
createGroupSchema,
|
2023-09-04 13:53:33 +02:00
|
|
|
createFeatureNamingPatternSchema,
|
2023-08-30 14:39:43 +02:00
|
|
|
doraFeaturesSchema,
|
|
|
|
projectDoraMetricsSchema,
|
2023-09-19 13:24:26 +02:00
|
|
|
segmentsSchema,
|
|
|
|
updateFeatureStrategySegmentsSchema,
|
2023-09-19 10:04:05 +02:00
|
|
|
dependentFeatureSchema,
|
|
|
|
createDependentFeatureSchema,
|
2023-09-26 14:03:24 +02:00
|
|
|
parentFeatureOptionsSchema,
|
2023-10-12 11:56:10 +02:00
|
|
|
featureDependenciesSchema,
|
2023-10-16 20:56:06 +02:00
|
|
|
dependenciesExistSchema,
|
2023-10-20 08:58:03 +02:00
|
|
|
validateArchiveFeaturesSchema,
|
2023-10-25 10:50:59 +02:00
|
|
|
searchFeaturesSchema,
|
2023-12-01 10:20:24 +01:00
|
|
|
featureTypeCountSchema,
|
|
|
|
projectOverviewSchema,
|
2023-12-05 10:25:56 +01:00
|
|
|
featureSearchResponseSchema,
|
2024-02-05 14:07:38 +01:00
|
|
|
inactiveUserSchema,
|
|
|
|
inactiveUsersSchema,
|
2022-06-08 08:01:14 +02:00
|
|
|
};
|
|
|
|
|
2022-06-10 10:04:56 +02:00
|
|
|
// Remove JSONSchema keys that would result in an invalid OpenAPI spec.
|
|
|
|
export const removeJsonSchemaProps = <T extends JsonSchemaProps>(
|
|
|
|
schema: T,
|
|
|
|
): OpenAPIV3.SchemaObject => {
|
|
|
|
return omitKeys(schema, '$id', 'components');
|
|
|
|
};
|
|
|
|
|
2022-06-27 15:39:08 +02:00
|
|
|
const findRootUrl: (unleashUrl: string, baseUriPath: string) => string = (
|
|
|
|
unleashUrl: string,
|
|
|
|
baseUriPath?: string,
|
|
|
|
) => {
|
|
|
|
if (!baseUriPath) {
|
|
|
|
return unleashUrl;
|
|
|
|
}
|
|
|
|
const baseUrl = new URL(unleashUrl);
|
2023-05-16 12:01:47 +02:00
|
|
|
const url =
|
|
|
|
baseUrl.pathname.indexOf(baseUriPath) >= 0
|
|
|
|
? `${baseUrl.protocol}//${baseUrl.host}`
|
|
|
|
: baseUrl.toString();
|
|
|
|
|
|
|
|
return baseUriPath.startsWith('/')
|
|
|
|
? new URL(baseUriPath, url).toString()
|
|
|
|
: url;
|
2022-06-27 15:39:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const createOpenApiSchema = ({
|
|
|
|
unleashUrl,
|
|
|
|
baseUriPath,
|
|
|
|
}: Pick<IServerOption, 'unleashUrl' | 'baseUriPath'>): Omit<
|
2023-04-14 10:37:17 +02:00
|
|
|
OpenAPIV3DocumentWithServers,
|
2022-06-27 15:39:08 +02:00
|
|
|
'paths'
|
|
|
|
> => {
|
|
|
|
const url = findRootUrl(unleashUrl, baseUriPath);
|
2023-05-16 12:01:47 +02:00
|
|
|
|
2022-04-25 14:17:59 +02:00
|
|
|
return {
|
|
|
|
openapi: '3.0.3',
|
2023-05-16 12:01:47 +02:00
|
|
|
servers: baseUriPath ? [{ url }] : [],
|
2022-04-25 14:17:59 +02:00
|
|
|
info: {
|
|
|
|
title: 'Unleash API',
|
Fix(#1391): Expose API version even when not running via npm/yarn (#2062)
* Fix(#1391): Expose API version even when not running via npm/yarn
## What
Expose the current Unleash version in the generated OpenAPI docs, even
when running via docker or other processes.
## Why
An OpenAPI spec without a version isn't valid. This causes some of our
generation tools (such as the one for documentation) to fail.
## How
By changing how we fetch the current version:
Previously, we used `process.env.npm_package_version!`. However, when
you're not running with yarn or npm, this is `undefined`. That causes
the version number to not be included when running tests and when
running using the official docker image.
Instead, we now use `version` from `lib/util/version`. This is the
same version as the one used by the UI config endpoint, so it should
be the same one as what the front end displays. To the best of my
knowledge, this _is_ the version of the API.
## Discussion
It _may_ be that I have misunderstood what the version represents, but
from what I can tell, it just exports what's listed as the version in
package.json.
The source code of the `lib/util/version` file is:
```ts
// export module version
require('pkginfo')(module, 'version');
const { version } = module.exports;
export default version;
module.exports = version;
```
* Refactor(#1391): rename imported variable for clarity
2022-09-15 12:22:21 +02:00
|
|
|
version: apiVersion,
|
2022-04-25 14:17:59 +02:00
|
|
|
},
|
2022-06-08 08:01:14 +02:00
|
|
|
security: [{ apiKey: [] }],
|
2022-04-25 14:17:59 +02:00
|
|
|
components: {
|
|
|
|
securitySchemes: {
|
|
|
|
apiKey: {
|
|
|
|
type: 'apiKey',
|
|
|
|
in: 'header',
|
|
|
|
name: 'Authorization',
|
|
|
|
},
|
|
|
|
},
|
2022-06-10 10:04:56 +02:00
|
|
|
schemas: mapValues(schemas, removeJsonSchemaProps),
|
2022-04-25 14:17:59 +02:00
|
|
|
},
|
2022-08-12 11:37:57 +02:00
|
|
|
tags: openApiTags,
|
2022-04-25 14:17:59 +02:00
|
|
|
};
|
|
|
|
};
|
2022-11-17 12:02:40 +01:00
|
|
|
|
|
|
|
export * from './util';
|
|
|
|
export * from './spec';
|