unleash-server 4.8.0-beta.2 → 4.8.0
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/CHANGELOG.md +1266 -0
- package/dist/migrations/20210428103922-patch-role-table.d.ts +2 -0
- package/dist/migrations/20210428103922-patch-role-table.js +8 -0
- package/dist/migrations/20210428103922-patch-role-table.js.map +1 -0
- package/dist/migrations/20210428103924-patch-admin-role-name.d.ts +2 -0
- package/dist/migrations/20210428103924-patch-admin-role-name.js +10 -0
- package/dist/migrations/20210428103924-patch-admin-role-name.js.map +1 -0
- package/dist/migrations/20210428103924-patch-admin_role.d.ts +2 -0
- package/dist/migrations/20210428103924-patch-admin_role.js +23 -0
- package/dist/migrations/20210428103924-patch-admin_role.js.map +1 -0
- package/dist/migrations/20210428103924-patch-role_permissions.d.ts +2 -0
- package/dist/migrations/20210428103924-patch-role_permissions.js +49 -0
- package/dist/migrations/20210428103924-patch-role_permissions.js.map +1 -0
- package/dist/migrations/20220224081422-remove-project-column-from-roles.d.ts +2 -0
- package/dist/migrations/20220224081422-remove-project-column-from-roles.js +7 -0
- package/dist/migrations/20220224081422-remove-project-column-from-roles.js.map +1 -0
- package/docs/api/oas/openapi.yaml +50 -44
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20210428103922-patch-role-table.js","sourceRoot":"","sources":["../../src/migrations/20210428103922-patch-role-table.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CAAC,yDAAyD,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20210428103924-patch-admin-role-name.js","sourceRoot":"","sources":["../../src/migrations/20210428103924-patch-admin-role-name.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL;;SAEC,EACD,EAAE,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
exports.up = function (db, cb) {
|
|
3
|
+
db.runSql(`
|
|
4
|
+
DO $$
|
|
5
|
+
declare
|
|
6
|
+
begin
|
|
7
|
+
WITH admin AS (
|
|
8
|
+
SELECT * FROM roles WHERE name in ('Admin', 'Super User') LIMIT 1
|
|
9
|
+
)
|
|
10
|
+
INSERT into role_user(role_id, user_id)
|
|
11
|
+
VALUES
|
|
12
|
+
((select id from admin), (select id FROM users where username='admin' LIMIT 1));
|
|
13
|
+
|
|
14
|
+
EXCEPTION WHEN OTHERS THEN
|
|
15
|
+
raise notice 'Ignored';
|
|
16
|
+
end;
|
|
17
|
+
$$;`, cb);
|
|
18
|
+
};
|
|
19
|
+
exports.down = function (db, cb) {
|
|
20
|
+
// We can't just remove roles for users as we don't know if there has been any manual additions.
|
|
21
|
+
cb();
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=20210428103924-patch-admin_role.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20210428103924-patch-admin_role.js","sourceRoot":"","sources":["../../src/migrations/20210428103924-patch-admin_role.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL;;;;;;;;;;;;;;YAcI,EACJ,EAAE,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,gGAAgG;IAChG,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
exports.up = function (db, cb) {
|
|
3
|
+
db.runSql(`
|
|
4
|
+
DO $$
|
|
5
|
+
declare
|
|
6
|
+
begin
|
|
7
|
+
WITH editor AS (
|
|
8
|
+
SELECT * FROM roles WHERE name in ('Editor', 'Regular') LIMIT 1
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
INSERT INTO role_permission(role_id, project, permission)
|
|
12
|
+
VALUES
|
|
13
|
+
((SELECT id from editor), '', 'CREATE_STRATEGY'),
|
|
14
|
+
((SELECT id from editor), '', 'UPDATE_STRATEGY'),
|
|
15
|
+
((SELECT id from editor), '', 'DELETE_STRATEGY'),
|
|
16
|
+
|
|
17
|
+
((SELECT id from editor), '', 'UPDATE_APPLICATION'),
|
|
18
|
+
|
|
19
|
+
((SELECT id from editor), '', 'CREATE_CONTEXT_FIELD'),
|
|
20
|
+
((SELECT id from editor), '', 'UPDATE_CONTEXT_FIELD'),
|
|
21
|
+
((SELECT id from editor), '', 'DELETE_CONTEXT_FIELD'),
|
|
22
|
+
|
|
23
|
+
((SELECT id from editor), '', 'CREATE_PROJECT'),
|
|
24
|
+
|
|
25
|
+
((SELECT id from editor), '', 'CREATE_ADDON'),
|
|
26
|
+
((SELECT id from editor), '', 'UPDATE_ADDON'),
|
|
27
|
+
((SELECT id from editor), '', 'DELETE_ADDON'),
|
|
28
|
+
|
|
29
|
+
((SELECT id from editor), 'default', 'UPDATE_PROJECT'),
|
|
30
|
+
((SELECT id from editor), 'default', 'DELETE_PROJECT'),
|
|
31
|
+
((SELECT id from editor), 'default', 'CREATE_FEATURE'),
|
|
32
|
+
((SELECT id from editor), 'default', 'UPDATE_FEATURE'),
|
|
33
|
+
((SELECT id from editor), 'default', 'DELETE_FEATURE');
|
|
34
|
+
|
|
35
|
+
-- Clean up duplicates
|
|
36
|
+
DELETE FROM role_permission p1
|
|
37
|
+
USING role_permission p2
|
|
38
|
+
WHERE p1.created_at < p2.created_at -- select the "older" ones
|
|
39
|
+
AND p1.project = p2.project -- list columns that define duplicates
|
|
40
|
+
AND p1.permission = p2.permission;
|
|
41
|
+
EXCEPTION WHEN OTHERS THEN
|
|
42
|
+
raise notice 'Ignored';
|
|
43
|
+
end;
|
|
44
|
+
$$;`, cb);
|
|
45
|
+
};
|
|
46
|
+
exports.down = function (db, cb) {
|
|
47
|
+
cb();
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=20210428103924-patch-role_permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20210428103924-patch-role_permissions.js","sourceRoot":"","sources":["../../src/migrations/20210428103924-patch-role_permissions.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCI,EACJ,EAAE,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,EAAE,EAAE,CAAC;AACT,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
exports.up = function (db, cb) {
|
|
2
|
+
db.runSql('ALTER TABLE roles DROP COLUMN IF EXISTS project', cb);
|
|
3
|
+
};
|
|
4
|
+
exports.down = function (db, cb) {
|
|
5
|
+
db.runSql('ALTER TABLE roles ADD COLUMN IF NOT EXISTS project text', cb);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=20220224081422-remove-project-column-from-roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20220224081422-remove-project-column-from-roles.js","sourceRoot":"","sources":["../../src/migrations/20220224081422-remove-project-column-from-roles.js"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE;IACzB,EAAE,CAAC,MAAM,CAAC,iDAAiD,EAAE,EAAE,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,EAAE,EAAE;IAC3B,EAAE,CAAC,MAAM,CAAC,yDAAyD,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC"}
|
|
@@ -39,13 +39,17 @@ tags:
|
|
|
39
39
|
info:
|
|
40
40
|
title: Unleash API
|
|
41
41
|
description: |-
|
|
42
|
+
|
|
43
|
+
> The Open API specifications are currently considered a **"beta feature"** and will not cover the full Unleash Admin API.
|
|
44
|
+
> You can follow the progress on making OAS official in [GitHub issue 1391](https://github.com/Unleash/unleash/issues/1391)
|
|
45
|
+
|
|
42
46
|
Unleash is an open source feature flag and toggle system for all your applications and services.
|
|
43
47
|
|
|
44
48
|
# Try it out
|
|
45
49
|
|
|
46
50
|
## Try it in your browser
|
|
47
51
|
|
|
48
|
-
Once you have [set your Unleash server up](https://
|
|
52
|
+
Once you have [set your Unleash server up](https://docs.getunleash.io/deploy/getting_started), you can test the API from inside your browser. The following assumes the server is running on localhost:4242.
|
|
49
53
|
|
|
50
54
|
The following 'endpoints' (such as `GET /admin/metrics/applications`) provide reference documentation for the Unleash REST API. To try out API calls:
|
|
51
55
|
1. Navigate to an endpoint
|
|
@@ -63,7 +67,7 @@ info:
|
|
|
63
67
|
version: 4.0.13
|
|
64
68
|
contact:
|
|
65
69
|
name: The Unleash team
|
|
66
|
-
url: 'https://
|
|
70
|
+
url: 'https://docs.getunleash.io'
|
|
67
71
|
externalDocs:
|
|
68
72
|
description: Unleash documentation
|
|
69
73
|
url: 'https://unleash.github.io/docs/getting_started'
|
|
@@ -223,7 +227,7 @@ paths:
|
|
|
223
227
|
source: |
|
|
224
228
|
curl --request POST \
|
|
225
229
|
--url http://localhost:4242/api/admin/features \
|
|
226
|
-
--data '
|
|
230
|
+
--data '{"name":"featureX","description":"Toggles featureX on and off","type":"release","enabled":true,"stale":false,"strategies":[{"name":"default","editable":true,"description":"Default on/off strategy.","parameters":{"parameter":{"name":"groupId","type":"string","description":"Define activation groups to allow you to correlate across feature toggles.","required":false}}}],"variants":[{"name":"yellow","weight":20}],"createdAt":"string"}'
|
|
227
231
|
'/admin/features/{featureName}':
|
|
228
232
|
get:
|
|
229
233
|
summary: Fetches a specific Feature Toggle from the Unleash server.
|
|
@@ -917,7 +921,7 @@ components:
|
|
|
917
921
|
version:
|
|
918
922
|
$ref: '#/components/schemas/versionSchema'
|
|
919
923
|
features:
|
|
920
|
-
$ref: '#/components/schemas/
|
|
924
|
+
$ref: '#/components/schemas/featureToggleListSchema'
|
|
921
925
|
x-tags:
|
|
922
926
|
- Responses
|
|
923
927
|
'401':
|
|
@@ -1276,7 +1280,7 @@ components:
|
|
|
1276
1280
|
minLength: 1
|
|
1277
1281
|
example: '2020-11-13T16:56:29.279Z'
|
|
1278
1282
|
seenToggles:
|
|
1279
|
-
$ref: '#/components/schemas/
|
|
1283
|
+
$ref: '#/components/schemas/featureToggleListSchema'
|
|
1280
1284
|
links:
|
|
1281
1285
|
type: object
|
|
1282
1286
|
properties:
|
|
@@ -1312,46 +1316,48 @@ components:
|
|
|
1312
1316
|
example: 1
|
|
1313
1317
|
x-tags:
|
|
1314
1318
|
- Schemas
|
|
1315
|
-
|
|
1319
|
+
featureToggleListSchema:
|
|
1316
1320
|
type: array
|
|
1317
1321
|
items:
|
|
1318
|
-
type:
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1322
|
+
type: array
|
|
1323
|
+
featureToggleSchema:
|
|
1324
|
+
type: object
|
|
1325
|
+
required:
|
|
1326
|
+
- name
|
|
1327
|
+
- description
|
|
1328
|
+
- type
|
|
1329
|
+
- enabled
|
|
1330
|
+
- stale
|
|
1331
|
+
- strategies
|
|
1332
|
+
properties:
|
|
1333
|
+
name:
|
|
1334
|
+
description: Feature Toggle name must be unique.
|
|
1335
|
+
type: string
|
|
1336
|
+
minLength: 1
|
|
1337
|
+
example: featureX
|
|
1338
|
+
description:
|
|
1339
|
+
type: string
|
|
1340
|
+
minLength: 1
|
|
1341
|
+
example: Toggles featureX on and off
|
|
1342
|
+
type:
|
|
1343
|
+
$ref: '#/components/schemas/featureToggleTypeSchema'
|
|
1344
|
+
enabled:
|
|
1345
|
+
description: Is the Feature Toggle enabled?
|
|
1346
|
+
type: boolean
|
|
1347
|
+
example: true
|
|
1348
|
+
stale:
|
|
1349
|
+
description: Is the Feature Toggle 'stale' (deprecated)?
|
|
1350
|
+
type: boolean
|
|
1351
|
+
example: false
|
|
1352
|
+
strategies:
|
|
1353
|
+
$ref: '#/components/schemas/strategySchema'
|
|
1354
|
+
variants:
|
|
1355
|
+
$ref: '#/components/schemas/variantsSchema'
|
|
1356
|
+
createdAt:
|
|
1357
|
+
type: string
|
|
1358
|
+
minLength: 1
|
|
1359
|
+
x-tags:
|
|
1360
|
+
- Schemas
|
|
1355
1361
|
strategySchema:
|
|
1356
1362
|
type: array
|
|
1357
1363
|
items:
|
|
@@ -1607,7 +1613,7 @@ components:
|
|
|
1607
1613
|
version:
|
|
1608
1614
|
$ref: '#/components/schemas/versionSchema'
|
|
1609
1615
|
features:
|
|
1610
|
-
$ref: '#/components/schemas/
|
|
1616
|
+
$ref: '#/components/schemas/featureToggleListSchema'
|
|
1611
1617
|
strategies:
|
|
1612
1618
|
$ref: '#/components/schemas/strategySchema'
|
|
1613
1619
|
x-tags:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unleash-server",
|
|
3
3
|
"description": "Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.",
|
|
4
|
-
"version": "4.8.0
|
|
4
|
+
"version": "4.8.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unleash",
|
|
7
7
|
"feature toggle",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"serve-favicon": "^2.5.0",
|
|
113
113
|
"stoppable": "^1.1.0",
|
|
114
114
|
"type-is": "^1.6.18",
|
|
115
|
-
"unleash-frontend": "4.8.0
|
|
115
|
+
"unleash-frontend": "4.8.0",
|
|
116
116
|
"uuid": "^8.3.2"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@types/express": "4.17.13",
|
|
122
122
|
"@types/express-session": "1.17.4",
|
|
123
123
|
"@types/faker": "5.5.9",
|
|
124
|
-
"@types/jest": "27.4.
|
|
124
|
+
"@types/jest": "27.4.1",
|
|
125
125
|
"@types/js-yaml": "4.0.5",
|
|
126
126
|
"@types/memoizee": "0.4.7",
|
|
127
127
|
"@types/mime": "2.0.3",
|