File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var features = require('../src/features')
22
33describe ( 'features' , ( ) => {
44 it ( 'set and get features' , ( done ) => {
5- features . setFeature ( 'users ' , {
5+ features . setFeature ( 'push ' , {
66 testOption1 : true ,
77 testOption2 : false
88 } ) ;
@@ -11,10 +11,10 @@ describe('features', () => {
1111
1212 var expected = {
1313 testOption1 : true ,
14- testOption2 : false
14+ testOption2 : false
1515 } ;
1616
17- expect ( _features . users ) . toEqual ( expected ) ;
17+ expect ( _features . push ) . toEqual ( expected ) ;
1818 done ( ) ;
1919 } ) ;
2020
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ let masterKeyRequiredResponse = () => {
99}
1010
1111export class FeaturesRouter extends PromiseRouter {
12-
12+
1313 mountRoutes ( ) {
1414 this . route ( 'GET' , '/features' , ( req ) => {
1515 return this . handleGET ( req ) ;
@@ -20,10 +20,10 @@ export class FeaturesRouter extends PromiseRouter {
2020 if ( ! req . auth . isMaster ) {
2121 return masterKeyRequiredResponse ( ) ;
2222 }
23-
23+
2424 return Promise . resolve ( {
2525 response : {
26- results : [ getFeatures ( ) ]
26+ results : getFeatures ( )
2727 }
2828 } ) ;
2929 }
Original file line number Diff line number Diff line change 1414 * Features that use Adapters should specify the feature options through
1515 * the setFeature method in your controller and feature
1616 * Reference PushController and ParsePushAdapter as an example.
17- *
17+ *
1818 * 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.
2020 */
2121
2222// default features
2323let features = {
24- analytics : {
25- slowQueries : false ,
26- performanceAnalysis : false ,
27- retentionAnalysis : false ,
28- } ,
29- classes : { } ,
30- files : { } ,
31- functions : { } ,
3224 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 ,
3729 } ,
3830 hooks : {
3931 create : false ,
4032 read : false ,
4133 update : false ,
4234 delete : false ,
4335 } ,
44- iapValidation : { } ,
45- installations : { } ,
4636 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 ,
4948 } ,
50- publicAPI : { } ,
51- push : { } ,
52- roles : { } ,
5349 schemas : {
5450 addField : true ,
5551 removeField : true ,
@@ -58,27 +54,15 @@ let features = {
5854 clearAllDataFromClass : false ,
5955 exportClass : false ,
6056 } ,
61- sessions : { } ,
62- users : { } ,
6357} ;
6458
6559// master switch for features
6660let featuresSwitch = {
67- analytics : true ,
68- classes : true ,
69- files : true ,
70- functions : true ,
7161 globalConfig : true ,
7262 hooks : true ,
73- iapValidation : true ,
74- installations : true ,
7563 logs : true ,
76- publicAPI : true ,
7764 push : true ,
78- roles : true ,
7965 schemas : true ,
80- sessions : true ,
81- users : true ,
8266} ;
8367
8468/**
@@ -94,7 +78,7 @@ function setFeature(key, value) {
9478function getFeatures ( ) {
9579 let result = { } ;
9680 Object . keys ( features ) . forEach ( ( key ) => {
97- if ( featuresSwitch [ key ] ) {
81+ if ( featuresSwitch [ key ] && features [ key ] ) {
9882 result [ key ] = features [ key ] ;
9983 }
10084 } ) ;
You can’t perform that action at this time.
0 commit comments