@@ -37,101 +37,21 @@ import LocalDatastoreController from './LocalDatastoreController';
37
37
import StorageController from './StorageController' ;
38
38
import WebSocketController from './WebSocketController' ;
39
39
40
- /**
41
- * Contains all Parse API classes and functions.
42
- *
43
- * @static
44
- * @global
45
- * @class
46
- * @hideconstructor
47
- */
48
- interface ParseType {
49
- ACL : typeof ACL ;
50
- Parse ?: ParseType ;
51
- Analytics : typeof Analytics ;
52
- AnonymousUtils : typeof AnonymousUtils ;
53
- Cloud : typeof Cloud & {
54
- /** only available in server environments */
55
- useMasterKey ?: ( ) => void ;
56
- } ;
57
- CLP : typeof CLP ;
58
- CoreManager : typeof CoreManager ;
59
- Config : typeof Config ;
60
- Error : typeof ParseError ;
61
- EventuallyQueue : typeof EventuallyQueue ;
62
- FacebookUtils : typeof FacebookUtils ;
63
- File : typeof File ;
64
- GeoPoint : typeof GeoPoint ;
65
- Hooks ?: any ;
66
- Polygon : typeof Polygon ;
67
- Installation : typeof Installation ;
68
- LocalDatastore : typeof LocalDatastore ;
69
- Object : typeof ParseObject ;
70
- Op : {
71
- Set : typeof ParseOp . SetOp ;
72
- Unset : typeof ParseOp . UnsetOp ;
73
- Increment : typeof ParseOp . IncrementOp ;
74
- Add : typeof ParseOp . AddOp ;
75
- Remove : typeof ParseOp . RemoveOp ;
76
- AddUnique : typeof ParseOp . AddUniqueOp ;
77
- Relation : typeof ParseOp . RelationOp ;
78
- } ;
79
- Push : typeof Push ;
80
- Query : typeof Query ;
81
- Relation : typeof Relation ;
82
- Role : typeof Role ;
83
- Schema : typeof Schema ;
84
- Session : typeof Session ;
85
- Storage : typeof Storage ;
86
- User : typeof User ;
87
- LiveQuery : typeof ParseLiveQuery ;
88
- LiveQueryClient : typeof LiveQueryClient ;
89
-
90
- initialize ( applicationId : string , javaScriptKey : string ) : void ;
91
- _initialize ( applicationId : string , javaScriptKey : string , masterKey ?: string ) : void ;
92
- setAsyncStorage ( storage : any ) : void ;
93
- setLocalDatastoreController ( controller : any ) : void ;
94
- getServerHealth ( ) : Promise < any > ;
95
-
96
- applicationId : string ;
97
- javaScriptKey : string ;
98
- masterKey : string ;
99
- serverURL : string ;
100
- serverAuthToken : string ;
101
- serverAuthType : string ;
102
- liveQueryServerURL : string ;
103
- encryptedUser : boolean ;
104
- secret : string ;
105
- idempotency : boolean ;
106
- allowCustomObjectId : boolean ;
107
- IndexedDB ?: any ;
108
- _request ( ...args : any [ ] ) : void ;
109
- _ajax ( ...args : any [ ] ) : void ;
110
- _decode ( ...args : any [ ] ) : void ;
111
- _encode ( ...args : any [ ] ) : void ;
112
- _getInstallationId ?( ) : Promise < string > ;
113
- enableLocalDatastore ( polling : boolean , ms : number ) : void ;
114
- isLocalDatastoreEnabled ( ) : boolean ;
115
- dumpLocalDatastore ( ) : void ;
116
- enableEncryptedUser ( ) : void ;
117
- isEncryptedUserEnabled ( ) : void ;
118
- }
119
-
120
- const Parse : ParseType = {
121
- ACL : ACL ,
122
- Analytics : Analytics ,
123
- AnonymousUtils : AnonymousUtils ,
124
- Cloud : Cloud ,
125
- CLP : CLP ,
126
- CoreManager : CoreManager ,
127
- Config : Config ,
40
+ const Parse = {
41
+ ACL ,
42
+ Analytics,
43
+ AnonymousUtils,
44
+ Cloud,
45
+ CLP ,
46
+ CoreManager,
47
+ Config,
128
48
Error : ParseError ,
129
- FacebookUtils : FacebookUtils ,
130
- File : File ,
131
- GeoPoint : GeoPoint ,
132
- Polygon : Polygon ,
133
- Installation : Installation ,
134
- LocalDatastore : LocalDatastore ,
49
+ FacebookUtils,
50
+ File,
51
+ GeoPoint,
52
+ Polygon,
53
+ Installation,
54
+ LocalDatastore,
135
55
Object : ParseObject ,
136
56
Op : {
137
57
Set : ParseOp . SetOp ,
@@ -142,15 +62,15 @@ const Parse: ParseType = {
142
62
AddUnique : ParseOp . AddUniqueOp ,
143
63
Relation : ParseOp . RelationOp ,
144
64
} ,
145
- Push : Push ,
146
- Query : Query ,
147
- Relation : Relation ,
148
- Role : Role ,
149
- Schema : Schema ,
150
- Session : Session ,
151
- Storage : Storage ,
152
- User : User ,
153
- LiveQueryClient : LiveQueryClient ,
65
+ Push,
66
+ Query,
67
+ Relation,
68
+ Role,
69
+ Schema,
70
+ Session,
71
+ Storage,
72
+ User,
73
+ LiveQueryClient,
154
74
IndexedDB : undefined ,
155
75
Hooks : undefined ,
156
76
Parse : undefined ,
@@ -314,10 +234,10 @@ const Parse: ParseType = {
314
234
* @member {ParseLiveQuery} Parse.LiveQuery
315
235
* @static
316
236
*/
317
- set LiveQuery ( liveQuery : typeof ParseLiveQuery ) {
237
+ set LiveQuery ( liveQuery : ParseLiveQuery ) {
318
238
CoreManager . setLiveQuery ( liveQuery ) ;
319
239
} ,
320
- get LiveQuery ( ) {
240
+ get LiveQuery ( ) : ParseLiveQuery {
321
241
return CoreManager . getLiveQuery ( ) ;
322
242
} ,
323
243
@@ -404,15 +324,15 @@ const Parse: ParseType = {
404
324
* @param [ms] Milliseconds to ping the server. Default 2000ms
405
325
* @static
406
326
*/
407
- enableLocalDatastore ( polling = true , ms = 2000 ) {
327
+ enableLocalDatastore ( polling ?: boolean , ms ?: number ) {
408
328
if ( ! this . applicationId ) {
409
329
console . log ( "'enableLocalDataStore' must be called after 'initialize'" ) ;
410
330
return ;
411
331
}
412
332
if ( ! this . LocalDatastore . isEnabled ) {
413
333
this . LocalDatastore . isEnabled = true ;
414
- if ( polling ) {
415
- CoreManager . getEventuallyQueue ( ) . poll ( ms ) ;
334
+ if ( polling || typeof polling === 'undefined' ) {
335
+ CoreManager . getEventuallyQueue ( ) . poll ( ms || 2000 ) ;
416
336
}
417
337
}
418
338
} ,
@@ -470,7 +390,7 @@ CoreManager.setRESTController(RESTController);
470
390
if ( process . env . PARSE_BUILD === 'node' ) {
471
391
Parse . initialize = Parse . _initialize ;
472
392
Parse . Cloud = Parse . Cloud || ( { } as any ) ;
473
- Parse . Cloud . useMasterKey = function ( ) {
393
+ ( Parse . Cloud as any ) . useMasterKey = function ( ) {
474
394
CoreManager . set ( 'USE_MASTER_KEY' , true ) ;
475
395
} ;
476
396
Parse . Hooks = Hooks ;
0 commit comments