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.
@@ -0,0 +1,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ exports.up = function (db, cb) {
3
+ db.runSql('ALTER TABLE roles ADD COLUMN IF NOT EXISTS project text', cb);
4
+ };
5
+ exports.down = function (db, cb) {
6
+ cb();
7
+ };
8
+ //# sourceMappingURL=20210428103922-patch-role-table.js.map
@@ -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,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+ exports.up = function (db, cb) {
3
+ db.runSql(`
4
+ UPDATE roles set name='Admin' where name='Super User';
5
+ `, cb);
6
+ };
7
+ exports.down = function (db, cb) {
8
+ cb();
9
+ };
10
+ //# sourceMappingURL=20210428103924-patch-admin-role-name.js.map
@@ -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,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -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,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -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,2 @@
1
+ export function up(db: any, cb: any): void;
2
+ export function down(db: any, cb: any): void;
@@ -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://unleash.github.io/docs/getting_started), you can test the API from inside your browser. The following assumes the server is running on localhost:4242.
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://unleash.github.io/'
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 '[{"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"}]'
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/featureToggleSchema'
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/featureToggleSchema'
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
- featureToggleSchema:
1319
+ featureToggleListSchema:
1316
1320
  type: array
1317
1321
  items:
1318
- type: object
1319
- required:
1320
- - name
1321
- - description
1322
- - type
1323
- - enabled
1324
- - stale
1325
- - strategies
1326
- properties:
1327
- name:
1328
- description: Feature Toggle name must be unique.
1329
- type: string
1330
- minLength: 1
1331
- example: featureX
1332
- description:
1333
- type: string
1334
- minLength: 1
1335
- example: Toggles featureX on and off
1336
- type:
1337
- $ref: '#/components/schemas/featureToggleTypeSchema'
1338
- enabled:
1339
- description: Is the Feature Toggle enabled?
1340
- type: boolean
1341
- example: true
1342
- stale:
1343
- description: Is the Feature Toggle 'stale' (deprecated)?
1344
- type: boolean
1345
- example: false
1346
- strategies:
1347
- $ref: '#/components/schemas/strategySchema'
1348
- variants:
1349
- $ref: '#/components/schemas/variantsSchema'
1350
- createdAt:
1351
- type: string
1352
- minLength: 1
1353
- x-tags:
1354
- - Schemas
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/featureToggleSchema'
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-beta.2",
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-beta.8",
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.0",
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",