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

184 Commits

Author SHA1 Message Date
Christopher Kolstad
2c9f4408bc
task: update health endpoint to only say if express is ready (#1847) 2022-07-22 11:47:58 +02:00
Thomas Heartman
847119f964
feat: add playground API post endpoint (#1791)
* Chore: add unleash-client dependency

* Feat: add openapi specs for basic sdk contexts and playground reqs

* Feat: add openapi spec for response

* Feat: add openAPI entry for playground endpoint

* Fix: remove required 'projects' property that doesn't exist

* Refactor: add test placeholders for playground api

* Chore: improve openAPI description for playground request

* Refactor: align example project names

* Fix: update openapi snapshot

* Fix: summary -> description; example -> examples

* Feat: add fast-check and stub out one test.

The test doesn't work yet.

* Feat: add test and generator for sdk context schema

* Feat: add generators and tests for all new schemas

* Feat: test that the same input is returned exactly

* Feat: add more tests and more schemas

* Refactor: clean up tests some

* Refactor: simplify url friendliness check

* Refactor: fix types for playground request schema generator

* Feat: add bad request test

* Fix: make parameters the correct shape in generator

* Feat: scaffold out tests for service and endpoint

Liberal use of @ts-expect-error

* Fix: update snapshot with new model

* Add missing appName

* wip: stub out some extra tests

* Feat: model strategies for testing

* Feat: model variant payloads better

* Refactor: input params for function

* Refactor: use email address for user id generation

* Chore: update comment

* Wip: start stubbing out e2e tests

* Refactor: move tests requiring db to e2e file

* Fix: make e2e tests run as expected

* Fix: make toggle generator test work as expected

* Fix: increase timeout for long-running e2e test

* Wip: map toggles test

* Wip: test movement and cleanup

* Refactor: remove `AllowedStrings` in favor of typeof X[number]

* Wip: add e2e tests for the service

* Wip: tests in progress

* Feat: return fuller variant value

* Wip: delete redundant test.

Both those tests were testing versions of the same thing, so let's
delete one of them

* Feat: update openAPI snapshot

* Feat: hook up the playground service

* Feat: fix test cases for e2e api

* Refactor: get rid of _one_ 'as unknown as x' cast

* Fix: wait for the client to be ready before we pass it back

* Fix: weights go to 1000!

* Fix: fix some test assertions, add one more test to be sure

* Wip: add some test parameters to hopefully avoid timeouts

* Fix: don't init the client if there are no toggles

If you don't provide it with any toggles to bootstrap, then the client
will never be ready. This avoids that.

This adds two ways around it because we'll probably get away with a
bit less computation if we don't even try to initialize it. However,
we also don't want anyone else to make this mistake.

* Chore: modify test params

* Feat: use the type system to avoid empty lists for initialization

* Refactor: make tests simpler

* Feat: test basic context values

* Feat: test dynamic context values

* Fix: make custom context field test more reliable

* Feat: use unique arrays for toggles

* Feat: make `appName` required in context

* Fix: sdk context schema arbitrary: make appName at least 1 char long

* Fix: add a minimum length on appName in the context schema

* Fix: fix tests that fail due to new requirements

* Fix: update a test: remove variant mapping testing

* Fix: fix remaining tests

* Feat: rename response.toggles -> response.features

* Refactor: avoid single-letter predicate variables

* Refactor: extract offlineclient into its own file

* Refactor: move arbitraries into separate file

* Refactor: move playground requests into util function

* Fix: remove duplicate declaration of urlFriendlyString

* Chore: update comment

* Refactor: align on arbitrary generator naming

* Feat: Export single strategy arbitrary
2022-07-12 13:01:10 +02:00
Thomas Heartman
1a5749ca08
Refactor: move openapi utils into /util directory (#1777)
* Refactor: move openapi utils into /util directory

* Refactor: move utils test into `util` directory

* Refactor: don't expose standard responses tied to status codes

* Feat: update empty response description + make it const

* Chore: update snapshot with new response descriptions
2022-07-01 08:06:33 +02:00
olav
98c7b915c9
refactor: fix empty response usage (#1783)
* refactor: fix empty response usage

* refactor: move emptyResponse into standard-responses.ts
2022-06-30 14:48:39 +02:00
Tymoteusz Czech
2729999bed
Feat: OpenAPI controller - Bootstrap UI (#1773)
* rename bootstrap ui controller

* sort openapi schema imports

* add bootstrap ui json schema

* test bootstrap ui schema

* openapi bootstrap ui route

* fix: bootstrap ui schema type

* bootstrap ui e2e test

* simplify bootstrap-ui testing mock

* fix: update after review
2022-06-30 12:21:40 +00:00
andreas-unleash
a607dea284
OAS for client-api metrics.ts (#1753)
* OAS for client-api metrics.ts

* Fix PR comments

* Fix PR comments

* Fix test

* Renamed and synced with proxy

* Renamed and synced with proxy

* Renamed and synced with proxy

* add tests

* Update python.md

Revert doc

* added 400 response, more tests

* PR comment

* PR comment
2022-06-30 13:27:12 +03:00
andreas-unleash
e875e67d24
open api implementation - client features controller (#1745)
* open api implementation - client features controller

* open api implementation - client features controller

* bug fix

* test fix

* PR comments

* OAS for client-api metrics.ts

* Refactoring

* Refactoring

* bug fix

* fix PR comments

* PR comment

* PR comment
2022-06-30 12:54:14 +03:00
olav
b67aca8fbf
fix: rename duplicate operation IDs (#1778) 2022-06-30 10:51:26 +02:00
Thomas Heartman
4dec126199
feat: add OpenAPI spec to events controller. (#1754)
* Feat: add initial event schema

* Feat: add events-schema plus tests

* Feat(broken): add openapi validation to getEvents endpoint

* Add schema to basic events endpoint

* Feat: Add openapi for feature events

* Fix: fix recursive schema inclusion

* Feat: add test for recursive function

* Fix: make nullable fields nullable

* Fix: remove `ADMIN` permission for toggle events.

* fix: add new schemas to the snapshot

* Fix: remove recursive schema inclusion

* Feat: test feature events schema

* Fix: add correct permissions for feature events endpoint.

* Refactor: rename "name" to "featureName" for clearer docs

* Fix: Add missing "version" field to feature events

* Feat: add descriptions and extra responses to events endpoints.

* Fix: update openapi snapshot

* Simplify standard responses function

* Refactor: move endpoint descriptions into own file.

* Refactor: simplify type signature.

* Feat: specify type of data and preData properties to object

* Fix: update snapshot

* Refactor: move standard-responses into /util/ directory.
2022-06-30 08:12:34 +00:00
andreas-unleash
64082440d4
OAS for client-metrics controller (#1739)
* OAS for client-metrics controller

* bug and tests

* update snapshot

* update snapshot

* update snapshot

* bug fix

* fix PR comments

* refactoring re PR comments

* re order routes

* remove grouped-client-metrics-schema.ts

* remove grouped-client-metrics-schema.ts

* updated response

* updated snapshot

* PR comments

* PR comments

* Added tests

* Added tests

* fix

* fix

* fix
2022-06-27 11:17:44 +03:00
olav
5fff523670
refactor: add schemas to client application registration (#1746) 2022-06-24 15:29:27 +02:00
Nuno Góis
a792594e98
refactor: add OpenAPI schema to simple-password-provider controller (#1734)
* refactor: add OpenAPI schema to simple-password-provider controller

* finish implementation after merge

* refactor: address PR comments
2022-06-23 08:40:25 +01:00
olav
ac3f076a31
refactor: add schemas to strategy controller (#1744)
* refactor: avoid duplicate feature strategy operationIds

* refactor: fix flaky feature tests

* refactor: remove duplicate controller error handling

* refactor: unify feature strategy schemas

* refactor: add schemas to strategy controller
2022-06-23 08:10:20 +02:00
olav
ab75d4085e
refactor: add schemas to user admin controller (#1692)
* refactor: add schemas to user admin controller

* refactor: remove unused SessionService

* refactor: fix search query type confusion

* refactor: add schemas to user controller (#1693)

* refactor: add schemas to user controller

* refactor: fix getAllUserSplashes method name

* refactor: name and email should not be required on create

* refactor: only some user fields may be updated

* refactor: should not require any fields on user update  (#1730)

* refactor: send 400 instead of 500 on missing username and email

* refactor: should not require any fields for user update

* refactor: note that earlier versions required name or email

* refactor: merge roleDescriptionSchema and roleSchema
2022-06-22 14:55:43 +02:00
sellinjaanus
cecca59f65
Task/open api reset password (#1740)
* task: add openapi for reset password

* fix: add respondWithValidation and remove email from tests

* fix: change tags to other
2022-06-22 14:31:41 +03:00
andreas-unleash
66452e2860
open-api addon controller (#1721)
* open-api addon controller

* bug fixes

* bug fixes

* resolve merge conflict

* bug fix

* bug fix

* bug fix

* PR comments

* PR comments

* Resolve merge conflics

* Resolve merge conflics

* bug and tests
2022-06-22 13:49:18 +03:00
Christopher Kolstad
18c720f4e9
Task/open api state (#1738)
* task: add open api to import/export
2022-06-22 09:09:49 +02:00
Christopher Kolstad
32399291e0
task: add OpenApi spec to metrics route (#1725)
* task: add OpenApi spec to metrics route
2022-06-21 09:12:40 +02:00
Christopher Kolstad
1821af8fe7
task: add openapi for tags (#1724)
* task: add openapi for tags
2022-06-21 08:23:30 +02:00
Nuno Góis
123991d28f
refactor: add OpenAPI schema to health-check controller (#1732)
* refactor: add OpenAPI schema to health-check controller

* refactor: address PR comments

* add type to health-check-schema

* fix: update snap
2022-06-20 11:22:41 +01:00
Nuno Góis
2354656632
refactor: add OpenAPI schema to api-token controller (#1716)
* refactor: add OpenAPI schema to api-token controller

* refactor: address PR comments

* fix: status codes on environment toggling

* fix tests

* refactor: address PR comments

* refactor: expiresAtSchema -> update-api-token-schema
2022-06-17 20:35:26 +01:00
Nuno Góis
525fce3e86
refactor: add OpenAPI schema to context controller (#1711)
* refactor: add OpenAPI schema to context controller

* Update src/lib/routes/admin-api/context.ts

Co-authored-by: olav <mail@olav.io>

* address PR comments, misc fixes and improvements

* refactor: address PR comments

* add createdAt to test

* fix: reverted upsert schema after discussion

Co-authored-by: olav <mail@olav.io>
2022-06-17 10:11:55 +01:00
olav
28ecb158a9
refactor: add schemas to feedback controller (#1698)
* refactor: remove previous getProjects route

* refactor: add schemas to feedback controller
2022-06-17 08:15:56 +02:00
Christopher Kolstad
780bb06dba
task: add open-api for tag-types (#1700)
* task: add open-api for tag-types
2022-06-14 09:06:41 +02:00
olav
7ba8cd05eb
fix: do not require Content-Type for requests without body (#1707)
* fix: do not require Content-Type for requests without body

* fix: require Content-Type for feature update requests
2022-06-14 08:16:08 +02:00
olav
47a719238d
refactor: fix duplicate operationIds (#1701) 2022-06-10 15:11:41 +02:00
olav
1264f8cb13
refactor: add schemas to splash controller (#1697) 2022-06-10 15:11:07 +02:00
olav
adface17c7
refactor: add OpenAPI schema to environments controller (#1682)
* refactor: normalize controller file names

* refactor: throw invalid responses in dev mode

* refactor: add OpenAPI schema to environments controller

* refactor: improve JSON schema prop removal code

* refactor: fix empty response specs
2022-06-10 10:04:56 +02:00
olav
d7c450abf8
refactor: remove unused my-sessions endpoint (#1691) 2022-06-09 14:48:03 +02:00
olav
0f11a33e3a
refactor: remove active-sessions endpoint (#1690) 2022-06-09 13:19:20 +02:00
olav
138300ab22
refactor: add OpenAPI schema to feature types controller (#1684)
* refactor: fix feature types id type

* refactor: fix error-hiding Controller imports

* refactor: add OpenAPI schema to feature types controller
2022-06-09 13:17:13 +02:00
olav
1ed8dd0f0d
refactor: add OpenAPI schema to constraints controller (#1683)
* refactor: add OpenAPI schema to constraints controller

* refactor: add more schema tests
2022-06-09 10:35:39 +02:00
olav
04c107a26e
refactor: add OpenAPI schemas to more controllers (#1680) 2022-06-08 15:31:34 +02:00
olav
09a6b578bf
refactor: add OpenAPI schema to UI config controller (#1681) 2022-06-08 14:57:39 +02:00
Christopher Kolstad
37211491e7
feat: default to memoizing client features (#1674) 2022-06-08 09:43:37 +02:00
olav
13ef025fab
refactor: add soft response schema validation (#1657)
* refactor: remove most schema refs

* refactor: generalize request/response schemas

* refactor: simplify schema date formats

* refactor: add soft response schema validation

* refactor: fix emptySchema definition

* refactor: update json-schema-to-ts and use refs
2022-06-08 08:01:14 +02:00
olav
ee35c7ad74
refactor: replace ts-ignore with ts-expect-error (#1675)
* refactor: replace ts-ignore with ts-expect-error

* refactor: remove unused ts-expect-errors
2022-06-07 11:49:17 +02:00
olav
9aa1f39add
refactor: always accept any content type for GET reqs (#1672) 2022-06-07 09:32:18 +02:00
Christopher Kolstad
7895002602
feat: add OpenApi spec to feature variants (#1659)
* feat: add OpenApi spec to feature variants
2022-06-03 13:16:59 +02:00
Ivar Conradi Østhus
3359dd204d
feat: add option to disable 'Clear-Site-Data' header on logout (#1645) 2022-06-03 11:50:58 +02:00
olav
7e3f0329ab
refactor: avoid inlining segments for supported clients (#1640)
* refactor: add semver lib types

* refactor: avoid inlining segments for supported clients

* refactor: fix FeatureController tests

* refactor: use spec version instead of client version

* refactor: improve header validation errors
2022-06-02 14:07:46 +02:00
olav
224b9cb229
refactor: move segment limits to env vars (#1642)
* refactor: improve env var helpers

* refactor: remove unused segments client API

* refactor: remove experimental segment flags

* refactor: move segment limits to env vars

* refactor: add segment limits to UIConfig response

* refactor: fix type name casing
2022-06-02 10:44:45 +02:00
Ivar Conradi Østhus
ddb7b075a8
fix: flag for anonymising user search 2022-05-31 21:51:49 +02:00
Ivar Conradi Østhus
34b2058faa
fix: add flag to annomise event log 2022-05-30 21:01:46 +02:00
sighphyre
0c1213ff81
feat: Add support for global segments (#1577)
feat: Add support for global segments
2022-05-30 09:10:20 +02:00
olav
59060ed3ea
refactor: improve OpenAPI refs (#1620)
* refactor: simplify FeatureEnvironmentSchema name

* refactor: format schema files

* fix: pass nested schemas to FromSchema

* refactor: remove ref order note

* refactor: fix overly strict required fields

* refactor: clean up mapper names and paths

* refactor: replace mappers with optional fields
2022-05-24 08:37:35 +02:00
olav
a8d34d6268
fix: the replaceGroupId field should be optional (#1608) 2022-05-20 11:07:30 +02:00
andreas-unleash
1a27bffe4d
Complete open api schemas for project features controller (#1563)
* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* bug fix

* bug fix

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* added emptyResponse, patch feature operation schemas and request

* added emptyResponse, patch feature operation schemas and request

* patch strategy

* patch strategy

* update strategy

* update strategy

* fix pr comment

* fix pr comments

* improvements

* added operationId to schema for better generation

* fix pr comment

* fix pr comment

* fix pr comment

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* Update response types to use inferred types

* Update addTag response status to 201

* refactor: move schema ref destructuring into createSchemaObject

* made serialize date handle deep objects

* made serialize date handle deep objects

* add `name` to IFeatureStrategy nad fix tests

* fix pr comments

* fix pr comments

* Add types to IAuthRequest

* Sync StrategySchema for FE and BE - into the rabbit hole

* Sync model with OAS spec

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* bug fix

* bug fix

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* added emptyResponse, patch feature operation schemas and request

* added emptyResponse, patch feature operation schemas and request

* patch strategy

* patch strategy

* update strategy

* update strategy

* fix pr comment

* fix pr comments

* improvements

* added operationId to schema for better generation

* fix pr comment

* fix pr comment

* fix pr comment

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* Update response types to use inferred types

* Update addTag response status to 201

* refactor: move schema ref destructuring into createSchemaObject

* made serialize date handle deep objects

* made serialize date handle deep objects

* add `name` to IFeatureStrategy nad fix tests

* fix pr comments

* fix pr comments

* Add types to IAuthRequest

* Sync StrategySchema for FE and BE - into the rabbit hole

* Sync model with OAS spec

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* bug fix

* bug fix

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* added emptyResponse, patch feature operation schemas and request

* added emptyResponse, patch feature operation schemas and request

* patch strategy

* patch strategy

* update strategy

* update strategy

* fix pr comment

* fix pr comments

* improvements

* added operationId to schema for better generation

* fix pr comment

* fix pr comment

* fix pr comment

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* Update response types to use inferred types

* Update addTag response status to 201

* refactor: move schema ref destructuring into createSchemaObject

* made serialize date handle deep objects

* made serialize date handle deep objects

* add `name` to IFeatureStrategy nad fix tests

* fix pr comments

* fix pr comments

* Add types to IAuthRequest

* Sync StrategySchema for FE and BE - into the rabbit hole

* Sync model with OAS spec

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* Completed OpenAPI Schemas for ProjectFeatures Controller
Completed OpenAPI Schemas for Feature Controller (tags)

* bug fix

* bug fix

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* fix merge conflicts, some refactoring

* added emptyResponse, patch feature operation schemas and request

* added emptyResponse, patch feature operation schemas and request

* patch strategy

* patch strategy

* update strategy

* update strategy

* fix pr comment

* fix pr comments

* improvements

* added operationId to schema for better generation

* fix pr comment

* fix pr comment

* fix pr comment

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* improvements to generated and dynamic types

* Update response types to use inferred types

* Update addTag response status to 201

* refactor: move schema ref destructuring into createSchemaObject

* made serialize date handle deep objects

* made serialize date handle deep objects

* add `name` to IFeatureStrategy nad fix tests

* fix pr comments

* fix pr comments

* Add types to IAuthRequest

* Sync StrategySchema for FE and BE - into the rabbit hole

* Sync model with OAS spec

* revert

* revert

* revert

* revert

* revert

* mapper

* revert

* revert

* revert

* remove serialize-dates.ts

* remove serialize-dates.ts

* remove serialize-dates.ts

* remove serialize-dates.ts

* remove serialize-dates.ts

* revert

* revert

* add mappers

* add mappers

* fix pr comments

* ignore report.json

* ignore report.json

* Route permission required

Co-authored-by: olav <mail@olav.io>
2022-05-18 16:17:09 +03:00
olav
ac90a3b1c7
fix: remove trailing slash from OpenAPI route (#1564) 2022-05-05 11:45:23 +02:00
olav
56615e91f0
fix: validate the type and length of parameter values (#1559)
* refactor: coerce primitive types in OpenAPI requests

* refactor: avoid broken array args to serializeDates

* refactor: avoid some spec refs to improve generated types

* refactor: remove debug logging

* refactor: fix IExpressOpenApi interface name prefix

* refactor: ensure that parameter values are strings

* refactor: test that parameter values are coerced to strings
2022-05-04 15:16:18 +02:00