@@ -37,101 +37,21 @@ import LocalDatastoreController from './LocalDatastoreController';
3737import StorageController from './StorageController' ;
3838import WebSocketController from './WebSocketController' ;
3939
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,
12848 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,
13555 Object : ParseObject ,
13656 Op : {
13757 Set : ParseOp . SetOp ,
@@ -142,15 +62,15 @@ const Parse: ParseType = {
14262 AddUnique : ParseOp . AddUniqueOp ,
14363 Relation : ParseOp . RelationOp ,
14464 } ,
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,
15474 IndexedDB : undefined ,
15575 Hooks : undefined ,
15676 Parse : undefined ,
@@ -314,10 +234,10 @@ const Parse: ParseType = {
314234 * @member {ParseLiveQuery} Parse.LiveQuery
315235 * @static
316236 */
317- set LiveQuery ( liveQuery : typeof ParseLiveQuery ) {
237+ set LiveQuery ( liveQuery : ParseLiveQuery ) {
318238 CoreManager . setLiveQuery ( liveQuery ) ;
319239 } ,
320- get LiveQuery ( ) {
240+ get LiveQuery ( ) : ParseLiveQuery {
321241 return CoreManager . getLiveQuery ( ) ;
322242 } ,
323243
@@ -404,15 +324,15 @@ const Parse: ParseType = {
404324 * @param [ms] Milliseconds to ping the server. Default 2000ms
405325 * @static
406326 */
407- enableLocalDatastore ( polling = true , ms = 2000 ) {
327+ enableLocalDatastore ( polling ?: boolean , ms ?: number ) {
408328 if ( ! this . applicationId ) {
409329 console . log ( "'enableLocalDataStore' must be called after 'initialize'" ) ;
410330 return ;
411331 }
412332 if ( ! this . LocalDatastore . isEnabled ) {
413333 this . LocalDatastore . isEnabled = true ;
414- if ( polling ) {
415- CoreManager . getEventuallyQueue ( ) . poll ( ms ) ;
334+ if ( polling || typeof polling === 'undefined' ) {
335+ CoreManager . getEventuallyQueue ( ) . poll ( ms || 2000 ) ;
416336 }
417337 }
418338 } ,
@@ -470,7 +390,7 @@ CoreManager.setRESTController(RESTController);
470390if ( process . env . PARSE_BUILD === 'node' ) {
471391 Parse . initialize = Parse . _initialize ;
472392 Parse . Cloud = Parse . Cloud || ( { } as any ) ;
473- Parse . Cloud . useMasterKey = function ( ) {
393+ ( Parse . Cloud as any ) . useMasterKey = function ( ) {
474394 CoreManager . set ( 'USE_MASTER_KEY' , true ) ;
475395 } ;
476396 Parse . Hooks = Hooks ;
0 commit comments