File tree Expand file tree Collapse file tree 3 files changed +24
-40
lines changed Expand file tree Collapse file tree 3 files changed +24
-40
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var features = require('../src/features')
2
2
3
3
describe ( 'features' , ( ) => {
4
4
it ( 'set and get features' , ( done ) => {
5
- features . setFeature ( 'users ' , {
5
+ features . setFeature ( 'push ' , {
6
6
testOption1 : true ,
7
7
testOption2 : false
8
8
} ) ;
@@ -11,10 +11,10 @@ describe('features', () => {
11
11
12
12
var expected = {
13
13
testOption1 : true ,
14
- testOption2 : false
14
+ testOption2 : false
15
15
} ;
16
16
17
- expect ( _features . users ) . toEqual ( expected ) ;
17
+ expect ( _features . push ) . toEqual ( expected ) ;
18
18
done ( ) ;
19
19
} ) ;
20
20
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ let masterKeyRequiredResponse = () => {
9
9
}
10
10
11
11
export class FeaturesRouter extends PromiseRouter {
12
-
12
+
13
13
mountRoutes ( ) {
14
14
this . route ( 'GET' , '/features' , ( req ) => {
15
15
return this . handleGET ( req ) ;
@@ -20,10 +20,10 @@ export class FeaturesRouter extends PromiseRouter {
20
20
if ( ! req . auth . isMaster ) {
21
21
return masterKeyRequiredResponse ( ) ;
22
22
}
23
-
23
+
24
24
return Promise . resolve ( {
25
25
response : {
26
- results : [ getFeatures ( ) ]
26
+ results : getFeatures ( )
27
27
}
28
28
} ) ;
29
29
}
Original file line number Diff line number Diff line change 14
14
* Features that use Adapters should specify the feature options through
15
15
* the setFeature method in your controller and feature
16
16
* Reference PushController and ParsePushAdapter as an example.
17
- *
17
+ *
18
18
* NOTE: When adding new endpoints be sure to update this list both (features, featureSwitch)
19
- * if you are planning to have a UI consume it.
19
+ * if you are planning to have a UI consume it.
20
20
*/
21
21
22
22
// default features
23
23
let features = {
24
- analytics : {
25
- slowQueries : false ,
26
- performanceAnalysis : false ,
27
- retentionAnalysis : false ,
28
- } ,
29
- classes : { } ,
30
- files : { } ,
31
- functions : { } ,
32
24
globalConfig : {
33
- create : true ,
34
- read : true ,
35
- update : true ,
36
- delete : true ,
25
+ create : false ,
26
+ read : false ,
27
+ update : false ,
28
+ delete : false ,
37
29
} ,
38
30
hooks : {
39
31
create : false ,
40
32
read : false ,
41
33
update : false ,
42
34
delete : false ,
43
35
} ,
44
- iapValidation : { } ,
45
- installations : { } ,
46
36
logs : {
47
- info : true ,
48
- error : true ,
37
+ level : false ,
38
+ size : false ,
39
+ order : false ,
40
+ until : false ,
41
+ from : false ,
42
+ } ,
43
+ push : {
44
+ immediatePush : false ,
45
+ scheduledPush : false ,
46
+ storedPushData : false ,
47
+ pushAudiences : false ,
49
48
} ,
50
- publicAPI : { } ,
51
- push : { } ,
52
- roles : { } ,
53
49
schemas : {
54
50
addField : true ,
55
51
removeField : true ,
@@ -58,27 +54,15 @@ let features = {
58
54
clearAllDataFromClass : false ,
59
55
exportClass : false ,
60
56
} ,
61
- sessions : { } ,
62
- users : { } ,
63
57
} ;
64
58
65
59
// master switch for features
66
60
let featuresSwitch = {
67
- analytics : true ,
68
- classes : true ,
69
- files : true ,
70
- functions : true ,
71
61
globalConfig : true ,
72
62
hooks : true ,
73
- iapValidation : true ,
74
- installations : true ,
75
63
logs : true ,
76
- publicAPI : true ,
77
64
push : true ,
78
- roles : true ,
79
65
schemas : true ,
80
- sessions : true ,
81
- users : true ,
82
66
} ;
83
67
84
68
/**
@@ -94,7 +78,7 @@ function setFeature(key, value) {
94
78
function getFeatures ( ) {
95
79
let result = { } ;
96
80
Object . keys ( features ) . forEach ( ( key ) => {
97
- if ( featuresSwitch [ key ] ) {
81
+ if ( featuresSwitch [ key ] && features [ key ] ) {
98
82
result [ key ] = features [ key ] ;
99
83
}
100
84
} ) ;
You can’t perform that action at this time.
0 commit comments