1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

952 Commits

Author SHA1 Message Date
andreas-unleash
91e20cc09a
Add support for case for IN and NOT_IN operators (#2924)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

Adds support for case for IN and NOT_IN operators
<!-- 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->

<img width="1547" alt="Screenshot 2023-01-18 at 11 35 10"
src="https://user-images.githubusercontent.com/104830839/213136158-25c525c8-de82-423b-93d1-5ae6eb8469fa.png">

## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-01-18 14:42:26 +02:00
Fredrik Strand Oseberg
89163b8719
refactor/clean-up-get-project (#2925)
This PR moves the getProjectOverview method out from the project health
controller. It doesn't make sense that this method lives here anymore,
as over time it has grown into method that relays all information about
a single project. It makes more sense that this now lives on the root of
the project api. Also removes unwanted duplication of getProjectOverview
from the project-service and the project-health-service.
2023-01-18 13:22:58 +01:00
Nuno Góis
d63b3c69fe
feat: adapt user logic to better adapt to SAs (#2917)
https://linear.app/unleash/issue/2-579/improve-user-like-behaviour-for-service-accounts-accounts-concept

<img width="803" alt="image"
src="https://user-images.githubusercontent.com/14320932/213011584-75870595-988d-49bc-a7bf-cd1ffd146bca.png">

Makes SAs behave more like users. 

Even though they share the same `users` database table, the `is_service`
column distinguishes them. This PR makes the distinction a bit less
obvious by not filtering out SAs for some methods in the user store,
returning both account types and their respective account type
information so we can handle them properly on the UI.

We felt like this was a good enough approach for now, and a decent
compromise to move SAs forward. In the future, we may want to make a
full refactor with the `accounts` concept in mind, which we've
experimented with in the
[accounts-refactoring](https://github.com/Unleash/unleash/tree/accounts-refactoring)
branches (both OSS and Enterprise).
 
https://github.com/Unleash/unleash/pull/2918 - Moves this a bit further,
by introducing the account service and store.
2023-01-18 12:12:44 +00:00
Fredrik Strand Oseberg
bf7ef62059
feat: initial status box implementation (#2913)
First iteration of new status boxes
2023-01-18 10:10:41 +01:00
sjaanus
16bca1260c
Segment export (#2922)
Segment export
2023-01-18 10:41:22 +02:00
sjaanus
b895c99743
Export features (#2905) 2023-01-17 13:10:20 +02:00
Gastón Fournier
005e5b1d15
fix: found an edge case exporting variants (#2900)
## About the changes
When exporting v3, for variants backward compatibility, we need to find
one featureEnvironment and fetch variants from there.
In cases where the default environment is disabled (therefore does not
get variants per environment when added), it can be still be selected
for the export process. Therefore variants don't appear in the feature
when they should be there.

An e2e test that fails with the previous implementation was added to
validate the behavior

This comes from our support ticket 404
2023-01-13 14:55:57 +01:00
Mateusz Kwasniewski
5569101f30
feat: import feature strategies (#2885) 2023-01-12 15:24:34 +01:00
Mateusz Kwasniewski
a52d3b0f77
test: fix test runs to 1 (#2886) 2023-01-12 13:53:05 +01:00
Gastón Fournier
ce815e5f29
feat: report app names only if below a threshold (#2737)
## About the changes
Introduce a snapshot version of instanceStats inside
instance-stats-service to provide a cached state of the statistics
without compromising the DB.

### Important notes
Some rule-of-thumb applied in the PR that can be changed:
1. The snapshot refresh time
2. The threshold to report appName with the metrics

## Discussion points
1. The snapshot could be limited to just the information needed (things
like `hasOIDC` don't change until there's a restart), to optimize the memory usage
3. metrics.ts (used to expose Prometheus metrics) has a [refresh
interval of
2hs](2d16730cc2/src/lib/metrics.ts (L189-L195)),
but with this implementation, we could remove that background task and
rely on the snapshot
4. We could additionally update the snapshot every time someone queries
the DB to fetch stats (`getStats()` method), but it may increase
complexity without a significant benefit

Co-authored-by: Mateusz Kwasniewski <kwasniewski.mateusz@gmail.com>
Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
2023-01-12 11:26:59 +01:00
Mateusz Kwasniewski
be1762d33f
Scheduler abstraction (#2829) 2023-01-11 16:15:53 +01:00
sjaanus
eb7e82dff2
Export with strategies (#2877) 2023-01-11 15:00:20 +00:00
Mateusz Kwasniewski
afdcd45042
feat: first skeleton of the batch import (#2868)
First skeleton of batch import:
* injecting feature toggle service because I want to reuse logic and not
just the store
2023-01-11 15:19:16 +01:00
Gastón Fournier
fa47fee55e
feat: RBAC read params from body (#2846)
## About the changes
This is a follow-up on #1953

This implementation generalizes how we fetch some standard parameters
from the query parameters or request body.

## Discussion points
Unfortunately, we have not used standard names for our APIs and one
example is our `projectId` (in some cases we just used `project`).
Ideally, we're only using one way of sending these parameters either
`projectId` or `project` (same applies to `environment` vs
`environmentId`).

If both parameters are present, due to historical reasons, we'll give
precedence to:
- `projectId` over `project`
- `environment` over `environmentId` 

In the presence of both query parameters and body, we'll give precedence
to query parameters also for historical reasons.
2023-01-11 10:48:27 +01:00
andreas-unleash
e050495199
fix feature-schema.ts (#2729)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- 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! ❤️ -->
This PR fixes the admin feature schema by moving the `strategies`
(featureStrategySchema) from the root of `feature` object to
`feature.environment`
## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-01-11 10:53:43 +02:00
Gastón Fournier
9ea67a74b4
feat: add error logs for addons (#2739)
## About the changes
This uses log-level warning so we can turn off the log without turning
off all error logs. This could potentially be tweaked further by using
log categories in the log configuration.

Closes #2057
2023-01-11 09:13:22 +01:00
sjaanus
6c9ef53ea4
Export import flag (#2866)
Export import flag
2023-01-11 09:23:47 +02:00
sjaanus
11d5a157c4
Remove E flag (#2832) 2023-01-11 09:00:26 +02:00
sjaanus
f3f3a59e5e
Import export (#2865) 2023-01-10 15:59:02 +02:00
Ivar Conradi Østhus
0c1e997f0b
fix: store snapshots in temp folder (#2864) 2023-01-10 13:53:00 +01:00
Nuno Góis
997dbbbea5
Feat sa table info (#2848)
https://linear.app/unleash/issue/2-543/show-relevant-information-on-the-service-accounts-table

Shows relevant information on the table, like total PATs and the last
time a service account was active based on latest seen PAT for that
account. Adapts to the latest related PR on enterprise.


![image](https://user-images.githubusercontent.com/14320932/211312719-c4ed940a-723b-4b2e-a79e-8e7cdbda7c58.png)
2023-01-09 16:18:37 +00:00
sjaanus
7a1c18bd35
Ability to add AJV schemas runtime (#2792) 2023-01-06 11:41:39 +02:00
Mateusz Kwasniewski
5ac08e06d9
fix: when health is 0 we should not show 100 (#2833) 2023-01-05 15:14:27 +01:00
Gastón Fournier
29be130757
fix: enforce weight precision to 1 decimal (#2749)
## About the changes
According to our docs, we only support up to 1 decimal place for
weights. This is to use integers to represent the percentages (we divide
them by 10) and supporting more decimals results in bad maths due to
floating point arithmetics.

This PRs adds Frontend and Backend validations to enforce this
restriction

Closes #2222

## Discussion points
Should we reconsider supporting more decimal places, that door remains
open, but for now we'll just adhere to our documentation because that
change would require some development.
2023-01-05 12:39:18 +01:00
Tymoteusz Czech
1653b0449a
Orval generator POC (#2724)
for #2715
2023-01-05 11:57:53 +01:00
Gastón Fournier
58dd09f3e1
fix: export features with variants event when feature is disabled (#2824)
## About the changes
When exporting features one is normally also interested in disabled
features, so they are also included in the export file, while the
variants are not. I do not see a good reason for that, so this PR
removes the check and exports the variants then as well.
I could also add an option as well, but as long as there is no good
reason for ignoring the variants I would just export them with the
features.

This PR adds tests on #2719

Closes #2719

Co-authored-by: Martin Joehren <martin.joehren@esailors.de>
2023-01-05 12:30:07 +02:00
Ivar Conradi Østhus
3a8107ce6e
fix: state-service should always keep api keys (#2552)
We have experienced side-effects where the import was unexpected and
resulted in environments thought to be removed. This had the unexpected
side-effect of also deleting API keys for some environments not part of
the import file.

This commit removes the ability of the state-service to mutate api keys
directly. There is no compelling reasons why we should remove API keys
as part of an import query.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-01-04 11:24:34 +00:00
Gastón Fournier
bf77182ca7
feat: limit the amount of results coming from Prometheus (#2776)
## About the changes
To avoid showing too much data in the traffic screen, limit the number
of results to `topk`.

## Discussion points
Top 10 is a rule of thumb, but maybe we could do top 25. Until we gather
more data, I believe this should be good enough
2023-01-04 11:00:04 +01:00
Nuno Góis
28fbcf69ec
feat: enterprise service accounts (BE) (#2806)
https://linear.app/unleash/issue/2-537/back-end-for-service-accounts

Supersedes https://github.com/Unleash/unleash/pull/2731
2023-01-03 15:15:32 +00:00
sjaanus
bae623d69e
Fix joi failing starting from 17.7.0 release (#2790) 2023-01-03 11:50:00 +02:00
sjaanus
8a8cd1bf27
UI Flags cleanup (#2778) 2023-01-02 15:41:43 +02:00
Nuno Góis
88004a6138
feat: allows creation of PATs for other users (#2718)
https://linear.app/unleash/issue/2-530/api-allow-creation-of-pats-for-other-users


![image](https://user-images.githubusercontent.com/14320932/208720680-5d5ccee7-1972-4f5b-8024-3a69d50a571f.png)

Adds and takes into account the following permissions:
 - **READ_USER_PAT**;
 - **CREATE_USER_PAT**;
 - **DELETE_USER_PAT**;
 
 API only, will make some exploration on UI soon.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2023-01-02 10:49:57 +00:00
sjaanus
ec535ad7cc
Make it possible to validate enterprise schema with respondWithValidation (#2781)
Now respondWithValidation<T, S = SchemaId> can be called in oss and
enterprise to validate against needed schema.
2023-01-02 12:08:27 +02:00
sjaanus
6c621bf65b
Fix crashing search bars (#2765) 2022-12-28 12:35:27 +02:00
Nuno Góis
aaa96f71cb
feat: message banner (#2726)
Related to:
https://linear.app/unleash/issue/2-511/exploration-build-data-for-the-possibility-of-showing-an-alert-to-the
Namely:
https://unleash-internal.slack.com/archives/C046LV85N3C/p1671443897386729

The idea is to have a general message banner that can be controlled
through a feature flag in Unleash to display announcements, warnings,
informations, etc.

Currently using mock feature flags, but the idea is to bind this to a
feature flag we can manage in our Unleash instance, and use its payload
to provide information to end users whenever we want.

Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2022-12-22 15:16:51 +00:00
Christopher Kolstad
5b66346e56
fixes 2-456: Preserve all data from strategy import (#2720)
## What
Previously when importing strategies we've used the same data type we've
used for creating strategies (the minimal, a name, an optional
description, optional parameters and an optional editable column). This
meant that exporting strategies and then importing them would reactivate
deprecated strategies. This PR changes to allow the import to preserve
all the data coming in the export file.

## Tests
Added four new tests, two new unit tests using our fake stores and two
new e2e tests. Interestingly the ones in the fake store ran green before
this change as well, probably because we just insert the parsed json
object in the fake store, whereas the real store actually converts the
object from camelCasing to the postgresql snake_casing standard.

## Discussion points:
### Mismatch between fake and real stores
This is inevitable since storing things in javascript arrays vs saving
in a real database will have some differences, but this again shows the
value of our e2e tests.

### Invariants
Should we see if we can add some invariants to our import/export so that
we can write some proptests for it? One candidate is commutativity of
import/export. On a fresh database importing and then exporting should
yield the same file that was imported provided all flags are turned on.
Candidate for Q1 improvement of import/export.
2022-12-21 13:33:41 +01:00
sjaanus
be045dc13a
Remove favorites feature flag (#2722) 2022-12-21 12:03:06 +00:00
sjaanus
a0619e963d
Maintenance mode for users (#2716) 2022-12-21 13:23:44 +02:00
Nuno Góis
7ce5b3de64
refactor: flag resolver should use stricter types (#2571)
Adding stricter types to `FlagResolver` can possibly help improve our DX
- Help us prevent errors like typos, guide us to correctly add a flag
when needed, and warn us of stray checks whenever we do a clean up at a
later stage.
2022-12-20 15:10:06 +00:00
Gastón Fournier
4b519ead4f
perf: Simplify queries to prometheus (#2706)
## About the changes
This PR improves our queries to Prometheus (instead of making multiple queries do only one) and improves the UI and the code. 

The reports aggregate all HTTP methods (GET, POST, PUT, DELETE, OPTIONS, HEAD and PATCH) without distinction under the same "endpoint" (a relative path inside unleash up to a certain depth)

Co-authored-by: Nuno Góis <nuno@getunleash.ai>
2022-12-19 17:06:59 +01:00
sjaanus
2d5455d203
Maintenance mode middleware (#2707) 2022-12-19 09:01:04 +02:00
Nuno Góis
a3ac96f763
Feat network overview (#2708)
https://linear.app/unleash/issue/2-512/exploration-network-overview-represented-as-a-flow-chart

<img width="1307" alt="image"
src="https://user-images.githubusercontent.com/14320932/208110067-294a0b91-d52e-49d1-9024-fa5e8530e2d8.png">
2022-12-16 14:12:36 +00:00
Gastón Fournier
2979f21631
feat: expose number of registered applications metric (#2692)
## About the changes
This metric will expose an aggregated view of how many client
applications are registered in Unleash. Since applications are ephemeral
we are exposing this metric in different time windows based on when the
application was last seen.

The caveat is that we issue a database query for each new range we want
to add. Hopefully, this should not be a problem because:
a) the amount of ranges we'd expose is small and unlikely to grow
b) this is currently updated at startup time and even if we update it on
a scheduled basis the refresh rate will be rather sparse

## Sample data
This is how metrics will look like
```
# HELP client_apps_total Number of registered client apps aggregated by range by last seen
# TYPE client_apps_total gauge
client_apps_total{range="allTime"} 3
client_apps_total{range="30d"} 3
client_apps_total{range="7d"} 2
```
2022-12-16 11:16:51 +00:00
Christopher Kolstad
eafba10cac
feature: add query support to features endpoint (#2693)
## About the changes
The deprecated /api/admin/features endpoint supported querying with tag
and namePrefix parameters.

This PR adds this functionality to
/api/admin/projects/<project>/features as well, allowing to replicate
queries that used to work.

Closes #2306

### Important files
src/lib/db/feature-strategy-store.ts
src/test/e2e/stores/feature-strategies-store.e2e.test.ts

## Discussion points
I'm extending our query parameters support for
/api/admin/projects/<projectId>/features endpoint. This will be
reflected in our open-api spec, so I also made an
adminFeaturesQuerySchema for this.

Also, very open for something similar to what we did for the modifyQuery
for the archived parameter, but couldn't come up with a good way to
support subselects using the query builder, it just ended up blowing the
stack. If anyone has a suggestion, I'm all ears.

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-12-16 12:05:18 +01:00
sjaanus
d42e90544f
Maintenance mode UI (#2704) 2022-12-15 16:07:22 +02:00
Nuno Góis
90f0d665f9
fix: disable networkView for dev, fail more gracefully (#2701)
Disables networkView for dev for now. Attempts to fail more gracefully
both on the service and front-end.
2022-12-15 10:12:02 +00:00
Christopher Kolstad
23094b016e
feat: first draft of chart for instance traffic in frontend (#2670)
## What
We've already added the backend for this. This is the initial work for
drawing a chart for instance traffic in the frontend. It requires the environment variable `PROMETHEUS_API` set to a valid prometheus-query-language (promql) supported backend, such as Prometheus itself or Victoria Metrics. Besides, at the moment we're hiding this functionality behind the flag `UNLEASH_EXPERIMENTAL_NETWORK_VIEW` which has to be set to true

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
2022-12-15 08:47:07 +00:00
Ivar Conradi Østhus
34c12c8234
fix: adjust db-pool for test to use max=4 2022-12-14 20:25:14 +01:00
Ivar Conradi Østhus
e01167676c
fix: background frontend settings should not crash tests 2022-12-14 20:24:47 +01:00
Ivar Conradi Østhus
e4035d37d4
fix: adjust db-pool for test to use max=3 2022-12-14 19:53:26 +01:00
Ivar Conradi Østhus
2223cace41
fix: adjust db-pool a bit 2022-12-14 19:42:01 +01:00
Ivar Conradi Østhus
09c87c755f
Fix/remove settings cache (#2694)
In this PR we remove the general SettingService cache, as it will not
work across multiple horizontal unleash instances, events are not
published across.

We also fix the CORS origin to: 
- Access-Control-Allow-Origin set to "*" if no Origin is configured
- Access-Control-Allow-Origin set to "*" if any Origin is configured to
"*"
- - Access-Control-Allow-Origin set to array and have the "cors"
middleware to return an exact match on the user provided Origin.

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-12-14 17:35:22 +01:00
Ivar Conradi Østhus
10aa79eb56
fix: move docker-compose to this repo (#2666)
Use latest official image for Unleash for simplicity. 
Also takes away the proxy as it is not needed anymore.
2022-12-12 20:40:18 +01:00
Nuno Góis
5086ec7921
remove feature flag: tokens last seen (#2673)
https://linear.app/unleash/issue/2-470/clean-up-flag
2022-12-12 14:32:35 +00:00
Nuno Góis
e8d0fdba1f
remove feature flag: toggle tag filtering (#2668)
https://linear.app/unleash/issue/2-482/clean-up-feature-flag-after-this-goes-ga

Relevant discussion:
https://unleash-internal.slack.com/archives/C046LV6HH6W/p1670837328201169
2022-12-12 13:21:12 +00:00
Gastón Fournier
5fe238c896
task: Expose prometheus metrics (#2586)
## About the changes
This connects our backend with Prometheus (or compatible) metrics
service, and exposes raw data (i.e. acting as a proxy)

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2022-12-12 14:05:56 +01:00
Ivar Conradi Østhus
d9d9f01b37
feat: add capability to write heap snapshot. (#2611)
Is protected behind a config option called `enableHeapSnapshotEnpoint`.
When API endpoint is triggered it will write a heapSnapshot to disk.

Steps to create heap snapshot:

1. Add env variable `ENABLE_HEAP_SNAPSHOT_ENPOINT=true`. 
2. Call this endpoint: `/internal-backstage/heapSnapshot`
3. Download the created heapdump from the server. 

The snapshot can be loaded in the chrome dev-tool to analysis.
2022-12-08 11:25:39 +01:00
andreas-unleash
d69ca0a508
ui flags replaced in index.html (#2617)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- 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! ❤️ -->
This PR puts the ui flags in the index.html in a meta tag. This makes
them accessible without logging in and allows us to track user signups
with invite links
## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-12-07 14:31:27 +02:00
sjaanus
6b74b7c255
Fix error in migration when updating feature_environments (#2607)
Fixes a issue, where `variants` was null in features table, but column is not nullable.


Co-authored-by: sighphyre <liquidwicked64@gmail.com>
2022-12-06 14:57:54 +02:00
Gastón Fournier
aa20d2d418
Fix PATCH variants (old endpoint) when variants per environment are enabled (#2591)
## About the changes
This PR addresses some issues when working with variants after migrating
to variants per environment.

**Problem:** since PATCH
`/api/admin/projects/default/features/${featureName}/variants` does not
take into account `featureEnvironments`, when variantsPerEnvironment
gets enabled, this method will override the variants in other
environments (i.e. not doing a patch). This method has to be maintained
because of backward compatibility but it has to be adapted to deal with
variants per environment


https://linear.app/unleash/issue/2-476/when-using-patch-for-variants-without-environments-it-wipes-out

Co-authored-by: Nuno Góis <github@nunogois.com>
2022-12-06 09:47:54 +00:00
Thomas Heartman
8c42fbf34b
Docs(fix): add more (missing) redirects, fix links (#2592)
## What

This PR fixes some broken links we had in the application. It also adds
redirects for those links so that they should work in the future.

## Why

Because it's important to have links that work 💁
2022-12-06 09:32:42 +01:00
Mateusz Kwasniewski
e059b755c9
skip change request (#2598) 2022-12-05 15:38:17 +01:00
Mateusz Kwasniewski
b9290dd5ed
CR applier should be able to create strategy (#2597) 2022-12-05 12:39:13 +01:00
Simon Hornby
447bd44c99
Remove clone env and sync sso group flags (#2596)
Removes feature flags for syncing sso groups and clone environment.
These features are being made generally available for all who have
access to environments and sso groups
2022-12-05 12:07:15 +02:00
Ivar Conradi Østhus
4a3d26065f
Fix/cors expose ETag (#2594)
This commit fixes two issues with the frontend API

1. fix: update cors max age to match chromium defaults
https://source.chromium.org/chromium/chromium/src/+/main:services/network/public/cpp/cors/preflight_result.cc;drc=49e7c0b4886cac1f3d09dc046bd528c9c811a0fa;l=31
2: fix: expose ETage for cross-origin requests
2022-12-05 10:04:35 +01:00
Fredrik Strand Oseberg
bc3744d565
fix: remove stray only (#2589)
This removes stray onlys in our tests and adds a linter rule that will
error if only is present. Also updates the test result of one of our
tests as a result of [this pull
request](https://github.com/Unleash/unleash/pull/2344)
2022-12-02 13:10:39 +01:00
Tymoteusz Czech
79e96fdb98
feat: favorite feature and project (#2582)
## About the changes
Add an ability to star a toggle from it's overiew.

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-12-02 09:16:03 +02:00
sjaanus
e728ecba69
Remove signup conditional flag (#2581)
Remove signup flag
2022-12-01 14:12:54 +02:00
Gastón Fournier
bf0171518c
task: continue to return export v3 when variants per env disabled (#2529)
## About the changes
With the latest changes of variants per environment, we switched to
export schema v4 without having the feature toggle enabled. This moves
the variants to `featureEnvironments` when they were previously in
`features`. The main problem is that it can create confusion as the
exported file has the same variants for each one of the environments but
after importing the file the UI will only show one set of variants
attached to the feature.

With this change, we're maintaining the previous schema until the
feature toggle is enabled.
2022-12-01 11:13:49 +00:00
sjaanus
24fee65f7e
Make single project endpoint also return all features favorites (#2578)
Small update, that single project endpoint would also return features
with favorites.
2022-12-01 09:49:49 +02:00
Tymoteusz Czech
5f88269744
feat: favorite feature table icons (#2525) 2022-11-30 12:44:38 +00:00
Fredrik Strand Oseberg
dacaaa51b7
feat: default the frontend api flags to on (#2573)
* This PR turns on the flag for the frontendApi to be on by default. We
should still be able to override them from the unleash-cloud
distribution.
2022-11-30 13:33:07 +01:00
sjaanus
65851ba51c
Add favorite events (#2572)
This PR adds 4 new events

1. FAVORITE_FEATURE_ADDED
2.  FAVORITE_FEATURE_REMOVED
3. FAVORITE_PROJECT_ADDED
4. FAVORITE_PROJECT_REMOVED
2022-11-30 14:26:17 +02:00
sjaanus
a22d5f5a43
Favorite project (#2569)
Adds ability to favorite projects.

1. Can favorite project
2. Can unfavorite project
3. Favorite field is returned on `/api/admin/projects/default`
4. Favorite field is returned on` /api/admin/projects`
2022-11-30 13:41:53 +02:00
sjaanus
0d58371f11
Some tweaks to favorites (#2563)
This is follow up PR to https://github.com/Unleash/unleash/pull/2550,
which addresses the issues that came up from reviews.
2022-11-30 09:47:57 +02:00
sjaanus
9ac6b945be
Fix super small text issue (#2473)
Fix super small text issue

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-11-30 09:18:49 +02:00
Nuno Góis
7ce38ffe89
feat: update seen_at pat column (#2516)
https://linear.app/unleash/issue/2-451/update-last-seen-column-for-pats
2022-11-30 08:10:31 +02:00
Nuno Góis
4d8817698a
feat: add last seen column to token table (#2520)
https://linear.app/unleash/issue/2-449/add-table-column-to-api-tokens-table-ui
2022-11-30 08:07:13 +02:00
Nuno Góis
564c287025
Feat update token seen at (#2514)
https://linear.app/unleash/issue/2-448/update-last-seen-column-for-api-tokens

Co-authored-by: Ivar Conradi Østhus <ivar@getunleash.ai>
2022-11-29 19:46:40 +00:00
sjaanus
b32d3d0fee
Favorite features (#2550) 2022-11-29 16:06:08 +01:00
Mateusz Kwasniewski
e97922d065
store min approvals as part of change request creation (#2548) 2022-11-29 09:40:40 +01:00
Gastón Fournier
0943ff8f49
Fix OOM with eslint in migrations (#2545)
## About the changes
When adding a new migration, we might run out of memory. Migrations have
only JS files and we're running these through TS parser. Removing TS
config reference from `.eslintrc` proved to solve the issue while
running local manual tests

This still lints migration files but using JS syntax
2022-11-28 15:16:19 +01:00
Nuno Góis
1fec43947d
add feature flag: network view (#2543)
https://linear.app/unleash/issue/2-453/add-feature-flag
2022-11-28 13:48:02 +00:00
Christopher Kolstad
1ecbc32e14
task: Make operations on the API Token store auditable. (#2531)
## About the changes
We need a way to have an audit log for operations made on Api Tokens.
These changes adds three new event types, API_TOKEN_CREATED,
API_TOKEN_UPDATED, API_TOKEN_DELETED and extends api-token-service to
store these to our event store to reflect the action being taken.
2022-11-28 10:56:34 +01:00
Mateusz Kwasniewski
68162c2b66
make approvals unique (#2534) 2022-11-28 07:19:15 +01:00
Fredrik Strand Oseberg
5d52216d53
fix: adds cors caching (#2522)
* This PR adds a configurable maxAge header to the CORS middleware. This
allows the preflight request to be cached so that we can reduce the
request load on our end for the frontend clients starting to utilise the
frontend api.
2022-11-24 16:14:47 +01:00
andreas-unleash
35d9a62d89
Soft landing page on projects or last viewed project (#2499)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

This PR introduces a soft landing page to the last viewed project or to
the project list (if there is more than 1 project)

Changes: 
- Replaced clearing of `storage` with clearing `cache` in logout.ts ::
REVERTED
- Root redirects to `projects` instead of `features`

<!-- 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-23 15:58:02 +02:00
Simon Hornby
0897180af5
fix: resolve an issue where cloning a feature toggle with a segment (#2511)
fix an issue where cloning a feature toggle with a strategy with segments would raise an error but still clone successfully
2022-11-23 15:39:09 +02:00
Nuno Góis
f9726fdee9
add tokens last seen feature flag (#2512)
https://linear.app/unleash/issue/2-450/add-feature-flag
2022-11-23 13:33:02 +00:00
sjaanus
b071de6742
Add possibility to soft delete users (#2497)
Previously we hard deleted the users, but due to change requests and
possibly other features in future, we really want to hard-link user
table and have meaningful relationships.

But this means, when user is deleted, all linked data is also deleted.
**Workaround is to soft delete users and just clear users data and keep
the relationships alive for audit logs.**

This PR implements this feature.
2022-11-23 09:30:54 +02:00
Simon Hornby
801df6953c
fix: force clone feature to correctly copy variant environments (#2498)
patches an issue where cloning a feature would clone variants for
it's last found environment in the db. This now will clone the feature
environments correctly
2022-11-22 17:00:44 +02:00
Mateusz Kwasniewski
8af64e9370
add events and expose them for webhooks (#2493) 2022-11-22 13:39:15 +01:00
Simon Hornby
2a4ca96da2
Permission for variant environments (#2490)
adds permissions for variants per environment
2022-11-22 11:54:04 +02:00
Thomas Heartman
d5fbd0b743
refactor: move docs into new structure / fix links for SEO (#2416)
## What

This (admittedly massive) PR updates the "physical" documentation
structure and fixes url inconsistencies and SEO problems reported by
marketing. The main points are:

- remove or move directories : advanced, user_guide, deploy, api
- move the files contained within to the appropriate one of topics,
how-to, tutorials, or reference
- update internal doc links and product links to the content
- create client-side redirects for all the urls that have changed.

A number of the files have been renamed in small ways to better match
their url and to make them easier to find. Additionally, the top-level
api directory has been moved to /reference/api/legacy/unleash (see the
discussion points section for more on this).

## Why

When moving our doc structure to diataxis a while back, we left the
"physical' files lying where they were, because it didn't matter much to
the new structure. However, that did introduce some inconsistencies with
where you place docs and how we organize them.

There's also the discrepancies in whether urls us underscores or hyphens
(which isn't necessarily the same as their file name), which has been
annoying me for a while, but now has also been raised by marketing as an
issue in terms of SEO.

## Discussion points

The old, hand-written API docs have been moved from /api to
/reference/api/legacy/unleash. There _is_ a /reference/api/unleash
directory, but this is being populated by the OpenAPI plugin, and mixing
those could only cause trouble. However, I'm unsure about putting
/legacy/ in the title, because the API isn't legacy, the docs are. Maybe
we could use another path? Like /old-docs/ or something? I'd appreciate
some input on this.
2022-11-22 09:05:30 +00:00
Christopher Kolstad
f937e80272
fix: Updated event to include project (#2491)
### What
Our EnvironmentVariant needs project name so this PR makes sure our
service accepts the project id as one of the arguments.
2022-11-22 09:57:12 +01:00
Gastón Fournier
97372cf48c
fix: flaky tests on segments order (#2472)
## About the changes
This test fails randomly, example:
https://github.com/Unleash/unleash/actions/runs/3496006349/jobs/5853415518#step:5:376

It's not so frequent but I tested locally one out of 4 or 8 runs fails
because the rows returned are in the wrong order.

## Discussion points
If the order of segments is relevant, we should look into how we're
fetching them or applying a `sort()` before returning from the query.
I've validated on my machine that even if the segments are sent in
order, when pulled from the db sometimes they are processed in a
different order
2022-11-21 14:39:15 +01:00
andreas-unleash
6e5b214475
implement proxy all endpoint (#2460)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- 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! ❤️ -->

This PR implements the `all` endpoint of unleash-proxy, by adding an
experimental flag that can control the behaviour

## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-21 12:57:07 +02:00
Gastón Fournier
efd47b72a8
feat: Add variants per env (#2471)
## About the changes
Variants are now stored in each environment rather than in the feature
toggle. This enables RBAC, suggest changes, etc to also apply to
variants.

Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#2254

### Important files
- **src/lib/db/feature-strategy-store.ts** a complex query was moved to
a view named `features_view`
- **src/lib/services/state-service.ts** export version number increased
due to the new format

## Discussion points
We're keeping the old column as a safeguard to be able to go back

Co-authored-by: sighphyre <liquidwicked64@gmail.com>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2022-11-21 10:37:16 +01:00
andreas-unleash
a165eb191c
add back removed permissions and eventType from module exports (#2476)
Signed-off-by: andreas-unleash <andreas@getunleash.ai>

<!-- 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! ❤️ -->
This PR adds (back) the permissions and eventType module exports

## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2022-11-21 10:42:43 +02:00
Nuno Góis
93bd9d869a
Variants per environment (frontend) (#2453)
![image](https://user-images.githubusercontent.com/14320932/202286759-b9c30228-59cc-4c58-a7b0-3c6c3d0ecba6.png)
## About the changes

https://linear.app/unleash/issue/2-425/variants-crud-new-environment-cards-with-tables-inside-add-edit-and

Basically created parallel components for the **variants per
environments** feature, so both flows should work correctly depending on
the feature flag state. Some of the duplication means that cleanup
should be straightforward - Once we're happy with this feature it should
be enough to delete
`frontend/src/component/feature/FeatureView/FeatureVariants/FeatureVariantsList`
and do some little extra cleanup.

I noticed we had some legacy-looking code in variants, so this involved
*some* rewriting of the current variants logic. Hopefully this new code
looks nicer, more maintainable, and more importantly **doesn't break
anything**.

Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#2254

### Important files
Everything inside the
`frontend/src/component/feature/FeatureView/FeatureVariants/FeatureEnvironmentVariants`
folder.
2022-11-18 11:43:24 +00:00
Mateusz Kwasniewski
ac65778cfa
separate protected and unprotected routes (#2466) 2022-11-18 09:29:26 +01:00
Gastón Fournier
8e1fc73221
fix: flaky test on number of projects statistic (#2463) 2022-11-17 14:42:01 +01:00
Gastón Fournier
dc08f1dadd
fix: broken UI after import (#2447)
fix: broken UI when importing features into environments which are not linked to the feature's project

## Related to
- PR: https://github.com/Unleash/unleash/pull/2209
- Issue: https://github.com/Unleash/unleash/issues/2186
- Issue: https://github.com/Unleash/unleash/issues/2193

## Expected behaviour:
After importing we should see:

![image](https://user-images.githubusercontent.com/455064/202149719-fa74b3b7-3936-443b-9d0e-8f1ca2e779f4.png)

## About the changes
**The problem:** when we import we have projects, features and
environments. Each feature belongs to a project (this is by default and
the imported file enforces that). The links between projects and
features, or projects and environments, depend on us creating those
relationships. When we add a feature to an environment we're not
validating that the project and the environment are connected. Because
of that, in some situations (like in this test), we can end up with a
project with features but no environment.

This breaks a weak constraint we had which is that all projects should
have at least one environment.

**This PR makes the following assumption when importing**: _if a feature
is added to an environment, and that environment is still not linked to
the project that feature belongs to, then the project and environments
have to be linked_. The rationale behind this is that the user couldn't
have generated this export file without the project and environment
being linked together.
2022-11-17 14:05:57 +01:00
andreas-unleash
726ede5cbe
Define exports for enterprise (#2435)
<!-- 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! ❤️ -->
This PR sets up exports so that we can import in enterprise with just
"unleash-server".
This will free us to refactor unleash internals without breaking
enterprise

## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-17 13:02:40 +02:00
sjaanus
9176ffae1e
Change requests - add multiple reviewers (#2448)
This PR adds implements the frontend and migrations part of multiple
reviewers.

2 UI parts:

1. Configuration to add the count of required approvals
2. Handle multiple approvers in review page.
2022-11-17 11:08:29 +02:00
Fredrik Strand Oseberg
978674e33a
feat: update strategy segments with edit / create strategy (#2420)
* Refactors how we add / edit segments to make it more ergonomic to work with in regards to change requests
2022-11-16 15:35:39 +01:00
sjaanus
3ef0ca580a
Remove change request api protection (#2434)
Remove change request api protection
2022-11-15 14:13:09 +02:00
Nuno Góis
1ddc46011c
Feature toggles: Filtering by tags (#2396)
https://linear.app/unleash/issue/UNL-140/experiment-with-filtering-feature-toggles-by-tags-on-the-ui

Going with a naïve approach for now, tags can be searchable the same way
we search for text. The tags column only shows up if at least one toggle
has tags set. There's a simple highlightable component that lets us know
a match was found and then shows all the tags on a tooltip:
<img width="1289" alt="image"
src="https://user-images.githubusercontent.com/14320932/201155093-b8605ff2-5bf7-45c5-b240-a33da254c278.png">
2022-11-15 10:24:36 +00:00
Tymoteusz Czech
a191313956
refactor: remove public signup link feature flag (#2423)
## About the changes
Cleanup: remove feature flag.

Closes
[1-356/remove-feature-flag-from-the-code](https://linear.app/unleash/issue/1-356/remove-feature-flag-from-the-code)
2022-11-15 10:03:20 +01:00
Mateusz Kwasniewski
4f65ad555f
Changeset comments schema (#2425) 2022-11-15 09:15:56 +01:00
sjaanus
131ebb931a
Permission guards in existing endpoints interacting with feature toggle configuration (#2418)
This PR adds permission guards for operations.

1. Toggling feature flag
2. Adding a strategy
3. Updating a strategy
4. Deleting a strategy
2022-11-14 15:05:26 +02:00
Nuno Góis
2fa154a3e4
Update environments (#2339)
https://linear.app/unleash/issue/2-357/update-environments-pages
2022-11-11 10:24:56 +00:00
andreas-unleash
74c5189159
Feat/add change request settings (#2390)
<!-- 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! ❤️ -->
Add change_request_settings table 
Remove change_request_enabled column

## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-11 10:09:25 +02:00
Thomas Heartman
665638b9da
fix: Fix broken OpenAPI (#2379)
## What

This change removes the use of double quotes in the
'addPublicSignupTokenUser' endpoint summary. It also changes the
original summary to a description and adds a new, shorter summary.

## Why

The OpenAPI / docusaurus integration errors out (refer to [this failed
build](https://github.com/Unleash/unleash/actions/runs/3434792557/jobs/5726445104))
if the frontmatter contains invalid characters. In this case, it's
because the automatic sidebar label contains double quotes, which it
interprets as a new key having been declared:

```
Error:  Error while parsing Markdown front matter.
This can happen if you use special characters in front matter values (try using double quotes around that value).
Error:  Loading of version failed for version current
Error:  Unable to build website for locale en.
Error:  YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 4, column 12:
    description: "Create a user with the 'viewe ...
               ^
```

For some reason, I cannot reproduce this error locally. Instead, the
generation goes as expected.

---

Regarding using description instead of summary: summaries should be very
short and sweet, especially because they're also used in the generated
sidebar. Descriptions can be a bit wordier, so I added a shorter summary
for going forward.

## Generated output

This is what the old configuration would generate. Notice the
`sidedar_label` key on line 2:

```md
---
id: add-public-signup-token-user
sidebar_label: Create a user with the "viewer" root role and link them to a signup token
hide_title: true
hide_table_of_contents: true
api: {'tags': ['Public signup tokens'], 'operationId': 'addPublicSignupTokenUser', 'requestBody': {'description': 'createInvitedUserSchema', 'required': true, 'content': {'application/json': {'schema': {'type': 'object', 'additionalProperties': false, 'required': ['email', 'name', 'password'], 'properties': {'username': { 'type': 'string' }, 'email': { 'type': 'string' }, 'name': { 'type': 'string' }, 'password': { 'type': 'string' },},},},},}, 'responses': {'200': {'description': 'userSchema', 'content': {'application/json': {'schema': {'type': 'object', 'additionalProperties': false, 'required': ['id'], 'properties': {'id': {'type': 'number',}, 'isAPI': {'type': 'boolean',}, 'name': {'type': 'string',}, 'email': {'type': 'string',}, 'username': {'type': 'string',}, 'imageUrl': {'type': 'string',}, 'inviteLink': {'type': 'string',}, 'loginAttempts': {'type': 'number',}, 'emailSent': {'type': 'boolean',}, 'rootRole': {'type': 'number',}, 'seenAt': {'type': 'string', 'format': 'date-time', 'nullable': true,}, 'createdAt': {'type': 'string', 'format': 'date-time',},},},},},}, '400': {'description': 'The request data does not match what we expect.',}, '409': {'description': 'The provided resource can not be created or updated because it would conflict with the current state of the resource or with an already existing resource, respectively.',},}, 'parameters': [{'name': 'token', 'in': 'path', 'required': true, 'schema': { 'type': 'string' },},], 'description': 'Create a user with the "viewer" root role and link them to a signup token', 'method': 'post', 'path': '/invite/{token}/signup', 'servers': [{ 'url': '<your-unleash-url>' }], 'security': [{ 'apiKey': [] }], 'securitySchemes': {'apiKey': {'type': 'apiKey', 'in': 'header', 'name': 'Authorization',},}, 'jsonRequestBodyExample': {'username': 'string', 'email': 'string', 'name': 'string', 'password': 'string',}, 'info': { 'title': 'Unleash API', 'version': '4.17.2' }, 'postman': {'name': 'Create a user with the "viewer" root role and link them to a signup token', 'description': { 'type': 'text/plain' }, 'url': {'path': ['invite', ':token', 'signup'], 'host': ['{{baseUrl}}'], 'query': [], 'variable': [{'disabled': false, 'description': {'content': '(Required) ', 'type': 'text/plain',}, 'type': 'any', 'value': '', 'key': 'token',},],}, 'header': [{ 'key': 'Content-Type', 'value': 'application/json' }, { 'key': 'Accept', 'value': 'application/json' },], 'method': 'POST', 'body': {'mode': 'raw', 'raw': '""', 'options': { 'raw': { 'language': 'json' } }}}}
sidebar_class_name: 'post api-method'
info_path: docs/reference/api/unleash/unleash-api
---

import ApiTabs from "@theme/ApiTabs"; import MimeTabs from "@theme/MimeTabs"; import ParamsItem from "@theme/ParamsItem"; import ResponseSamples from "@theme/ResponseSamples"; import SchemaItem from "@theme/SchemaItem" import SchemaTabs from "@theme/SchemaTabs"; import DiscriminatorTabs from "@theme/DiscriminatorTabs"; import TabItem from "@theme/TabItem";

## Create a user with the &quot;viewer&quot; root role and link them to a signup token

Create a user with the &quot;viewer&quot; root role and link them to a signup token

<!-- And much much more! -->
```
2022-11-10 22:55:01 +01:00
sjaanus
e5a5d7ded9
Fix async issue (#2387)
Currently rows were returned as a list of promise, but we need to await
for them.
2022-11-10 14:27:09 +02:00
Mateusz Kwasniewski
076ce027ed
Extract gravatar URL fn (#2386) 2022-11-10 12:13:45 +01:00
Fredrik Strand Oseberg
ac78c8f732
Feat/change request permissions (#2382)
* Adds two new permissions for the new enterprise level change request: APPROVE_CHANGE_REQUEST and APPLY_CHANGE_REQUEST
2022-11-10 11:08:58 +01:00
Ivar Conradi Østhus
1312579bf6
fix: upgrade @types/node to v16.18.3 (#2365)
This pr upgrade @types/node to v16.18.3.
This also detected some inconsitent retrun types that I decided to fix.
2022-11-10 08:20:15 +01:00
Ivar Conradi Østhus
325cd34c0c
fix: remove 'fixHourMetrics' flag 2022-11-09 22:45:30 +01:00
andreas-unleash
47a617c78b
Add changeRequestEnabled to project and project_environments (#2357)
<!-- 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! ❤️ -->

- Add `change_request_enabled` column to `projects` and
`project_environments`
- Modified the store to include the new column
- Added new column to Project open api schema 

## 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. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
2022-11-09 14:44:53 +02:00
Sebastian Bury
f316e99dca
Authorization header webhook (#2356)
Added unit test and made code prettier in 
webhook.ts
webhook.test.ts
2022-11-09 11:45:30 +01:00
sjaanus
5e14e80ae3
Change request approvals table (#2347)
1. Added database table for change request approvals
2. Removed separate endpoint for applying. **Now all state changes will
go through same endpoint.**
2022-11-09 10:40:47 +02:00
Christopher Kolstad
5b3d95cc3a
If baseUriPath is set format it, but if it's not, don't override default with empty string (#2118)
From Thomas and mine testing. BaseUriPath can't be set as an environment
variable because we override it when trying to format the URI from the
server config. This PR makes sure we only format if the custom server
options actually have baseUriPath set.

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-11-08 15:29:14 +01:00
Thomas Heartman
d5e33ab1f2
Fix(export API): accept true and false as param values (#2349)
## What

This PR updates the `paramToBool` function to first check whether the
incoming argument is a boolean. This fixes the bug where using `true` or
`false` (e.g. `Strategies=false`) in the query would cause the server to
crash.

I've also added a test case to check for these values.

## Why

While working on the import/export API docs, I noticed that using
`false` in an export request caused the server to crash.

As we want to allow `true` and `false` (and use these values in the
documentation), we should ensure that they work as expected.

## Background

It's likely that this bug was introduced when we added the new OpenAPI
query parameters to the export endpoint. Because of the way that the
OpenAPI service we use does conversion, we now get `true` and `false`
converted to actual boolean values instead of strings. The `paramToBool`
function didn't account for that previously, which is why it caused the
server to crash.
2022-11-08 15:25:02 +01:00
Thomas Heartman
f5fb7b66d1
Fix: validate that the project is correct when getting feature by project (#2344)
## What

This PR fixes a bug where fetching a feature toggle via the
`/api/admin/projects/:projectId/features/:featureName` endpoint doesn't
validate that the feature belongs to the provided project. The same
thing applies to the archive functionality. This has also been fixed.

In doing so, it also adds corresponding tests to check for edge cases,
updates the 403 error response we use to provide clearer steps for the
user, and adds more error responses to the OpenAPI documentation.

## Why

As mentioned in #2337, it's unexpected that the provided project
shouldn't matter at all, and after discussions internally, it was also
discovered that this was never intended to be the case.

## Discussion points

It might be worth rethinking this for Unleash v5. Why does the features
API need the projects part at all when features are unique across the
entire instance? Would it be worth reverting to a simpler feature API
later or would that introduce issues with regards to how different
projects can have different active environments and so on?

### Further improvements

I have _not_ provided schemas for the error responses for the endpoints
at this time. I considered it, but because it would introduce new schema
code, more tests, etc, I decided to leave it for later. There's a
thorough OpenAPI walkthrough coming up, so I think it makes sense to do
it as part of that work instead. I am happy to be challenged on this,
however, and will implement it if you think it's better.

### Why 403 when the project is wrong?

We could also have used the 404 status code for when the feature exists
but doesn't belong to this project, but this would require more (and
more complex) code. We also already use 403 for cases like this for
post, patch, and put. Finally, the [HTTP spec's section on the 403
status code](https://httpwg.org/specs/rfc9110.html#status.403) says the
following (emphasis mine):

> The 403 (Forbidden) status code indicates that the server
**_understood the request but refuses to fulfill it_**. A server that
wishes to make public why the request has been forbidden can describe
that reason in the response content (if any).
>
> If authentication credentials were provided in the request, the server
considers them insufficient to grant access. The client SHOULD NOT
automatically repeat the request with the same credentials. The client
MAY repeat the request with new or different credentials. However, **_a
request might be forbidden for reasons unrelated to the credentials_**.

As such, I think using 403 makes sense in this case.

---

Closes #2337.
2022-11-08 13:34:01 +01:00
Fredrik Strand Oseberg
f76ac0edb3
Fix/embedded proxy memory leak (#2345)
* Fixes a memory leak where events would trigger the data polling to restart. Any event would setup another polling interval, which would strain our database. Separated the logic for fetching the data and the polling, and made sure that the polling was only initialized once.
2022-11-08 12:35:53 +01:00
Ivar Conradi Østhus
bf521b58fd
fix: merge order for UI config 2022-11-04 14:43:12 +01:00
sjaanus
102713eeca
Remove uniqueness from change requests merging (#2332)
Remove uniqueness
2022-11-04 10:57:45 +02:00
Ivar Conradi Østhus
2d2d6f268a
fix: generate all hour buckets if missing (#2319) 2022-11-04 09:30:02 +01:00
sjaanus
0de0da8f97
Remove manually added migrations and fix the scripts (#2324)
* Fix migrations

* Fix migrations
2022-11-03 14:05:47 +02:00
Nuno Góis
9fb431aab7
fix: limit total of PATs a user can have (#2301)
* fix: limit total of PATs a user can have

* increase PAT limit to 10

* Update src/lib/services/pat-service.ts

Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>

* disable button on the front-end when PAT limit is reached

* import from server instead of repeating ourselves

Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
2022-11-02 08:11:35 +00:00
sjaanus
5dd8616c74
Rename suggest changes to change request (#2311)
* Rename change request

* Merge with review status

* Move events and permissions
2022-11-02 08:34:14 +02:00
sjaanus
e3a185d650
Hard cap expiry date of public signup token (#2308)
Validate expiry
2022-11-01 11:38:18 +02:00
sjaanus
c501fb221c
Hyperlink Injection in People Invitation Emails (#2307)
* Strip special characters

* Allow hyphens
2022-11-01 10:38:33 +02:00
Fredrik Strand Oseberg
8f37f9fcc9
fix: re export knex (#2300) 2022-10-31 10:49:12 +01:00
Nuno Góis
07821174a5
refactor: remove PAT experimental flag (#2299) 2022-10-31 09:38:30 +00:00
Fredrik Strand Oseberg
3029564304
Feat/enterprise stores (#2289)
* feat: add capabilities for stores in enterprise

* fix: remove unused files
2022-10-31 10:35:59 +01:00
Simon Hornby
0553976240
add support for cloning environments (#2205)
* Add support for cloning environments

Co-authored-by: Nuno Góis <github@nunogois.com>
2022-10-28 11:27:11 +02:00
Fredrik Strand Oseberg
b2c099a1c0
Feat/apply changes api (#2276)
* feat: initial setup

* fix: add types for suggest changes payload

* feat: add types for change events

* fix: change param order

* fix: remove enum

* fix: remove unused method

* fix: remove method from interface
2022-10-28 09:29:00 +02:00
sjaanus
dda1f19c70
Suggest changes updates (#2273)
* Make domain type and schema match

* Deleting change from changeset

* Add ability to merge
2022-10-27 15:47:46 +03:00
Thomas Heartman
5cef605272
OpenAPI(feat): add new 'Segments' tag (#2241)
* OpenAPI(feat): add new 'Segments' tag

## What

This change adds a new Segments tag to the list of valid OpenAPI tags.

## Why

When updating tags for the enterprise version of Unleash, I realized
we didn't have any tags that were appropriate for the segments
endpoints.

* chore: Update snapshot
2022-10-27 10:40:32 +02:00
sjaanus
3daef1d00c
Suggest change - update status and get per project (#2266)
Set change status
2022-10-27 10:53:47 +03:00
Fredrik Strand Oseberg
929f824a3a
fix: refactor conditional middleware (#2261)
* fix: refactor conditional middleware

* fix: update tests

* test: update snapshot to hide things behing flag from openapi

Co-authored-by: kwasniew <kwasniewski.mateusz@gmail.com>
2022-10-26 13:00:49 +02:00
sjaanus
2c95dfefd1
Suggest changes refactoring and schema fixes (#2250)
* Draft done

* Update GET endpoint

* Update to latest schema

* Fixes
2022-10-26 13:26:15 +03:00
renovate[bot]
d8df7e5815
fix(deps): update dependency unleash-client to v3.16.0 (#2235)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-10-26 10:23:33 +02:00
Ivar Conradi Østhus
cf4fc2303b
Feat/stats service (#2211)
Introduces an instance stats service exposing usage metrics of the Unleash installation.
2022-10-25 13:10:27 +02:00
andreas-unleash
85631b9951
Add suggest-change-store.ts and db migration (#2201)
* Add suggest-change-store.ts and db migration

* Add suggest-change-store.ts and db migration

* change payload and event data type

* Update src/lib/db/suggest-change-store.ts

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* split to 3 tables, create event on every change

* split to 3 tables, create event on every change

* Move service to enterprise
PR Comments

* PR Comments

* replacy createdBy string with User

* replace createdBy string with User

* added event to docs

* return entire changeset after adding a change

* bug fix

* bug fix

* move add change return to service layer

* PR comments

* added user id to user objects

* added user id to user objects

* added user id to user objects

* bug fix

* Rework

* Remove event and fix queries

* Update snapshot

* Remove console logs

* Fix

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-10-24 20:07:29 +03:00
sellinjaanus
8270166286
Review your changes - approval flow (#2215)
* Initial changes

* Fix

* continue styling changes review draft

* fix: remove unused import

* update flags snapshot

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
Co-authored-by: Tymoteusz Czech <tymek+gpg@getunleash.ai>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2022-10-24 19:15:22 +03:00
Nuno Góis
d696863a51
feat: convert environment actions to a popover menu, add clone option (#2214)
* feat: convert environment actions to a popover menu, add clone option

* add cloneEnviroment feature flag, hide the clone option behind it

* fix: update snap
2022-10-21 08:11:14 +01:00
Tymoteusz Czech
b8c3833ae4
Suggest changes - initial frontend (#2213)
* feat: add initial controller

* feat: add fe

* feat: return status codes

* remove backend experiment

* refactor standalone route for project banner

* update suggest changeset type

* refactor changeset mock

* suggest changes banner feature flag

* fix: update routes snapshot

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-10-20 14:00:48 +02:00
sellinjaanus
726674ea3e
UX additions to groups SSO syncing (#2200)
* Initial commit

* Fix snapshot

* Fixes

* Small fix

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-10-20 10:47:19 +03:00
sellinjaanus
8618cec832
Import of feature still showing env on feature, when environment is disabled on project (#2209)
* Import state test

* Update importer

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-10-19 15:05:07 +03:00
Fredrik Strand Oseberg
b0626d46bc
fix: respect environment if set on context (#2206)
When using the frontend api (embedded proxy) we should allow the use to self-define the environment on the proxy.
2022-10-19 12:29:00 +02:00
sellinjaanus
4068e4749f
Fix all groups being removed, even when no external groups were defined (#2197)
* Syncing groups

* Add tests

* Fix all groups being removed

Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-10-17 11:44:36 +03:00
Ivar Conradi Østhus
1f0fa6abfe
fix: filter empty metrics before we collect last seen toggles. (#2172)
* fix: filter empty metrics before we collect last seen toggles.

fixes: #2104

* fix: add a last-seen service to batch last-seen toggle updates

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2022-10-17 09:06:59 +02:00
Nuno Góis
076a007b42
fix: PATs should have an unique description (per user) (#2191)
* fix: PATs should have an unique description

* add pat validation on the back-end service

* Update src/lib/services/pat-service.ts

Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>

* fix: only consider current user's PATs

* fix tests

* cleanup

* Update frontend/src/component/user/Profile/PersonalAPITokensTab/CreatePersonalAPIToken/CreatePersonalAPIToken.tsx

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/test/e2e/api/admin/user/pat.e2e.test.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-10-14 13:28:29 +01:00
sjaanus
06ebe4fca0
Syncing external groups with unleash group (#2194)
* Syncing groups

* Add tests
2022-10-14 13:08:14 +03:00
Nuno Góis
a3bf564100
feat: add SSO mappings to groups (#2175)
* feat: add SSO mappings to groups

* add feature flag to conditionally render

* fix EditGroupUsers

* fix: update snap
2022-10-13 11:34:47 +01:00
Simon Hornby
33c084dd0f
feat: Add group sync settings to front end (#2183)
* feat: Add group sync settings to front end

Co-authored-by: Nuno Góis <github@nunogois.com>
2022-10-13 10:13:41 +02:00
Fredrik Strand Oseberg
b341018b1d
fix: CORS options path (#2165)
* fix: path

* fix: path typo
2022-10-11 09:20:29 +02:00
Nuno Góis
2fa86ef97f
fix: PAT not taking into account expires_at (#2167) 2022-10-10 15:38:47 +01:00
andreas-unleash
0651c83bd1
Docs/public signup (#2070)
* update snapshot

* add api doc

* describe api

* reference initial

* updated public signup api docs
created public invite api docs

* docs

* docs update

* docs update

* add description to openapi endpoints

* add description to openapi endpoints

* fix snapshot

* Update src/lib/openapi/spec/public-signup-token-create-schema.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/openapi/spec/public-signup-token-schema.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/routes/admin-api/public-signup.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/routes/public-invite.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/openapi/spec/public-signup-token-schema.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/routes/admin-api/public-signup.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update website/docs/reference/public-signup.mdx

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* PR comments

* delete api docs

* fix snapshot

* Update src/lib/routes/admin-api/public-signup.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* bug fix

* bug fix

* bug fix

* Update src/lib/openapi/spec/public-signup-token-create-schema.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/openapi/spec/public-signup-token-schema.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/openapi/spec/public-signup-token-update-schema.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/routes/admin-api/public-signup.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/routes/admin-api/public-signup.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update src/lib/routes/public-invite.ts

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* bug fix

* fix links

* update snapshot

* update snapshot

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-10-10 16:12:11 +03:00
andreas-unleash
64b8df7ee0
fixed segments not being copied (#2105)
* fixed segments not being copied

* fix fmt

* bug fix

* return segmentId[] when getting a feature strategy

* do not return segments if they are not there

* Update src/lib/services/feature-toggle-service.ts

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* fix lint

* fix: more explicit column sorting and bug fix

* update snapshot

* rollback

* add segment ids to feature strategies

* bug fix

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2022-10-10 15:32:34 +03:00
sjaanus
c105ca02f1
Change PAT primary key from string to number (#2163)
* Update primary key

* Fix tests
2022-10-10 13:35:12 +03:00
Thomas Heartman
003b0e7a4e
#1391: ensure all tags are valid (#2124)
## What

This PR does two things:

1. Add tests to ensure that all OpenAPI tags are listed in the root-level `tags` property of the spec.
2. Changes the tags for endpoints that use any of the deprecated tags (specifically `admin`).

## Why

When we moved to using the docusaurus OpenAPI doc generator, we made some changes to existing tags. Moving away from having just 'admin', 'client', and one or two more, we now use a more granular system, which makes it easier to find an endpoint by category.

However, there's currently nothing enforcing this and this bit of knowledge hasn't been clearly communicated to anyone. Because of this, we have some endpoints that are currently just grouped under a general 'admin' tag.

This has two drawbacks:

-   In Swagger UI, all these endpoints are grouped together. This means that they break with the expectation that each endpoint has its own category. Further, being lumped together means that the 'admin' group is hard to read.
-   The 'admin' tag is (on purpose) not included in the root-level `tags` property of the generated OpenAPI spec. This means that the OpenAPI docusaurus generator doesn't pick up those endpoints, which means that they're not included in the docs on docs.getunleash.io.

## How

By implementing tests that:

1. Check that the tags included in the spec are a subset of the "approved" tags

2. By checking each path in the OpenAPI spec and making sure that all its tags are listed in the root-level tag list. If this is not the case, the test fails and it logs an error explaining what is wrong to the console. An example of such a message is:

```
The OpenAPI spec contains path-level tags that are not listed in the root-level tags object. The relevant paths, operation ids, and tags are as follows:

POST /api/admin/feedback (operation id: createFeedback) has the following invalid tags: "admin"

PUT /api/admin/feedback/{id} (operation id: updateFeedback) has the following invalid tags: "admin"

For reference, the root-level tags are: "Addons", "Admin UI", "API tokens", "Archive", "Auth", "Client", "Context", "Edge", "Environments", "Events", "Features", "Import/Export", "Metrics", "Operational", "Playground", "Projects", "Public signup tokens", "Strategies", "Tags", "Unstable", "Users"
```

## Commits

* fix: ensure that all root-level tags in the spec are 'approved tags'

* fix: test that all listed path tags exist in the root-level tags

* fix: use "API tokens" tag for PAT endpoints

* fix: add comment explaining why tags test is there

* fix: Update snapshot

* fix: ensure that spec tags are a subset of the approved Tags

* fix: improve error message when tags don't match

* fix: further tweaks in log format
2022-10-06 15:01:12 +00:00
sjaanus
3ec1241412
Update how project member count works (#2132)
Update project member counts
2022-10-06 10:19:19 +03:00
Ivar Conradi Østhus
a09c6313b1
fix: auto add stratgy when enabling empty env. (#2137) 2022-10-05 23:33:36 +02:00
Aneesh Relan
1d5249eddc
fix: slack back link url to point to the feature page (#2128)
* fix: slack back link url to point to the feature page

* update snapshots

* update feature link in case project info is available in event

* update missing snapshot
2022-10-05 11:30:51 +02:00
Aneesh Relan
528748e757
fix: use correct column name for correct member count (#2127) 2022-10-04 10:45:55 +03:00
Nuno Góis
ddcfe132e4
feat: new profile page and PATs front-end (#2109)
* feat: new user dropdown and profile page

* fix: add popup boxShadow to dark-theme

* fix: update routes snap

* refactor: move some tab specific logic into tabs component

* add useProfile hook example

* fix profile tab header (no name)

* fix: hide user popup when clicking profile link

* - add PATs to profile;
- add route logic to profile;
- refactor TimeAgoCell title;
- misc fixes and refactoring;

* add profile info to profile tab

* simplify req paths

* add PAT flag to the front-end

* fix: some UI adjustments

* change user popup buttons to links

* fix profile on front-end, add role description

* update delete PAT text

* address some PR comments

* address PR comments

* some more UI fixes and refactoring

* move password request to API hook
2022-10-03 10:49:52 +01:00
Ivar Conradi Østhus
5141e77bce
fix: add appName to http response time metrics (#2117) 2022-09-30 15:28:50 +02:00
andreas-unleash
bd9172b7a0
Update public signup migration files (#2120)
Update
2022-09-30 15:20:24 +03:00
sjaanus
ddc759ac63
Add some extra fields for profile (#2119)
First version
2022-09-30 14:36:45 +03:00
Tymoteusz Czech
47152cf05b
Feat/invite user (#2061)
* refactor: user creation screen cleanup

* feat: deprecation notice for google sso

* fix: docs openid typo

* invite link bar

* invite link page

* fix prettier docs

* regenerated openapi

* hooks for invite page api

* update openapi

* feat: invite link update

* feat: add public signup token soft-delete

* public signup frontend feature flag

* fix: new user api issues

* feat: allow for creating new user from invite link

* Feat/invite user public controller (#2106)

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* added PublicInviteController for public urls

* fix test

* fix test

* update openapi

* refactor: password reset props

* fix: public invite schema and validation

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* user invite frontend

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>

* invite link delete confirmation dialog

* refactor: password reset action

* fix: new user invite loading state

* fix: run ts check with ci

* revert openapi changes

* fix: invite token api interface

* fix: openapi schema index

* fix: update test snapshots

* update frontend snapshot

* fix: prettier ci

* fix: updates after review

Co-authored-by: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com>
Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2022-09-30 13:01:32 +02:00
andreas-unleash
5e2d96593a
sort feature strategies by created_at first and then sort_order (#2116)
* sort feature strategies by created_at first and then sort_order

* fix sorting
2022-09-30 12:50:00 +03:00
sjaanus
ec7e256140
Backend for profile page (#2114)
* First version of profile

* Fix tests

* Fix typings

* Replace where to andwhere to be more clear
2022-09-29 16:27:54 +03:00
sjaanus
d5f621f3b2
Add test for api-token-middleware to not make database call when using PAT (#2110)
* Middleware first version

* Middleware tests

* Add tests

* Finish middleware tests

* Add type for request

* Add flagresolver

* Fix snapshot

* Update flags and tests

* Put it back as default

* Update snapshot

* Add middleware test
2022-09-29 08:53:29 +03:00
sjaanus
d79ace57ec
Personal access token middleware (#2069)
* Middleware first version

* Middleware tests

* Add tests

* Finish middleware tests

* Add type for request

* Add flagresolver

* Fix snapshot

* Update flags and tests

* Put it back as default

* Update snapshot
2022-09-28 16:53:56 +03:00
Fredrik Strand Oseberg
7fbe227e0f
Fix/frontendapi synchronization (#2100)
* feat: add db fetch polling for proxy endpoints

* feat: add test for retrieving cache on interval

* feat: configurable interval

* fix: add config options

* feat: docs

* fix: add config to proxy-repository

* fix: update snapshots

* Update website/docs/reference/front-end-api.md

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* fix: update docs

* Update website/docs/deploy/configuring-unleash.md

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

* Update website/docs/reference/front-end-api.md

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-09-28 14:23:41 +02:00
Tymoteusz Czech
0086f2f19f
Fix: prevent password reset email flooding (#2076)
* fix: prevent password reset email flooding

* feat: add tests to user service for password reset
2022-09-28 10:24:43 +02:00
Gard Rimestad
9aa1c7aeb0
fix: client registration events are on eventStore (#2093)
Client registration events are on eventStore and not on eventBus. This
change makes us have sdk name and version metrics in unleash.
2022-09-27 11:06:06 +02:00
andreas-unleash
0da2054aa4
fixed missing role by calling get after insert (#2091)
* fixed missing role by calling get after insert

* update snapshot
2022-09-26 16:50:54 +03:00
sjaanus
b206d582ed
Fix snapshot so tests will work (#2092)
Fix snapshot
2022-09-26 16:30:18 +03:00
sjaanus
2a54ace005
Add description to PAT (#2090)
* Add description to PAT

* Add tests
2022-09-26 15:42:39 +03:00
andreas-unleash
aa589b5ff5
Fix/oas response (#2068)
* bug fix

* bug fix

* remove doc file

* store fixes

* bug fix

* rollback deleted file

* fix test

* add url to token

* return all tokens not just active

* add url fix

* PR comment

* PR comment

* PR comment

* add the flag to the experimental options

* fix env var name
2022-09-26 13:06:30 +03:00
sjaanus
1426d5be33
Added login endpoint rate limit (#2074)
* Added login rate limit

* Make more pretty

* Make more pretty

* Fix

* Remove double after all
2022-09-26 10:58:58 +03:00
sjaanus
74c5db60be
Fix openapi snapshot so tests will not fail (#2085)
Fix openapi
2022-09-26 10:15:29 +03:00
Thomas Heartman
f131d5a7f8
fix: Revert breaking change for incoming token creation reqs (#2084)
## What

This change reverts the spec change to create-api-token-schema that
was introduced in 97c2b3c089

That commit changed the endpoint from allowing any string to only
allowing strings that match the values of the ApiTokenType value.

## Why

Because we already validate this on the backend, I didn't think it
would break anything. However, because OpenAPI enums are case
sensitive (and do not currently support anything else), it _did_ break
the API. ([stack overflow post that explains how this
works](https://stackoverflow.com/questions/60772786/case-insensitive-string-parameter-in-schema-of-openapi))

## Of note

This should have been caught by the tests, but it didn't show up until
it was merged to the main branch. I think it might be worth looking
into how we do the PR testing.
2022-09-23 16:01:47 +02:00
Thomas Heartman
97c2b3c089
openapi: improve validation testing (#2058)
## What

This PR adds an extra layer of OpenAPI validation testing to what we already have. It also fixes any issues that make the new tests fail.

## Why

While the current OpenAPI validation takes care of _some_ things, there's also things it misses, as shown by #2055. By adding the OpenAPI Enforcer package, we should hopefully be able to catch more of these errors in the future. The enforcer _does_ flag the issue in #2055 as an error.

## How

By adding the OpenAPI Enforcer package and making whatever changes it picks up on.

By adding location headers to all our 201 endpoints. I also had to change some signatures on `create` store methods so that they actually return something (a lot of them just returned `void`).

## Discussion points

### Code changes

Some of the code changes may not be necessary or we may want to change more code to align with what changes have been done. It may be worth standardizing on a pattern for `*store.create` methods, so that they always return an identifier or the stored object, for instance.

### On relative URIs

The 201 location headers use relative URIs to point to the created resources. This seemed to be the easiest way to me, as we don't need to worry about figuring out what the absolute URL of the instance is (though we could probably just concat it to the request URI?). The algorithm for determining relative URIs is described in [RFC 3986 section 5](https://www.rfc-editor.org/rfc/rfc3986#section-5).

There's also some places where I'm not sure we _can_ provide accurate location url. I think they're supposed to point _directly at_ whatever the resource is, but for some resources (such as api tokens), you can only get it as part of a collection. From [RFC 9110 on the location field](https://httpwg.org/specs/rfc9110.html#field.location) (emphasis mine):

> the Location header field in a [201 (Created)](https://httpwg.org/specs/rfc9110.html#status.201) response is supposed to provide a URI that is **specific** to the created resource.

A link to a collection is not specific. I'm not sure what best to do about this.

### Inline comments

I've added a number of inline PR comments that I'd love to get some feedback on too. Have a look and let me know what you think!

### Unfinished business

I've added some juicy comments to some of the files here. They contain non-blocking issues that I'm tracking (via github issues). We should resolve them in the future, but right now they can stay as they are. 

## Commits

* Feat: add openapi-enforcer + tests; fix _some_ issues

* Test: allow non-standard string formats

* validation: fix _some_ 201 created location header endpoints

* #1391: fix remaining 201 location headers missing

* Refactor: use the ajv options object instead of add* methods

* #1391: flag validation errors and warnings as test failures

* #1391: modify patch schema to specify either object or array

We don't provide many patch endpoints, so we _could_ create separate
patch operation objects for each one. I think that makes sense to do
as part of the larger cleanup. For now, I think it's worth to simply
turn it into one of these. While it's not entirely accurate, it's
better than what we had before.

* Refactor: make tests easier to read

* #1391: use enum for valid token types

This was previously only a description. This may seem like a breaking
change because OpenAPI would previously accept any string. However,
Joi also performs validation on this, so invalid values wouldn't work
previously either.

* #1391: Comment out default parameter values for now

This isn't the _right_ way, but it's the pragmatic solution. It's not
a big deal and this works as a stopgap solution.

* #1391:  add todo note for api token schema fixes

* #1391: update snapshot

* Revert "#1391: modify patch schema to specify either object or array"

This reverts commit 0dd5d0faa1.

Turns out we need to allow much more than just objects and arrays.
I'll leave this as is for now.

* Chore(#1391): update comment explaining api token schema TODO

* #1391: modify some test code and add comment

* #1391: update tests and spec to allow 'any' type in schema

* Chore: remove comment

* #1391: add tests for context field stores

* #1391: add location header for public signup links

* #1391: fix query parameter description.

There was indeed a bug in the package, and this has been addressed
now, so we can go back to describing the params properly.
2022-09-23 15:02:09 +02:00
Christopher Kolstad
667fb9a8cf
fix: deletes all sessions for user on logout (#2071)
* fix: deletes all sessions for user on logout
2022-09-23 14:19:17 +02:00
Thomas Heartman
8869e6f04d
Refactor(#1391): don't check for OpenAPI version in snapshot tests (#2072)
* Refactor(#1391): don't check for OpenAPI version in snapshot tests

remove the version from the received specification. The version
_is_ a required field, but having the version listed in automated
testing causes issues when trying to deploy new versions of the
API (due to mismatch between new tag versions etc). That's why we
remove it.

* #1391: test that the "semver" property is present

* #1391: test that the openapi version is valid semver

* Chore(#1391): comment formatting
2022-09-19 09:07:26 +00:00
sjaanus
1cf42d6527
Personal access tokens backend (#2064)
* First version ready

* Final

* Refactor

* Update pat store

* Website revert

* Website revert

* Update

* Revert website

* Revert docs to main

* Revert docs to main

* Fix eslint

* Test

* Fix table name
2022-09-16 10:54:27 +03:00
Thomas Heartman
ca6c5854f4
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 10:22:21 +00:00
andreas-unleash
616ce5a93c
Fix/oas tags (#2065)
* bug fix

* update snapshot
2022-09-15 11:18:54 +02:00
Christopher Kolstad
c52cec5df4
fix: Do not call store function in constructor 2022-09-15 09:48:14 +02:00
andreas-unleash
6778d347cd
PublicSignupTokens (#2053)
* PublicSignupTokens

* bug fix

* bug fixes and test

* bug fixes and test

* bug fixes and test

* Add feature flag

* tests

* tests

* Update 20220908093515-add-public-signup-tokens.js

Bug Fix

* task: use swc instead of ts-jest (#2042)

* Add a counter for total number of environments (#1964)

* add groupId to gradual rollout template (#2045)

* add groupId to gradual rollout template

* FMT

* Improve tabs UI on smaller devices (#2014)

* Improve tabs UI on smaller devices

* Improve tabs UI on smaller devices

* bug fix

* add proper scrollable tabs

* removed centered from Tabs (conflicts with scrollable)

* PR comments

* 4.15.0-beta.10

* Fix broken doc links (#2046)

## What

This PR fixes some broken links that have been hanging around in the
docs for what seems like a very long time.

## Why

As discovered by the link check in #1912, there are a fair few broken
links in the docs. Everyone hates broken links because it makes it
harder to understand what they were supposed to be pointing at.

## How

There are 3 types of links that have been fixed:
- Links that should have been internal but were absolute. E.g.
  `https://docs.getunleash.io/path/article` that should have been
  `./article.md`
- External links that have changed, such as Slack's API description
- GitHub links to files that either no longer exist or that have been
  moved. These links generally pointed to `master`/`main`, meaning
  they are subject to change. They have been replaced with permalinks
  pointing to specific commits.

-----

* docs: fix slack api doc link

* docs: update links in migration guide

* docs: fix broken link to ancient feature schema validation

* docs: update links to v3 auth hooks

* docs: update broken link in the go sdk article

* Fix: use permalink for GitHub link

* docs: fix wrong google auth link

* 4.15.0

* 4.15.1

* docs: update link for symfony sdk (#2048)



The doc link appears to have pointed at an address that is no longer reachable. Instead, let's point to the equivalent GitHub link

Relates to and closes #2047

* docs: test broken links in website (#1912)

The action triggers manually as a first step to test this functionality. In the near future, we might schedule it

* Schedule link checker action (#2050)

Runs at 12:30 UTC on Mon, Tue, Wed, Thu and Fri

* fix: add env and project labels to feature updated metrics. (#2043)

* Revert workflow (#2051)

* update snapshot

* PR comments

* Added Events and tests

* Throw error if token not found

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.ai>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2022-09-14 15:29:12 +03:00
Florian Bunsmann
3a0113d16a
Add support for req.logout with passport version 0.6.0 and onwards (#2041)
Handle logout based on passport version
2022-09-13 09:59:34 +02:00
Thomas Heartman
518fee1a8c
Fix validate-edge-tokens OpenAPI schema (#2055)
* fix: varidate-edge-tokens-schema tokens type

This change fixes the description of the 'tokens' array of the
validate edge tokens schema.

The source of the error was a simple inverson of anyOf and items.

* fix: update snapshot
2022-09-12 15:51:52 +02:00
Fredrik Strand Oseberg
721cd20b5d
feat: add method for migrating proxies without environment validation (#2056) 2022-09-12 13:22:23 +00:00
Ivar Conradi Østhus
a7ed7557ec
fix: add env and project labels to feature updated metrics. (#2043) 2022-09-08 11:01:27 +02:00
Christopher Kolstad
4ed05047f3
Add a counter for total number of environments (#1964) 2022-09-06 13:24:13 +02:00
Christopher Kolstad
8648649047
task: use swc instead of ts-jest (#2042) 2022-09-06 13:22:41 +02:00
Tymoteusz Czech
18fc5eebd2
fix: show addon event select validation (#2031)
* fix: show addon event select validation

* fix: addon form parameters error not clearing

* fix: addon required parameter field indicators
2022-09-05 11:00:59 +02:00
Christopher Kolstad
ae19cae8a9
feat: add count to event list (#2036)
* feat: add count to event list
2022-09-02 08:35:31 +02:00
sjaanus
ad546a054f
Create endpoint that validates tokens for edge (#2039)
* Create new endpoint

* Change edge url

* Fix snapshot
2022-09-01 13:26:26 +00:00
olav
30dab4f367
fix: use correct proxy logger name (#2027) 2022-08-31 16:02:22 +02:00
olav
f06470dfa7
fix: attempt to unflake version service tests (#2008) 2022-08-31 08:06:25 +02:00
Ivar Conradi Østhus
8ef7789769
fix: Sliding window functionality for summaries (#1999)
Make the percentile metrics more adaptive to changes.
https://github.com/siimon/prom-client#summary
2022-08-30 13:53:28 +02:00
Gastón Fournier
47532dee7f
chore: upgrade @unleash/express-openapi (#1976) 2022-08-29 12:23:06 +02:00
Fredrik Strand Oseberg
85b45b9965
Feat/unleash flags embedded proxy (#1974)
* feat: use unleash flags for embedded proxy

* feat: add a separate flag for the proxy frontend

* fix: setup unleash in dev

* fix: check flagResolver on each request

* fix: remove unleash client setup

* refactor: update frontend routes snapshot

* refactor: make batchMetrics flag dynamic

* fix: always check dynamic CORS origins config

* fix: make conditionalMiddleware work with the OpenAPI schema generation

Co-authored-by: olav <mail@olav.io>
2022-08-26 15:16:29 +02:00
Fredrik Strand Oseberg
1821bb881a
fix: proxy api check (#1965)
* fix: proxy api check

* fix: add await

* fix: revert async setup for prehook

* fix: stricter endpoint checks
2022-08-26 11:44:12 +02:00
sjaanus
709c142a87 Merge main 2022-08-26 09:09:18 +00:00
sjaanus
a1ce89bedc
Merge frontend with backend (#1962)
* fix: use the frontend dir from the backend

* Build is now working

* Fix workflows

* Fix workflows

* Fix build PRs

* Test coverage workflow

* Test coverage

* Test coverage run

* Fix jest report

* refactor: add missing frontend build

* refactor: ignore frontend dir for coverage

* refactor: run frontend build in PRs

* refactor: run backend tests in PRs

* Revert "refactor: run backend tests in PRs"

This reverts commit 22cabddfd1.

* refactor: remove unused frontend build file

* refactor: test workflows in PR

* refactor: use a prepare script for the frontend

* refactor: simplify yarn build scripts

* refactor: fix check-release script

* Revert "refactor: test workflows in PR"

This reverts commit 496ae19404.

* refactor: remove unused gitignore lines

* refactor: remove renovate config from the frontend repo

* refactor: remove frontend repo license

* refactor: remove frontend repo changelog

* refactor: update frontend repo readme

* refactor: add frontend node_modules to dockerignore

* refactor: update the docker yarn.lock snapshot

Co-authored-by: olav <mail@olav.io>
2022-08-26 07:25:31 +00:00
olav
42d64c8803
feat: add CORS instance settings (#1957)
* feat: add CORS instance settings

* refactor: disallow arbitrary asterisks in CORS origins
2022-08-26 09:09:48 +02:00
Ivar Conradi Østhus
f3e8f723a2
Feat/exp flag loader (#1961)
* fix: remove unused exp flag

* fix: remove unused flag

* fix: add support for external flag resolver

* fix: rename flagsresolver to flagresolver

* fix: disable external flag resolver

* fix: refactor a bit

* fix: stop using unleash in server-dev

* fix: remove userGroups flag

* fix: revert bumping frontend
2022-08-26 08:22:42 +02:00
Christopher Kolstad
72b48bbe81
fix: enforce non-nullability for createdBy/modifiedBy arguments (#1959) 2022-08-25 08:39:28 +02:00
Gastón Fournier
2eff58bd71
docs: add 403 standard error (#1927) 2022-08-23 13:34:16 +02:00
olav
c42bbe4919
refactor: test segments in embedded proxy (#1952) 2022-08-22 16:35:43 +02:00
olav
634e188f73
fix: clean up proxy clients on API key deletion (#1950) 2022-08-22 15:02:39 +02:00
olav
655c0dea2c
fix: resolve correct environment for admin tokens (#1951) 2022-08-22 14:44:38 +02:00
olav
651994a5a0
refactor: fix missing IEventStore event emitter methods (#1948) 2022-08-22 09:18:29 +02:00
olav
f39f3d59ae
fix: use correct project field for proxy features (#1946) 2022-08-19 12:54:40 +02:00
Gastón Fournier
b8b802c8ed
refactor: improve performance of collapseHourlyMetrics (#1945) 2022-08-19 11:45:41 +02:00
Fredrik Strand Oseberg
874d8459ce
Feat/add alias to api tokens (#1931)
* refactor: remove unused API definition routes

* feat: embed proxy endpoints

* feat: check token metadata for alias if none is found

* fix: rename param

* feat: add test for retrieving token by alias

* fix: update schema

* fix: refactor to alias

* fix: refactor to null

* fix: update snapshot

* fix: update openapi snapshot

* fix: add check to getUserForToken

* refactor: add more token alias tests

* refactor: use timingSafeEqual for token comparisons

Co-authored-by: olav <mail@olav.io>
2022-08-19 10:48:33 +02:00
olav
d2999d816d
refactor: batch feature metric inserts (#1928)
* refactor: batch feature metric inserts

* fix: use startOfHour when collapsing metrics

* refactor: avoid extra loop to sum yes/no values

* refactor: add experimental flag for batching metrics
2022-08-19 10:38:26 +02:00
Gastón Fournier
d91b91b56f
chore: type improvements (#1941)
Simplify the type to its minimum so it matches the API spec
2022-08-19 10:28:53 +02:00
olav
0d293929f5
feat: add CORS support to the proxy endpoints (#1936)
* feat: add CORS support to the proxy endpoints

* refactor: remove unused development mode CORS support
2022-08-19 08:09:44 +02:00
olav
831380333e
fix: attempt to unflake the feature e2e tests (#1940) 2022-08-18 12:35:45 +02:00
Tymoteusz Czech
14b1540715
feat: add feature flag for embedded proxy (#1939)
* feat: add feature flag for embedded proxy

* update snapshot for config
2022-08-18 11:26:31 +02:00
Tymoteusz Czech
3266e9c22a
Refactor: rename frontend api key (#1935)
* refactor: rename frontend api key

* fix: api token schema tests
2022-08-18 08:20:51 +00:00
sjaanus
037b8eacd3
Wrong number on the project page regarding members in that project (#1917)
* Fix project member count

* Fix

* Add editors to projects
2022-08-17 09:05:41 +00:00
Tymoteusz Czech
9676165de9
Feat: Create frontend API key (#1932)
* refactor: remove unused API definition routes

* feat: embed proxy endpoints

* feat: add metadata

* feat: update schema

* feat: check token metadata for alias if none is found

* refactor: add api token metadata test coverage

* refactor: proxy key validation and default values

* refactor: update snapshot

Co-authored-by: olav <mail@olav.io>
Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-08-17 10:55:52 +02:00
Tymoteusz Czech
45c6464587
Migration for API key metadata (#1930)
* feat: add metadata to api_keys

* fix: default to empty object for metadata

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2022-08-16 16:38:20 +02:00
olav
e8d542af0f
feat: embed proxy endpoints (#1926)
* refactor: remove unused API definition routes

* feat: add support for proxy keys

* feat: support listening for any event

* feat: embed proxy endpoints

* refactor: add an experimental flag for the embedded proxy
2022-08-16 15:33:33 +02:00
Fredrik Strand Oseberg
c82318d4c5
fix: check variants before mapping (#1922)
* fix: check variants before mapping

* fix: default to empty array
2022-08-16 13:39:20 +02:00
sjaanus
bf11001d1c
Fix Project members SQL query performance issue (#1911)
* Fix sql query

* Update
2022-08-12 13:34:51 +00:00
Thomas Heartman
b04920602b
fix: Add deprecated openapi tags as valid tags for operations (#1916)
## PR text

I realized that the tag changes we introduced in #1907 would be breaking for people who use the unleash-server package and implement their own endpoints on top of it (as we do in unleash-enterprise).

This change makes it possible to still use the old tags. However, these tags are purposefully not added to the root schema or the list of OpenAPI tag types. Any of our endpoints still using them (I think there is one in Unleash enterprise, see ivarconr/unleash-enterprise#109) should switch over when possible.

## Commits

* fix: Add deprecated openapi tags as valid tags for operations

* Docs: add explanatory comment for why the type exists.
2022-08-12 12:06:21 +00:00
Thomas Heartman
9448461aaa
docs: prep to add OpenAPI spec to Unleash docs (#1907)
* Docs: start experimenting with OpenAPI and docusaurus

* Docs: add docusaurus-theme-openapi-docs pkg

* Wip: current status

* Docs: Add 'docusaurus-plugin-api-docs'

* Move openapi into own sidebar; generate from localhost

* Chore: Update docusaurus plugin for OpenAPI

* Add website/yarn.lock to git

* Fix: fix CSS warning by using flex-end instead of end

* docs: make openapi generated code work again

* docs: make tags work properly with openapi sidebar

* Docs/chore: update OpenAPI tag scheme.

Add a whole bunch of new tags to make it easier to understand
available tags in OpenAPI.

* docs: point to new openapi docs from old api docs

* docs: typo

* Docs:  link restructure

* docs: add operation indicators to openapi docs

* docs: change badge color for operations

* docs: update openapi-docs package

It now sorts tags the same as the schema

* docs: pluralize APIs in slug

* docs: update links to generated api docs

* docs: update openapi snapshot tests with new tags

* docs: conditionally load spec from localhost or from file

* docs: Remove changes relating to immediate switchover

* refactor: rename types; extract into separate file

* docs: fix api doc links
2022-08-12 11:37:57 +02:00
Simon Hornby
38e428dacf
Fix/remove group owner concept (#1905)
* fix: remove group user role
2022-08-11 08:23:08 +02:00
sjaanus
59b8a06968
Deleting project does not delete entry group_role table (#1896)
* Add constraint for project

* Add constraint for project

* Add constraint for project

* Add constraint for project

* Add constraint for project

* Revert eslint

* Fix eslint

* Fix tests
2022-08-10 07:45:59 +00:00
sjaanus
84a932043e
Remove joins (#1898) 2022-08-10 06:56:57 +00:00
olav
a34c674971
feat: add event search endpoint (#1893)
* feat: add event search endpoint

* refactor: expand variable names

* refactor: add table type to query builder

* refactor: improve schema limit/offset types

* refactor: describe searchEventsSchema fields
2022-08-09 16:14:50 +02:00
olav
49095025ff
refactor: remove bootstrap endpoint (#1900) 2022-08-09 15:58:27 +02:00
Fredrik Strand Oseberg
47addb31cb
fix: parameter naming (#1899) 2022-08-09 13:13:05 +02:00
olav
f846b8da18
refactor: use the same variant schema for the admin and client APIs (#1882) 2022-08-08 16:21:57 +02:00
olav
df910cc20c
fix: return 400 on invalid JSON instead of 404 (#1897) 2022-08-08 14:44:57 +02:00
Gastón Fournier
d4b9ca443c
feat: change log level for OpenAPI to debug (#1895) 2022-08-08 08:27:53 +00:00
sjaanus
c37cbb1819
Add seen to groups (#1894) 2022-08-08 06:02:40 +00:00
Gastón Fournier
678e3f9c93
feat: add new standard errors (#1890)
* feat: add new standard errors for 404 and 409

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-08-05 12:10:25 +00:00
Thomas Heartman
98a6cd05c6
Feat(#1873): return 'unknown' for application hostname strategies (#1889)
The hostname strategy will not work correctly with the playground because it depends on external state. In its constructor, it tries to query the environment or use the os.hostname function to determine what its current hostname is. This means that no matter what the user does in the playground, they can’t affect the results of this strategy. It’s also unlikely that it will be true. And if it is, it probably won’t be true for their clients.

In theory, we could accept a hostname property on the Unleash context and use the provided hostname in the address. However, I’m afraid that it’ll make users think that they can impact the hostname strategy by setting the property on their context, when that doesn’t do anything outside of the playground. It would also make the playground evaluate things differently from a regular SDK and I’m not sure that that’s something we want.

Instead, this change to the API makes the feature evaluate to 'unknown' or `false` (depending on constraints).
2022-08-05 11:09:55 +02:00