unleash-server 4.10.0-beta.3 → 4.10.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -133
- package/dist/lib/addons/addon.d.ts +1 -1
- package/dist/lib/addons/addon.js +10 -11
- package/dist/lib/addons/addon.js.map +1 -1
- package/dist/lib/addons/addon.test.js +41 -18
- package/dist/lib/addons/addon.test.js.map +1 -1
- package/dist/lib/app.js +6 -0
- package/dist/lib/app.js.map +1 -1
- package/dist/lib/create-config.js +1 -1
- package/dist/lib/create-config.js.map +1 -1
- package/dist/lib/db/api-token-store.d.ts +1 -0
- package/dist/lib/db/api-token-store.js +61 -20
- package/dist/lib/db/api-token-store.js.map +1 -1
- package/dist/lib/db/context-field-store.js +2 -2
- package/dist/lib/db/context-field-store.js.map +1 -1
- package/dist/lib/middleware/demo-authentication.d.ts +2 -1
- package/dist/lib/middleware/demo-authentication.js +2 -1
- package/dist/lib/middleware/demo-authentication.js.map +1 -1
- package/dist/lib/middleware/no-authentication.js +1 -0
- package/dist/lib/middleware/no-authentication.js.map +1 -1
- package/dist/lib/openapi/index.d.ts +2 -0
- package/dist/lib/openapi/index.js +46 -0
- package/dist/lib/openapi/index.js.map +1 -0
- package/dist/lib/openapi/spec/constraint-schema.d.ts +38 -0
- package/dist/lib/openapi/spec/constraint-schema.js +24 -0
- package/dist/lib/openapi/spec/constraint-schema.js.map +1 -0
- package/dist/lib/openapi/spec/create-feature-request.d.ts +2 -0
- package/dist/lib/openapi/spec/create-feature-request.js +14 -0
- package/dist/lib/openapi/spec/create-feature-request.js.map +1 -0
- package/dist/lib/openapi/spec/create-feature-schema.d.ts +39 -0
- package/dist/lib/openapi/spec/create-feature-schema.js +24 -0
- package/dist/lib/openapi/spec/create-feature-schema.js.map +1 -0
- package/dist/lib/openapi/spec/feature-response.d.ts +2 -0
- package/dist/lib/openapi/spec/feature-response.js +14 -0
- package/dist/lib/openapi/spec/feature-response.js.map +1 -0
- package/dist/lib/openapi/spec/feature-schema.d.ts +101 -0
- package/dist/lib/openapi/spec/feature-schema.js +55 -0
- package/dist/lib/openapi/spec/feature-schema.js.map +1 -0
- package/dist/lib/openapi/spec/features-response.d.ts +2 -0
- package/dist/lib/openapi/spec/features-response.js +14 -0
- package/dist/lib/openapi/spec/features-response.js.map +1 -0
- package/dist/lib/openapi/spec/features-schema.d.ts +32 -0
- package/dist/lib/openapi/spec/features-schema.js +21 -0
- package/dist/lib/openapi/spec/features-schema.js.map +1 -0
- package/dist/lib/openapi/spec/override-schema.d.ts +32 -0
- package/dist/lib/openapi/spec/override-schema.js +21 -0
- package/dist/lib/openapi/spec/override-schema.js.map +1 -0
- package/dist/lib/openapi/spec/strategy-schema.d.ts +44 -0
- package/dist/lib/openapi/spec/strategy-schema.js +27 -0
- package/dist/lib/openapi/spec/strategy-schema.js.map +1 -0
- package/dist/lib/openapi/spec/variant-schema.d.ts +56 -0
- package/dist/lib/openapi/spec/variant-schema.js +33 -0
- package/dist/lib/openapi/spec/variant-schema.js.map +1 -0
- package/dist/lib/openapi/types.d.ts +11 -0
- package/dist/lib/openapi/types.js +7 -0
- package/dist/lib/openapi/types.js.map +1 -0
- package/dist/lib/routes/admin-api/api-token-controller.d.ts +1 -1
- package/dist/lib/routes/admin-api/api-token-controller.js +13 -16
- package/dist/lib/routes/admin-api/api-token-controller.js.map +1 -1
- package/dist/lib/routes/admin-api/archive.d.ts +4 -3
- package/dist/lib/routes/admin-api/archive.js +15 -4
- package/dist/lib/routes/admin-api/archive.js.map +1 -1
- package/dist/lib/routes/admin-api/context.test.js +7 -3
- package/dist/lib/routes/admin-api/context.test.js.map +1 -1
- package/dist/lib/routes/admin-api/email.d.ts +3 -2
- package/dist/lib/routes/admin-api/email.js +0 -2
- package/dist/lib/routes/admin-api/email.js.map +1 -1
- package/dist/lib/routes/admin-api/feature.d.ts +3 -2
- package/dist/lib/routes/admin-api/feature.js +15 -2
- package/dist/lib/routes/admin-api/feature.js.map +1 -1
- package/dist/lib/routes/admin-api/project/features.d.ts +5 -3
- package/dist/lib/routes/admin-api/project/features.js +43 -5
- package/dist/lib/routes/admin-api/project/features.js.map +1 -1
- package/dist/lib/routes/admin-api/strategy.d.ts +9 -7
- package/dist/lib/routes/admin-api/strategy.js +0 -7
- package/dist/lib/routes/admin-api/strategy.js.map +1 -1
- package/dist/lib/routes/client-api/feature.js +2 -2
- package/dist/lib/routes/client-api/feature.js.map +1 -1
- package/dist/lib/routes/client-api/register.test.js +13 -0
- package/dist/lib/routes/client-api/register.test.js.map +1 -1
- package/dist/lib/routes/controller.d.ts +13 -2
- package/dist/lib/routes/controller.js +46 -7
- package/dist/lib/routes/controller.js.map +1 -1
- package/dist/lib/schema/api-token-schema.js +6 -1
- package/dist/lib/schema/api-token-schema.js.map +1 -1
- package/dist/lib/schema/api-token-schema.test.d.ts +1 -0
- package/dist/lib/schema/api-token-schema.test.js +42 -0
- package/dist/lib/schema/api-token-schema.test.js.map +1 -0
- package/dist/lib/server-impl.js +0 -2
- package/dist/lib/server-impl.js.map +1 -1
- package/dist/lib/services/addon-service-test-simple-addon.js +1 -1
- package/dist/lib/services/addon-service-test-simple-addon.js.map +1 -1
- package/dist/lib/services/api-token-service.d.ts +7 -2
- package/dist/lib/services/api-token-service.js +29 -6
- package/dist/lib/services/api-token-service.js.map +1 -1
- package/dist/lib/services/client-metrics/schema.js +2 -2
- package/dist/lib/services/client-metrics/schema.js.map +1 -1
- package/dist/lib/services/client-metrics/schema.test.d.ts +1 -0
- package/dist/lib/services/client-metrics/schema.test.js +87 -0
- package/dist/lib/services/client-metrics/schema.test.js.map +1 -0
- package/dist/lib/services/context-schema.js +6 -2
- package/dist/lib/services/context-schema.js.map +1 -1
- package/dist/lib/services/feature-toggle-service.d.ts +2 -1
- package/dist/lib/services/feature-toggle-service.js +2 -1
- package/dist/lib/services/feature-toggle-service.js.map +1 -1
- package/dist/lib/services/index.js +3 -0
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/openapi-service.d.ts +16 -0
- package/dist/lib/services/openapi-service.js +52 -0
- package/dist/lib/services/openapi-service.js.map +1 -0
- package/dist/lib/services/state-service.d.ts +2 -1
- package/dist/lib/services/state-service.js +2 -2
- package/dist/lib/services/state-service.js.map +1 -1
- package/dist/lib/services/version-service.js +2 -2
- package/dist/lib/services/version-service.js.map +1 -1
- package/dist/lib/services/version-service.test.js +34 -15
- package/dist/lib/services/version-service.test.js.map +1 -1
- package/dist/lib/types/api-user.d.ts +4 -3
- package/dist/lib/types/api-user.js +7 -2
- package/dist/lib/types/api-user.js.map +1 -1
- package/dist/lib/types/models/api-token.d.ts +15 -2
- package/dist/lib/types/models/api-token.js +42 -3
- package/dist/lib/types/models/api-token.js.map +1 -1
- package/dist/lib/types/mutable.d.ts +6 -0
- package/dist/lib/types/mutable.js +3 -0
- package/dist/lib/types/mutable.js.map +1 -0
- package/dist/lib/types/option.d.ts +2 -2
- package/dist/lib/types/permissions.d.ts +1 -0
- package/dist/lib/types/permissions.js +2 -1
- package/dist/lib/types/permissions.js.map +1 -1
- package/dist/lib/types/services.d.ts +2 -0
- package/dist/lib/types/stores/context-field-store.d.ts +5 -1
- package/dist/lib/util/load-index-html.js +2 -2
- package/dist/lib/util/load-index-html.js.map +1 -1
- package/dist/lib/util/serialize-dates.d.ts +5 -0
- package/dist/lib/util/serialize-dates.js +17 -0
- package/dist/lib/util/serialize-dates.js.map +1 -0
- package/dist/lib/util/serialize-dates.test.d.ts +1 -0
- package/dist/lib/util/serialize-dates.test.js +17 -0
- package/dist/lib/util/serialize-dates.test.js.map +1 -0
- package/dist/lib/util/validators/constraint-types.d.ts +2 -1
- package/dist/lib/util/validators/constraint-types.js +5 -2
- package/dist/lib/util/validators/constraint-types.js.map +1 -1
- package/dist/lib/util/validators/constraint-types.test.js +5 -4
- package/dist/lib/util/validators/constraint-types.test.js.map +1 -1
- package/dist/migrations/20220331085057-add-api-link-table.d.ts +2 -0
- package/dist/migrations/20220331085057-add-api-link-table.js +34 -0
- package/dist/migrations/20220331085057-add-api-link-table.js.map +1 -0
- package/dist/migrations/20220408081222-clean-up-duplicate-foreign-key-role-permission.d.ts +2 -0
- package/dist/migrations/20220408081222-clean-up-duplicate-foreign-key-role-permission.js +9 -0
- package/dist/migrations/20220408081222-clean-up-duplicate-foreign-key-role-permission.js.map +1 -0
- package/dist/migrations/20220411103724-add-legal-value-description.d.ts +2 -0
- package/dist/migrations/20220411103724-add-legal-value-description.js +49 -0
- package/dist/migrations/20220411103724-add-legal-value-description.js.map +1 -0
- package/dist/migrations/20220425090847-add-token-permission.d.ts +2 -0
- package/dist/migrations/20220425090847-add-token-permission.js +31 -0
- package/dist/migrations/20220425090847-add-token-permission.js.map +1 -0
- package/dist/test/config/test-config.js +3 -6
- package/dist/test/config/test-config.js.map +1 -1
- package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js +34 -7
- package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js.map +1 -1
- package/dist/test/e2e/api/admin/api-token.e2e.test.js +2 -2
- package/dist/test/e2e/api/admin/api-token.e2e.test.js.map +1 -1
- package/dist/test/e2e/api/admin/context.e2e.test.js +49 -12
- package/dist/test/e2e/api/admin/context.e2e.test.js.map +1 -1
- package/dist/test/e2e/api/openapi/openapi.e2e.test.d.ts +1 -0
- package/dist/test/e2e/api/openapi/openapi.e2e.test.js +39 -0
- package/dist/test/e2e/api/openapi/openapi.e2e.test.js.map +1 -0
- package/dist/test/e2e/services/api-token-service.e2e.test.js +75 -1
- package/dist/test/e2e/services/api-token-service.e2e.test.js.map +1 -1
- package/dist/test/fixtures/fake-api-token-store.js +1 -0
- package/dist/test/fixtures/fake-api-token-store.js.map +1 -1
- package/dist/test/fixtures/fake-feature-strategies-store.js +2 -2
- package/dist/test/fixtures/fake-feature-strategies-store.js.map +1 -1
- package/dist/test/fixtures/fake-feature-toggle-client-store.js +2 -2
- package/dist/test/fixtures/fake-feature-toggle-client-store.js.map +1 -1
- package/package.json +18 -16
package/README.md
CHANGED
|
@@ -1,197 +1,227 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
 [](https://coveralls.io/github/Unleash/unleash?branch=main) [](https://www.npmjs.com/package/unleash-server) [](https://hub.docker.com/r/unleashorg/unleash-server)
|
|
4
|
-
|
|
5
|
-
[](https://www.heroku.com/deploy/?template=https://github.com/Unleash/unleash) [](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Unleash/unleash/tree/main&refcode=0e1d75187044) [](https://twitter.com/intent/follow?screen_name=getunleash)
|
|
6
|
-
|
|
7
3
|
<a href="https://getunleash.io" title="Unleash - Create with freedom. Release with confidence">
|
|
8
|
-
<img src="./.github/
|
|
4
|
+
<img src="./.github/github_header_opaque_landscape.svg" alt="The Unleash website">
|
|
9
5
|
</a>
|
|
10
6
|
|
|
7
|
+
<br/>
|
|
8
|
+
<br/>
|
|
9
|
+
|
|
10
|
+
[](https://github.com/Unleash/unleash/actions/workflows/build.yaml)
|
|
11
|
+
[](https://coveralls.io/github/Unleash/unleash?branch=main) [](https://www.npmjs.com/package/unleash-server)
|
|
12
|
+
[](https://hub.docker.com/r/unleashorg/unleash-server)
|
|
13
|
+
[](https://github.com/Unleash/unleash/blob/main/LICENSE)
|
|
14
|
+
[](https://slack.unleash.run)
|
|
15
|
+
|
|
11
16
|
</div>
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
## About Unleash
|
|
14
19
|
|
|
15
|
-
Unleash
|
|
20
|
+
Unleash is an open source feature management solution. It improves the workflow of your development team and leads to quicker software delivery. Unleash increases efficiency and gives teams *full control* of how and when they enable new functionality for end users. Unleash lets teams ship code to production in *smaller* releases *whenever* they want.
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
Feature toggles make it easy to test how your code works with real production data without the fear that you'll accidentally break your users' experience. It also helps your team work on multiple features in parallel without each maintaining an separate feature branch.
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
Unleash is the largest open source solution for feature flagging on GitHub. There's 12 official client and server SDKs and 10+ community SDKs available; you can even make your own if you want to. You can use Unleash with any language and any framework.
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
- Canary release (Gradual rollout)
|
|
23
|
-
- Targeted release
|
|
24
|
-
- Experimentation (A/B testing)
|
|
25
|
-
- Kill Switches
|
|
26
|
-
- Custom activation strategies
|
|
27
|
-
- Privacy first (GDPR) where end-user data never leaves your application
|
|
28
|
-
- Audit logs
|
|
29
|
-
- Addons integrating with other popular tools (Slack, Teams, Datadog, etc.)
|
|
30
|
-
- It is secure (Enable Secure Headers with strict HTTPS only mode)
|
|
31
|
-
- Extremely scalable with evaluations on the client-side. Used in enterprises handling more than 10k req/s. [Read more about our architecture](https://docs.getunleash.io/)
|
|
32
|
-
- Dashboard to manage technical debt
|
|
33
|
-
- Admin APIs
|
|
34
|
-
- Flexible architecture and can be hosted anywhere
|
|
35
|
-
- [Docker image available](https://hub.docker.com/r/unleashorg/unleash-server)
|
|
26
|
+
<br/>
|
|
36
27
|
|
|
37
|
-
|
|
28
|
+
## Get started in 2 steps
|
|
38
29
|
|
|
39
|
-
|
|
30
|
+
### 1. Start Unleash
|
|
40
31
|
|
|
41
|
-
-
|
|
42
|
-
- Advanced segmentation
|
|
43
|
-
- Environments (unlimited)
|
|
44
|
-
- SSO (SAML 2.0, OpenID Connect, etc)
|
|
45
|
-
- A cloud offering where the Unleash team host, monitor, scale, patches, upgrades and take full backups for you
|
|
46
|
-
- Self-hosted possible
|
|
47
|
-
- SLA guarantees
|
|
48
|
-
- Support
|
|
32
|
+
With [`git`](https://git-scm.com/) and [`docker`](https://www.docker.com/) installed, it's easy to get started:
|
|
49
33
|
|
|
50
|
-
|
|
34
|
+
Run this script:
|
|
35
|
+
``` bash
|
|
36
|
+
git clone git@github.com:Unleash/unleash-docker.git
|
|
37
|
+
cd unleash-docker
|
|
38
|
+
docker compose up -d
|
|
39
|
+
```
|
|
51
40
|
|
|
52
|
-
|
|
41
|
+
Then point your browser to `localhost:4242` and log in using:
|
|
42
|
+
- username: `admin`
|
|
43
|
+
- password: `unleash4all`
|
|
53
44
|
|
|
54
|
-
|
|
45
|
+
### 2. Connect your SDK
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
- [Java SDK](https://docs.getunleash.io/sdks/java_sdk)
|
|
58
|
-
- [Node.js SDK](https://docs.getunleash.io/sdks/node_sdk)
|
|
59
|
-
- [Python SDK](https://docs.getunleash.io/sdks/python_sdk)
|
|
60
|
-
- [PHP SDK](https://docs.getunleash.io/sdks/php_sdk)
|
|
61
|
-
- [Ruby SDK](https://docs.getunleash.io/sdks/ruby_sdk)
|
|
62
|
-
- [Rust SDK](https://github.com/unleash/unleash-client-rust)
|
|
63
|
-
- [.NET SDK](https://docs.getunleash.io/sdks/dot_net_sdk)
|
|
47
|
+
Find your preferred SDK in [our list of official SDKs](#unleash-sdks) and import it into your project. Follow the setup guides for your specific SDK.
|
|
64
48
|
|
|
65
|
-
|
|
49
|
+
If you use the docker compose file from the previous step, here's the configuration details you'll need to get going:
|
|
50
|
+
- For front-end SDKs, use:
|
|
51
|
+
- URL: `http://localhost:3000`
|
|
52
|
+
- `clientKey`: `proxy-client-key`
|
|
53
|
+
- For server-side SDKs, use:
|
|
54
|
+
- Unleash API URL: `http://localhost:4242`
|
|
55
|
+
- API token: `default:development.unleash-insecure-api-token`
|
|
66
56
|
|
|
67
|
-
|
|
57
|
+
If you use a different setup, your configuration details will most likely also be different.
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
- [iOS SDK](https://docs.getunleash.io/sdks/proxy-ios)
|
|
71
|
-
- [Javascript SDK](https://docs.getunleash.io/sdks/proxy-javascript)
|
|
72
|
-
- [React SDK](https://docs.getunleash.io/sdks/proxy-react)
|
|
59
|
+
### Check a feature toggle
|
|
73
60
|
|
|
74
|
-
|
|
61
|
+
Checking the state of a feature toggle in your code is easy! The syntax will vary depending on your language, but all you need is a simple function call to check whether a toggle is available. Here's how it might look in Java:
|
|
75
62
|
|
|
76
|
-
|
|
63
|
+
```java
|
|
64
|
+
if (unleash.isEnabled("AwesomeFeature")) {
|
|
65
|
+
// do new, flashy thing
|
|
66
|
+
} else {
|
|
67
|
+
// do old, boring stuff
|
|
68
|
+
}
|
|
69
|
+
```
|
|
77
70
|
|
|
78
|
-
|
|
71
|
+
### Run Unleash on a service?
|
|
79
72
|
|
|
80
|
-
|
|
73
|
+
If you don't want to run Unleash locally, we also provide easy deployment setups for Heroku and Digital Ocean:
|
|
81
74
|
|
|
82
|
-
[
|
|
75
|
+
[](https://www.heroku.com/deploy/?template=https://github.com/Unleash/unleash) [](https://cloud.digitalocean.com/apps/new?repo=https://github.com/Unleash/unleash/tree/main&refcode=0e1d75187044)
|
|
83
76
|
|
|
84
|
-
|
|
77
|
+
### Configure and run Unleash anywhere
|
|
85
78
|
|
|
86
|
-
The
|
|
79
|
+
The above sections show you how to get up and running quickly and easily. When you're ready to start configuring and customizing Unleash for your own environment, check out the documentation for [getting started with self-managed deployments](https://docs.getunleash.io/deploy/getting_started), [Unleash configuration options](https://docs.getunleash.io/deploy/configuring_unleash), or [running Unleash locally via docker](https://docs.getunleash.io/user_guide/quickstart#i-want-to-run-unleash-locally).
|
|
87
80
|
|
|
88
|
-
|
|
81
|
+
<br/>
|
|
89
82
|
|
|
90
|
-
|
|
83
|
+
## Online demo
|
|
91
84
|
|
|
92
|
-
|
|
85
|
+
Try out [the Unleash online demo](https://www.getunleash.io/interactive-demo).
|
|
93
86
|
|
|
94
|
-
[
|
|
87
|
+

|
|
95
88
|
|
|
96
|
-
|
|
89
|
+
<br/>
|
|
97
90
|
|
|
98
|
-
|
|
91
|
+
## Community and help — sharing is caring
|
|
99
92
|
|
|
100
|
-
|
|
93
|
+
We know that learning a new tool can be hard and time-consuming. We have a growing community that loves to help out. Please don't hesitate to reach out for help.
|
|
101
94
|
|
|
102
|
-
|
|
103
|
-
- GradualRollout to X-percent of our users
|
|
104
|
-
- Active for our beta users
|
|
105
|
-
- Active only for application instances running on host x.
|
|
95
|
+
[](https://slack.unleash.run)
|
|
106
96
|
|
|
107
|
-
|
|
97
|
+
💬 [Join Unleash on Slack](https://slack.unleash.run) if you want ask open questions about Unleash, feature toggling or discuss these topics in general.
|
|
108
98
|
|
|
109
|
-
|
|
99
|
+
💻 [Create a GitHub issue](https://github.com/Unleash/unleash/issues/new) if you have found a bug or have ideas on how to improve Unleash.
|
|
110
100
|
|
|
111
|
-
|
|
101
|
+
📚 [Visit the documentation](https://docs.getunleash.io/) for more in-depth descriptions, how-to guides, and more.
|
|
112
102
|
|
|
113
|
-
|
|
114
|
-
if (unleash.isEnabled("AwesomeFeature")) {
|
|
115
|
-
//do some magic
|
|
116
|
-
} else {
|
|
117
|
-
//do old boring stuff
|
|
118
|
-
}
|
|
119
|
-
```
|
|
103
|
+
<br/>
|
|
120
104
|
|
|
121
|
-
|
|
105
|
+
## Contribute to Unleash
|
|
122
106
|
|
|
123
|
-
|
|
107
|
+
Building Unleash is a collaborative effort, and we owe a lot of gratitude to many smart and talented individuals.
|
|
108
|
+
Building it together with community ensures that we build a product that solves real problems for real people.
|
|
109
|
+
We'd love to have your help too: Please feel free to open issues or provide pull requests.
|
|
124
110
|
|
|
125
|
-
|
|
126
|
-
2. Unleash Open-Source - Self host with Docker. [Guide](https://docs.getunleash.io/deploy/getting_started#start-unleash-server)
|
|
127
|
-
3. Unleash Open-Source - Self host with Node.js [Guide](https://docs.getunleash.io/deploy/getting_started#start-unleash-server)
|
|
128
|
-
4. Unleash Open-Source - Helm chart [artifacthub.io](https://artifacthub.io/packages/helm/unleash/unleash)
|
|
111
|
+
Check out [the CONTRIBUTING.md file](./CONTRIBUTING.md) for contribution guidelines and the [Unleash developer guide](./website/docs/contributing/developer-guide.md) for tips on environment setup, running the tests, and running Unleash from source.
|
|
129
112
|
|
|
130
|
-
###
|
|
113
|
+
### Contributors
|
|
131
114
|
|
|
132
|
-
|
|
115
|
+
<div align="center">
|
|
133
116
|
|
|
134
|
-
|
|
135
|
-
docker network create unleash
|
|
136
|
-
```
|
|
117
|
+
[](https://github.com/Unleash/unleash/graphs/contributors)
|
|
137
118
|
|
|
138
|
-
|
|
119
|
+
</div>
|
|
139
120
|
|
|
140
|
-
|
|
141
|
-
docker run -e POSTGRES_PASSWORD=some_password \
|
|
142
|
-
-e POSTGRES_USER=unleash_user -e POSTGRES_DB=unleash \
|
|
143
|
-
--network unleash --name postgres postgres
|
|
144
|
-
```
|
|
121
|
+
<br/>
|
|
145
122
|
|
|
146
|
-
|
|
123
|
+
## Features our users love
|
|
147
124
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
125
|
+
### Flexibility and adaptability
|
|
126
|
+
|
|
127
|
+
- Get an easy overview of all feature toggles across all your environments, applications and services
|
|
128
|
+
- Use included [activation strategies](https://docs.getunleash.io/user_guide/activation_strategy) for most common use cases, or use a [custom activation strategy](https://docs.getunleash.io/advanced/custom_activation_strategy) to support any need you might have
|
|
129
|
+
- Organise feature toggles by [feature toggle tags](https://docs.getunleash.io/advanced/tags)
|
|
130
|
+
- [Canary releases / gradual rollouts](https://docs.getunleash.io/user_guide/activation_strategy#gradual-rollout)
|
|
131
|
+
- Targeted releases: release features to specific [users](https://docs.getunleash.io/user_guide/activation_strategy#userids), [IPs](https://docs.getunleash.io/user_guide/activation_strategy#ips), or [hostnames](https://docs.getunleash.io/user_guide/activation_strategy#hostnames)
|
|
132
|
+
- [Kill switches](https://docs.getunleash.io/advanced/feature_toggle_types#feature-toggle-types)
|
|
133
|
+
- [A/B testing](https://docs.getunleash.io/topics/a-b-testing)
|
|
134
|
+
- 2 [environments](https://docs.getunleash.io/user_guide/environments)
|
|
135
|
+
- Out-of-the-box integrations with popular tools ([Slack](https://docs.getunleash.io/addons/slack), [Microsoft Teams](https://docs.getunleash.io/addons/teams), [Datadog](https://docs.getunleash.io/addons/datadog)) + integrate with anything with [webhooks](https://docs.getunleash.io/addons/webhook)
|
|
136
|
+
- [Dashboard for managing technical debt](https://docs.getunleash.io/user_guide/technical_debt) and [stale toggles](https://docs.getunleash.io/user_guide/technical_debt#stale-and-potentially-stale-toggles)
|
|
137
|
+
- API-first: *everything* can be automated. No exceptions.
|
|
138
|
+
- [12 official client SDKs](https://docs.getunleash.io/sdks#official-sdks), and ten [community-contributed client SDKs](https://docs.getunleash.io/sdks#community-sdks)
|
|
139
|
+
- Run it via Docker with the [official Docker image](https://hub.docker.com/r/unleashorg/unleash-server) or as a pure Node.js application
|
|
140
|
+
|
|
141
|
+
### Security and performance
|
|
142
|
+
|
|
143
|
+
- Privacy by design (GDPR and Schrems II). End-user data never leaves your application.
|
|
144
|
+
- [Audit logs](https://docs.getunleash.io/advanced/audit_log)
|
|
145
|
+
- Enforce [OWASP's secure headers](https://owasp.org/www-project-secure-headers/) via the strict HTTPS-only mode
|
|
146
|
+
- Flexible hosting options: host it on premise or in the cloud (*any* cloud)
|
|
147
|
+
- Scale [the Unleash Proxy](https://docs.getunleash.io/sdks/unleash-proxy) independently of the Unleash server to support any number of front-end clients without overloading your Unleash instance
|
|
148
|
+
|
|
149
|
+
### Looking for more features?
|
|
150
|
+
|
|
151
|
+
If you're looking for one of the following features, please take a look at our [Pro and Enterprise plans](https://www.getunleash.io/plans):
|
|
152
|
+
- [role-based access control (RBAC)](https://docs.getunleash.io/user_guide/rbac)
|
|
153
|
+
- [single sign-on (SSO)](https://docs.getunleash.io/advanced/enterprise-authentication)
|
|
154
|
+
- more environments
|
|
155
|
+
- [feature toggles project support](https://docs.getunleash.io/user_guide/projects)
|
|
156
|
+
- [advanced segmentation](https://docs.getunleash.io/reference/segments)
|
|
157
|
+
- [additional strategy constraints](https://docs.getunleash.io/advanced/strategy_constraints)
|
|
158
|
+
- tighter security
|
|
159
|
+
- more hosting options (we can even host it for you!)
|
|
160
|
+
|
|
161
|
+
<br/>
|
|
162
|
+
|
|
163
|
+
## Architecture
|
|
164
|
+
|
|
165
|
+
<img src="./.github/Unleash_architecture.svg" title="Unleash System Overview" />
|
|
166
|
+
|
|
167
|
+
Read more in the [*system overview* section of the Unleash documentation](https://docs.getunleash.io/user_guide/unleash_overview#system-overview).
|
|
168
|
+
|
|
169
|
+
<br/>
|
|
170
|
+
|
|
171
|
+
## Unleash SDKs
|
|
172
|
+
|
|
173
|
+
To connect your application to Unleash you'll need to use a client SDK for your programming language.
|
|
155
174
|
|
|
156
|
-
|
|
175
|
+
**Official server-side SDKs:**
|
|
176
|
+
|
|
177
|
+
- [Go SDK](https://docs.getunleash.io/sdks/go_sdk)
|
|
178
|
+
- [Java SDK](https://docs.getunleash.io/sdks/java_sdk)
|
|
179
|
+
- [Node.js SDK](https://docs.getunleash.io/sdks/node_sdk)
|
|
180
|
+
- [PHP SDK](https://docs.getunleash.io/sdks/php_sdk)
|
|
181
|
+
- [Python SDK](https://docs.getunleash.io/sdks/python_sdk)
|
|
182
|
+
- [Ruby SDK](https://docs.getunleash.io/sdks/ruby_sdk)
|
|
183
|
+
- [Rust SDK](https://github.com/unleash/unleash-client-rust)
|
|
184
|
+
- [.NET SDK](https://docs.getunleash.io/sdks/dot_net_sdk)
|
|
185
|
+
|
|
186
|
+
**Official front-end SDKs:**
|
|
187
|
+
|
|
188
|
+
The front-end SDKs connects via the [Unleash Proxy](https://docs.getunleash.io/sdks/unleash-proxy) in order to ensure privacy, scalability and security.
|
|
189
|
+
|
|
190
|
+
- [Android SDK](https://docs.getunleash.io/sdks/android_proxy_sdk)
|
|
191
|
+
- [Javascript SDK](https://docs.getunleash.io/sdks/proxy-javascript)
|
|
192
|
+
- [React SDK](https://docs.getunleash.io/sdks/proxy-react)
|
|
193
|
+
- [iOS SDK](https://docs.getunleash.io/sdks/proxy-ios)
|
|
157
194
|
|
|
158
|
-
|
|
159
|
-
- password: `unleash4all`
|
|
195
|
+
**Community SDKs:**
|
|
160
196
|
|
|
161
|
-
|
|
197
|
+
If none of the official SDKs fit your need, there's also a number of [community-developed SDKs](https://docs.getunleash.io/sdks#community-sdks) where you might find an implementation for your preferred language (such as [Elixir](https://gitlab.com/afontaine/unleash_ex), [Dart](https://pub.dev/packages/unleash), [Clojure](https://github.com/AppsFlyer/unleash-client-clojure), and more).
|
|
162
198
|
|
|
163
|
-
|
|
199
|
+
<br/>
|
|
164
200
|
|
|
165
|
-
|
|
201
|
+
## Users of Unleash
|
|
166
202
|
|
|
167
|
-
|
|
203
|
+
**Unleash is trusted by thousands of companies all over the world**.
|
|
168
204
|
|
|
169
|
-
|
|
205
|
+
**Proud Open-Source users:** (send us a message if you want to add your logo here)
|
|
170
206
|
|
|
171
|
-
Unleash
|
|
207
|
+

|
|
172
208
|
|
|
173
|
-
|
|
174
|
-
1. Browse the [developer-guide](./website/docs/contributing/developer-guide.md) for tips on environment setup, running the tests, and running Unleash from source.
|
|
209
|
+
<br/>
|
|
175
210
|
|
|
176
|
-
|
|
211
|
+
## Want to know more about Unleash?
|
|
177
212
|
|
|
178
|
-
|
|
213
|
+
### Videos and podcasts
|
|
179
214
|
|
|
180
|
-
- [
|
|
181
|
-
- [
|
|
182
|
-
- [
|
|
215
|
+
- [The Unleash YouTube channel](https://www.youtube.com/channel/UCJjGVOc5QBbEje-r7nZEa4A)
|
|
216
|
+
- [*Feature toggles — Why and how to add to your software* — freeCodeCamp (YouTube)](https://www.youtube.com/watch?v=-yHZ9uLVSp4&t=0s)
|
|
217
|
+
- [*Feature flags with Unleash* — The Code Kitchen (podcast)](https://share.fireside.fm/episode/zD-4e4KI+Pr379KBv)
|
|
218
|
+
- [*Feature Flags og Unleash med Fredrik Oseberg* — Utviklerpodden (podcast; Norwegian)](https://pod.space/utviklerpodden/feature-flags-og-unleash-med-fredrik-oseberg)
|
|
183
219
|
|
|
184
|
-
|
|
220
|
+
### Articles and more
|
|
185
221
|
|
|
186
|
-
- [
|
|
187
|
-
- [
|
|
188
|
-
- [
|
|
189
|
-
- [
|
|
190
|
-
- [
|
|
191
|
-
- [
|
|
192
|
-
- [This Week in Rust 340](https://this-week-in-rust.org/blog/2020/05/27/this-week-in-rust-340/)
|
|
193
|
-
- [Unleash-hosted - Unleash as a Service](https://www.unleash-hosted.com)
|
|
194
|
-
- [Medium blog](https://medium.com/unleash-hosted)
|
|
195
|
-
- [Blog: Unleash your features gradually!](http://bytes.schibsted.com/unleash-features-gradually/)
|
|
196
|
-
- [Presentation: Unleash your features gradually!](http://ivarconr.github.io/feature-toggles-presentation/sch-dev-lunch-2017/#1)
|
|
197
|
-
- http://martinfowler.com/bliki/FeatureToggle.html
|
|
222
|
+
- [The Unleash Blog](https://www.getunleash.io/blog)
|
|
223
|
+
- [*Designing the Rust Unleash API client* — Medium](https://medium.com/cognite/designing-the-rust-unleash-api-client-6809c95aa568)
|
|
224
|
+
- [*FeatureToggle* by Martin Fowler](http://martinfowler.com/bliki/FeatureToggle.html)
|
|
225
|
+
- [*Feature toggling transient errors in load tests* — nrkbeta](https://nrkbeta.no/2021/08/23/feature-toggling-transient-errors-in-load-tests/)
|
|
226
|
+
- [*An Interview with Ivar of Unleash* — Console](https://console.substack.com/p/console-42)
|
|
227
|
+
- [*Unleash your features gradually*](http://ivarconr.github.io/feature-toggles-presentation/sch-dev-lunch-2017/#1 " "), slideshow/presentation by Ivar, the creator of Unleash
|
|
@@ -10,6 +10,6 @@ export default abstract class Addon {
|
|
|
10
10
|
constructor(definition: IAddonDefinition, { getLogger }: Pick<IUnleashConfig, 'getLogger'>);
|
|
11
11
|
get name(): string;
|
|
12
12
|
get definition(): IAddonDefinition;
|
|
13
|
-
fetchRetry(url: string, options?: {}, retries?: number
|
|
13
|
+
fetchRetry(url: string, options?: {}, retries?: number): Promise<Response>;
|
|
14
14
|
abstract handleEvent(event: IEvent, parameters: any): Promise<void>;
|
|
15
15
|
}
|
package/dist/lib/addons/addon.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const make_fetch_happen_1 = __importDefault(require("make-fetch-happen"));
|
|
7
7
|
const addon_schema_1 = require("./addon-schema");
|
|
8
8
|
class Addon {
|
|
9
9
|
constructor(definition, { getLogger }) {
|
|
@@ -22,20 +22,19 @@ class Addon {
|
|
|
22
22
|
get definition() {
|
|
23
23
|
return this._definition;
|
|
24
24
|
}
|
|
25
|
-
async fetchRetry(url, options = {}, retries = 1
|
|
26
|
-
const retryCodes = [408, 500, 502, 503, 504, 522, 524];
|
|
25
|
+
async fetchRetry(url, options = {}, retries = 1) {
|
|
27
26
|
let res;
|
|
28
27
|
try {
|
|
29
|
-
res = await (0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
res = await (0, make_fetch_happen_1.default)(url, {
|
|
29
|
+
retry: {
|
|
30
|
+
retries,
|
|
31
|
+
},
|
|
32
|
+
...options,
|
|
33
|
+
});
|
|
35
34
|
return res;
|
|
36
35
|
}
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
catch (e) {
|
|
37
|
+
res = { statusCode: e.code, ok: false };
|
|
39
38
|
}
|
|
40
39
|
return res;
|
|
41
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"addon.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.ts"],"names":[],"mappings":";;;;;AACA,0EAAsC;AACtC,iDAAuD;AAMvD,MAA8B,KAAK;IAO/B,YACI,UAA4B,EAC5B,EAAE,SAAS,EAAqC;QAEhD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,SAAS,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,EAAE,KAAK,EAAE,GAAG,oCAAqB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,iCAAiC,UAAU,CAAC,IAAI,EAAE,EAClD,KAAK,CACR,CAAC;YACF,MAAM,KAAK,CAAC;SACf;QACD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAClC,CAAC;IAED,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU,CACZ,GAAW,EACX,OAAO,GAAG,EAAE,EACZ,UAAkB,CAAC;QAEnB,IAAI,GAAG,CAAC;QACR,IAAI;YACA,GAAG,GAAG,MAAM,IAAA,2BAAK,EAAC,GAAG,EAAE;gBACnB,KAAK,EAAE;oBACH,OAAO;iBACV;gBACD,GAAG,OAAO;aACb,CAAC,CAAC;YACH,OAAO,GAAG,CAAC;SACd;QAAC,OAAO,CAAC,EAAE;YACR,GAAG,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;SAC3C;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CAIJ;AAtDD,wBAsDC"}
|
|
@@ -3,40 +3,63 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const nock_1 = __importDefault(require("nock"));
|
|
7
7
|
const no_logger_1 = __importDefault(require("../../test/fixtures/no-logger"));
|
|
8
8
|
const slack_1 = __importDefault(require("./slack"));
|
|
9
9
|
beforeEach(() => {
|
|
10
|
-
|
|
10
|
+
nock_1.default.disableNetConnect();
|
|
11
11
|
});
|
|
12
|
-
test('
|
|
12
|
+
test('Does not retry if request succeeds', async () => {
|
|
13
13
|
const url = 'https://test.some.com';
|
|
14
|
-
jest.useFakeTimers('modern');
|
|
15
14
|
const addon = new slack_1.default({
|
|
16
15
|
getLogger: no_logger_1.default,
|
|
17
16
|
unleashUrl: url,
|
|
18
17
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
(0, nock_1.default)(url).get('/').reply(201);
|
|
19
|
+
const res = await addon.fetchRetry(url);
|
|
20
|
+
expect(res.ok).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
test('Retries once, and succeeds', async () => {
|
|
23
|
+
const url = 'https://test.some.com';
|
|
24
|
+
const addon = new slack_1.default({
|
|
25
|
+
getLogger: no_logger_1.default,
|
|
26
|
+
unleashUrl: url,
|
|
22
27
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
(0, nock_1.default)(url).get('/').replyWithError('testing retry');
|
|
29
|
+
(0, nock_1.default)(url).get('/').reply(200);
|
|
30
|
+
const res = await addon.fetchRetry(url);
|
|
31
|
+
expect(res.ok).toBe(true);
|
|
32
|
+
expect(nock_1.default.isDone()).toBe(true);
|
|
26
33
|
});
|
|
27
|
-
test('
|
|
34
|
+
test('Does not throw if response is error', async () => {
|
|
28
35
|
const url = 'https://test.some.com';
|
|
29
|
-
jest.useFakeTimers('modern');
|
|
30
36
|
const addon = new slack_1.default({
|
|
31
37
|
getLogger: no_logger_1.default,
|
|
32
38
|
unleashUrl: url,
|
|
33
39
|
});
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
(0, nock_1.default)(url).get('/').twice().replyWithError('testing retry');
|
|
41
|
+
const res = await addon.fetchRetry(url);
|
|
42
|
+
expect(res.ok).toBe(false);
|
|
43
|
+
});
|
|
44
|
+
test('Supports custom number of retries', async () => {
|
|
45
|
+
const url = 'https://test.some.com';
|
|
46
|
+
const addon = new slack_1.default({
|
|
47
|
+
getLogger: no_logger_1.default,
|
|
48
|
+
unleashUrl: url,
|
|
36
49
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
50
|
+
let retries = 0;
|
|
51
|
+
(0, nock_1.default)(url).get('/').twice().replyWithError('testing retry');
|
|
52
|
+
(0, nock_1.default)(url).get('/').reply(201);
|
|
53
|
+
const res = await addon.fetchRetry(url, {
|
|
54
|
+
onRetry: () => {
|
|
55
|
+
retries = retries + 1;
|
|
56
|
+
},
|
|
57
|
+
}, 2);
|
|
58
|
+
expect(retries).toBe(2);
|
|
59
|
+
expect(res.ok).toBe(true);
|
|
60
|
+
expect(nock_1.default.isDone()).toBe(true);
|
|
61
|
+
});
|
|
62
|
+
afterEach(() => {
|
|
63
|
+
nock_1.default.enableNetConnect();
|
|
41
64
|
});
|
|
42
65
|
//# sourceMappingURL=addon.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon.test.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.test.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"addon.test.js","sourceRoot":"","sources":["../../../src/lib/addons/addon.test.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,8EAAqD;AAErD,oDAAiC;AAEjC,UAAU,CAAC,GAAG,EAAE;IACZ,cAAI,CAAC,iBAAiB,EAAE,CAAC;AAC7B,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;IAClD,MAAM,GAAG,GAAG,uBAAuB,CAAC;IACpC,MAAM,KAAK,GAAG,IAAI,eAAU,CAAC;QACzB,SAAS,EAAE,mBAAQ;QACnB,UAAU,EAAE,GAAG;KAClB,CAAC,CAAC;IACH,IAAA,cAAI,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAA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,EAAE,KAAK,IAAI,EAAE;IACjD,MAAM,GAAG,GAAG,uBAAuB,CAAC;IACpC,MAAM,KAAK,GAAG,IAAI,eAAU,CAAC;QACzB,SAAS,EAAE,mBAAQ;QACnB,UAAU,EAAE,GAAG;KAClB,CAAC,CAAC;IACH,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAA,cAAI,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAC3D,IAAA,cAAI,EAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,CAC9B,GAAG,EACH;QACI,OAAO,EAAE,GAAG,EAAE;YACV,OAAO,GAAG,OAAO,GAAG,CAAC,CAAC;QAC1B,CAAC;KACJ,EACD,CAAC,CACJ,CAAC;IAEF,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,CAAC,cAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACX,cAAI,CAAC,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
package/dist/lib/app.js
CHANGED
|
@@ -54,6 +54,9 @@ async function getApp(config, stores, services, unleashSession) {
|
|
|
54
54
|
if (config.enableOAS) {
|
|
55
55
|
app.use(`${baseUriPath}/oas`, express_1.default.static('docs/api/oas'));
|
|
56
56
|
}
|
|
57
|
+
if (config.enableOAS && services.openApiService) {
|
|
58
|
+
services.openApiService.useDocs(app);
|
|
59
|
+
}
|
|
57
60
|
switch (config.authentication.type) {
|
|
58
61
|
case option_1.IAuthType.OPEN_SOURCE: {
|
|
59
62
|
app.use(baseUriPath, (0, api_token_middleware_1.default)(config, services));
|
|
@@ -96,6 +99,9 @@ async function getApp(config, stores, services, unleashSession) {
|
|
|
96
99
|
}
|
|
97
100
|
// Setup API routes
|
|
98
101
|
app.use(`${baseUriPath}/`, new routes_1.default(config, services).router);
|
|
102
|
+
if (services.openApiService) {
|
|
103
|
+
services.openApiService.useErrorHandler(app);
|
|
104
|
+
}
|
|
99
105
|
if (process.env.NODE_ENV !== 'production') {
|
|
100
106
|
app.use((0, errorhandler_1.default)());
|
|
101
107
|
}
|
package/dist/lib/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/lib/app.ts"],"names":[],"mappings":";;;;;AAAA,uDAAgD;AAChD,sDAA+D;AAC/D,gDAAwB;AACxB,8DAAsC;AACtC,kEAAoC;AACpC,kEAAyC;AACzC,gDAAwB;AACxB,gEAAwC;AACxC,8EAAyE;AACzE,mFAA0D;AAC1D,6FAAmE;AAEnE,2CAA2D;AAG3D,sDAAmC;AAEnC,iFAAwD;AACxD,2FAAkE;AAClE,yFAAgE;AAChE,uFAA8D;AAC9D,iFAAwD;AAExD,4DAAuD;AAExC,KAAK,UAAU,MAAM,CAChC,MAAsB,EACtB,MAAsB,EACtB,QAA0B,EAC1B,cAA+B;IAE/B,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAEtB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;IAEpD,IAAI,SAAS,GAAG,MAAM,IAAA,+BAAa,EAAC,MAAM,EAAE,+BAAY,CAAC,CAAC;IAE1D,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAC7B,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5B,GAAG,CAAC,GAAG,CAAC,MAAM,E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CAAC,CAAC,MAAM,CAAC,CAAC;IAErE,IAAI,QAAQ,CAAC,cAAc,EAAE;QACzB,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;KAChD;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACvC,GAAG,CAAC,GAAG,CAAC,IAAA,sBAAY,GAAE,CAAC,CAAC;KAC3B;IAED,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACrC,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,WAAW,MAAM,CAAC,EAAE;YAC3C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC;YACrD,OAAO;SACV;QAED,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACf,CAAC;AApID,yBAoIC"}
|
|
@@ -181,7 +181,7 @@ const loadTokensFromString = (tokenString, tokenType) => {
|
|
|
181
181
|
type: tokenType,
|
|
182
182
|
username: 'admin',
|
|
183
183
|
};
|
|
184
|
-
(0, api_token_1.validateApiToken)(token);
|
|
184
|
+
(0, api_token_1.validateApiToken)((0, api_token_1.mapLegacyToken)(token));
|
|
185
185
|
return token;
|
|
186
186
|
});
|
|
187
187
|
return tokens;
|