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

3781 Commits

Author SHA1 Message Date
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
renovate[bot]
1278216247
chore(deps): update dependency @types/mime to v3.0.1 (#1891)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-05 01:36:54 +00:00
renovate[bot]
601765ef9d
fix(deps): update dependency unleash-frontend to v4.14.3 (#1888)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-04 17:54:31 +00:00
Thomas Heartman
e55ad1a21e
feat(#1873/playground): Return detailed information on feature toggle evaluation (#1839)
* Feat: return reasons why a feature evaluated to true or false

Note: this is very rough and just straight ripped from the nodejs
client. It will need a lot of work, but is a good place to start

* Feat: add suggested shape for new payload

* Chore: minor cleanup

* Wip: make server compile again

* Remove unused schema ref

* Export new schemas

* Chore: fix some tests to use sub property

* Fix: fix some tests

* Refactor: rename some variables, uncomment some stuff

* Add segments type to bootstrap options

* Add segments capability to offline feature evaluator

* Fix function calls after turning params into an option abject

* Feat: test strategy order, etc

* Feat: add test to check that all strats are returned correctly

* Feat: allow you to include strategy ids in clients

* Wip: hook up segments in the offline client.

Note: compared to regular clients, they still fail

* Feat: add segments validation

* Fix: fix test case invariant.

* Chore: revert to returning only `boolean` from strategies.

This _should_ make it work with custom strategies too 🤞

* Feat: make more properties of the returned feature required

* Wip: add some comments and unfinished tests for edge cases

* Feat: add `isEnabledInCurrentEnvironment` prop

* Feat: consider more strategy failure cases

* Feat: test that isenabledinenvironment matches expectations

* Feat: add unknown strategies

* Fix: fix property access typo

* Feat: add unknown strategy for fallback purposes

* Feat: test edge case: all unknown strategies

* Feat: add custom strategy to arbitrary

* Feat: test that features can be true, even if not enabled in env

* Chore: add some comments

* Wip: fix sdk tests

* Remove comments, improve test logging

* Feat: add descriptions and examples to playground feature schema

* Switch `examples` for `example`

* Update schemas with descriptions and examples

* Fix: update snapshot

* Fix: openapi example

* Fix: merge issues

* Fix: fix issue where feature evaluation state was wrong

* Chore: update openapi spec

* Fix: fix broken offline client tests

* Refactor: move schemas into separate files

* Refactor: remove "reason" for incomplete evaluation.

The only instances where evaluation is incomplete is when we don't
know what the strategy is.

* Refactor: move unleash node client into test and dev dependencies

* Wip: further removal of stuff

* Chore: remove a bunch of code that we don't use

* Chore: remove comment

* Chore: remove unused code

* Fix: fix some prettier errors

* Type parameters in strategies to avoid `any`

* Fix: remove commented out code

* Feat: make `id` required on playground strategies

* Chore: remove redundant type

* Fix: remove redundant if and fix fallback evaluation

* Refactor: reduce nesting and remove duplication

* Fix: remove unused helper function

* Refactor: type `parameters` as `unknown`

* Chore: remove redundant comment

* Refactor: move constraint code into a separate file

* Refactor: rename `unleash` -> `feature-evaluator`

* Rename class `Unleash` -> `FeatureEvaluator`

* Refactor: remove this.ready and sync logic from feature evaluator

* Refactor: remove unused code, rename config type

* Refactor: remove event emission from the Unleash client

* Remove unlistened-for events in feature evaluator

* Refactor: make offline client synchronous; remove code

* Fix: update openapi snapshot after adding required strategy ids

* Feat: change `strategies` format.

This commit changes the format of a playground feature's `strategies`
properties from a list of strategies to an object with properties
`result` and `data`. It looks a bit like this:

```ts
type Strategies = {
  result: boolean | "unknown",
  data: Strategy[]
}
```

The reason is that this allows us to avoid the breaking change that
was previously suggested in the PR:

`feature.isEnabled` used to be a straight boolean. Then, when we found
out we couldn't necessarily evaluate all strategies (custom strats are
hard!) we changed it to `boolean | 'unevaluated'`. However, this is
confusing on a few levels as the playground results are no longer the
same as the SDK would be, nor are they strictly boolean anymore.

This change reverts the `isEnabled` functionality to what it was
before (so it's always a mirror of what the SDK would show).
The equivalent of `feature.isEnabled === 'unevaluated'` now becomes
`feature.isEnabled && strategy.result === 'unknown'`.

* Fix: Fold long string descriptions over multiple lines.

* Fix: update snapshot after adding line breaks to descriptions
2022-08-04 15:41:52 +02:00
Thomas Heartman
b406f67fb7 Docs(fix): fix formatting of docusaurus admonitions
They seem to have been broken by prettier
2022-08-04 11:11:10 +02:00
renovate[bot]
cd5e1a37d5
chore(deps): update storybook monorepo to v6.5.10 (#1885)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-04 04:58:18 +00:00
renovate[bot]
bc08eec633
chore(deps): update dependency es5-ext to v0.10.62 (#1881)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-03 01:33:59 +00:00
olav
666ca1935c
fix: add missing client variant schema fields (#1880)
* refactor: format file

* fix: use correct variants schema reference

* fix: add missing client variant schema fields
2022-08-02 13:06:10 +02:00
renovate[bot]
d922ea1225
chore(deps): update dependency @babel/core to v7.18.10 (#1872)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-02 00:25:58 +00:00
renovate[bot]
e43be56f13
fix(deps): update docusaurus monorepo to v2.0.1 (#1871)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-01 19:41:04 +00:00
renovate[bot]
595fd52d44
chore(deps): pin dependency @apidevtools/swagger-parser to 10.1.0 (#1864)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-01 12:42:02 +02:00
renovate[bot]
01df475809
chore(deps): update dependency @types/mime to v3 (#1869)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-01 11:41:49 +02:00
renovate[bot]
b818968357
chore(deps): update dependency eslint to v8.21.0 (#1870)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-01 08:50:40 +02:00
Christopher Kolstad
2d22a4d471
4.14.0 2022-07-28 17:42:14 +02:00
Christopher Kolstad
05efe1414e
fix: sortOrder updates needs to be async
Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
2022-07-28 17:31:46 +02:00
Christopher Kolstad
2bdc1031d6
task: bump unleash-frontend to 4.14.1 2022-07-28 15:39:57 +02:00
renovate[bot]
ab2b2b147d
fix(deps): update dependency json-schema-to-ts to v2.5.5 (#1865)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-28 12:33:00 +00:00
renovate[bot]
fb2c95f4cc
chore(deps): update dependency del-cli to v5 (#1838)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-28 08:46:13 +00:00
renovate[bot]
d7991cf119
chore(deps): update dependency dpage/pgadmin4 to v6.12 (#1867)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-28 10:34:53 +02:00
Christopher Kolstad
482754e9f5
fix: Remove unneeded ts-expect-error now that types in knex are in sync (#1866)
* fix: Remove unneeded ts-expect-error now that types in knex are in sync
2022-07-28 10:34:19 +02:00
renovate[bot]
0a93056923
chore(deps): update dependency supertest to v6.2.4 (#1787)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-28 10:05:34 +02:00
renovate[bot]
9d0b0bddaf
chore(deps): update dependency @types/make-fetch-happen to v10 (#1823)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-28 09:20:51 +02:00
Thomas Heartman
6afc0a6954
fix: fix broken OpenAPI spec (#1846)
* Wip: fix openapi spec

* Feat: add openapi enforcer for enforcing the generated schema

* Chore: Allow the example keyword in params

* Feat: add validator tests and fix some errors

* Use @apidevtools/swagger-parser for schema validation

* Wip: refactor tests for updated schema name

* Feat: update request params creation method

* Feat: add query params to state

* Refactor: move mapping test into separate function

* Refactor: rename request-parameters -> query-parameters

* Refactor: expose only finished query parameters

* Wip: fixup param types

* Refactor: remove unused types

* Chore: rename and cleanup

* Chore: cleanup

* Fix: Update snapshot

* Fix: use ?? Instead of paramToBool to get defaults

* Wip: generate query param object type from openapi params list

* Wip: use generated types for export query params

* Revert "Fix: use ?? Instead of paramToBool to get defaults"

This reverts commit 842567500b.

Because we accept bools, strings, and numbers, this is the only way to
do it.

* Chore: update and pin json-schema-to-ts

* Fix: use `&` to merge types

* Update snapshot

* Chore: rename export-parameters-schema -> export-query-parameters

When it ends in `schema`, the tests expect it to be included in the
openapi index file.
2022-07-28 09:19:58 +02:00
renovate[bot]
f6192b50b0
fix(deps): update dependency unleash-proxy-client to v2.0.3 (#1841)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-27 13:44:00 +00:00
Christopher Kolstad
ee295ee765
fix: Make additionalProperties true (#1861)
* fix: Make additionalProperties true
2022-07-27 09:02:02 +02:00
renovate[bot]
c3a84f37f8
chore(deps): update dependency es5-ext to v0.10.61 (#1862)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-26 16:45:45 +00:00
renovate[bot]
66a478374d
chore(deps): update dependency fast-check to v3.1.1 (#1859)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-26 15:04:22 +00:00
sjaanus
4f4b6c535b
Release (#1860) 2022-07-26 13:06:11 +00:00
Tymoteusz Czech
cc3636c59e
fix: force resolution of es5-ext (#1853) 2022-07-26 14:25:19 +02:00
Tymoteusz Czech
25fdefc4d1
Strategy sort order endpoint (#1855)
* strategy sort order endpoint

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

* feat: add e2e test for happy path

* add tests to features strategies order

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

* feat: add tests for sort-order

* fix: update snapshot

* fix: lint

Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com>
2022-07-26 14:16:30 +02:00
sjaanus
5f8b88aa0b
Grouping access endpoing (#1858)
* Grouping access endpoing

* Add username
2022-07-26 11:39:55 +00:00
sjaanus
b9c95c5272
Fix full outer joins to left joins (#1856) 2022-07-26 08:02:28 +00:00
sighphyre
cd83ba3184
Release/4.14.0 beta.3 (#1857)
* chore: bump unleash-front end version to 4.14.0-beta.5
2022-07-25 14:16:27 +02:00
sjaanus
33ed72716f
Implement group access edit for project (#1854) 2022-07-25 10:11:16 +00:00
renovate[bot]
cc341e7913
fix(deps): update dependency @svgr/webpack to v6.3.1 (#1851)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-22 17:50:19 +00:00
renovate[bot]
a6ecaec48f
chore(deps): update dependency fast-check to v3.1.0 (#1849)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-22 13:30:24 +00:00
Christopher Kolstad
897e08814d
4.14.0-beta.2 2022-07-22 12:14:03 +02:00
sighphyre
30bf81158d
chore: update frontend dependency to 4.14.0-beta.4 (#1848) 2022-07-22 10:10:00 +00:00
Christopher Kolstad
2c9f4408bc
task: update health endpoint to only say if express is ready (#1847) 2022-07-22 11:47:58 +02:00
Christopher Kolstad
5bacc7ba36
task: add sdk version metric (#1828)
* task: add sdk version metric
2022-07-22 09:00:22 +00:00
Thomas Heartman
22014f3c62
docs: add how-to guide for enabling OpenAPI (#1836)
* Docs: add how-to enable the openapi spec

* Docs: fix and format how to run unleash proxy

* Fix: add backticks instead of single quotes

* Docs: remove unnecessary imports, format

* Docs: fix minor errors and update location section
2022-07-22 09:02:01 +02:00
renovate[bot]
f88fe3b80b
fix(deps): update dependency unleash-frontend to v4.14.0-beta.3 (#1844)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-21 19:04:32 +00:00
sighphyre
5806b6748f
Feat/grouping (#1845)
* Implement user grouping feature for permissions

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
Co-authored-by: Jaanus Sellin <sellinjaanus@gmail.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2022-07-21 16:23:56 +02:00
Christopher Kolstad
09fa031e0f
task: Add events for setting-service (#1814)
* task: Add events for setting-service
2022-07-21 15:40:31 +02:00
Thomas Heartman
012da8469f
feat: add all feature variants to the playground payload (#1835)
* Chore: extract variant creation arbitrary.

* Feat: add "variants" as a required property on playground response

* Wip: fix up some schema generation

* Fix remaining openapi schemas

* Fix: add missing variants property

* Feat: test for variants

* Feat: add `variants` property to playground response

* Chore: update openapi snapshot
2022-07-20 08:54:34 +02:00
renovate[bot]
7a7b86d440
chore(deps): update dependency nock to v13.2.9 (#1837)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-19 21:32:00 +00:00
Thomas Heartman
4332072db4
docs: Update docusaurus to 2.0.0-rc.1 (#1831)
* Chore: update docusaurus packages

* Docs: add algolia doc search app id

* Chore: update/specify node engine version: 16.14
2022-07-19 07:57:03 +02:00
renovate[bot]
29b8223718
fix(deps): update dependency @svgr/webpack to v6.3.0 (#1833)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-19 01:09:47 +00:00
renovate[bot]
572f1cb7b6
chore(deps): pin dependency fast-check to 3.0.1 (#1809)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-18 12:16:58 +00:00
renovate[bot]
87cf6e58a2
chore(deps): update dependency @babel/core to v7.18.9 (#1830)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-18 12:11:16 +00:00