parse 4.1.0 → 4.2.0-alpha.10

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.
Files changed (120) hide show
  1. package/dist/parse.js +2123 -1542
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +2105 -1524
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/AnonymousUtils.js +1 -1
  6. package/lib/browser/Cloud.js +4 -2
  7. package/lib/browser/CoreManager.js +31 -4
  8. package/lib/browser/EventEmitter.js +7 -2
  9. package/lib/browser/EventuallyQueue.js +24 -4
  10. package/lib/browser/LiveQueryClient.js +59 -89
  11. package/lib/browser/LiveQuerySubscription.js +16 -51
  12. package/lib/browser/LocalDatastore.js +10 -1
  13. package/lib/browser/LocalDatastoreController.js +3 -1
  14. package/lib/browser/ObjectStateMutations.js +17 -2
  15. package/lib/browser/OfflineQuery.js +1 -1
  16. package/lib/browser/Parse.js +171 -135
  17. package/lib/browser/ParseACL.js +2 -1
  18. package/lib/browser/ParseCLP.js +6 -1
  19. package/lib/browser/ParseConfig.js +1 -0
  20. package/lib/browser/ParseError.js +12 -1
  21. package/lib/browser/ParseFile.js +5 -1
  22. package/lib/browser/ParseInstallation.js +4 -1
  23. package/lib/browser/ParseLiveQuery.js +79 -51
  24. package/lib/browser/ParseObject.js +11 -8
  25. package/lib/browser/ParseOp.js +3 -1
  26. package/lib/browser/ParseQuery.js +122 -72
  27. package/lib/browser/ParseRole.js +5 -1
  28. package/lib/browser/ParseSchema.js +23 -2
  29. package/lib/browser/ParseSession.js +1 -1
  30. package/lib/browser/ParseUser.js +107 -9
  31. package/lib/browser/Push.js +8 -2
  32. package/lib/browser/RESTController.js +20 -0
  33. package/lib/browser/SingleInstanceStateController.js +6 -1
  34. package/lib/browser/Storage.js +7 -0
  35. package/lib/browser/TaskQueue.js +4 -0
  36. package/lib/browser/UniqueInstanceStateController.js +3 -1
  37. package/lib/browser/unsavedChildren.js +4 -1
  38. package/lib/node/AnonymousUtils.js +1 -1
  39. package/lib/node/Cloud.js +4 -2
  40. package/lib/node/CoreManager.js +30 -4
  41. package/lib/node/EventEmitter.js +7 -1
  42. package/lib/node/EventuallyQueue.js +23 -4
  43. package/lib/node/LiveQueryClient.js +10 -7
  44. package/lib/node/LiveQuerySubscription.js +5 -7
  45. package/lib/node/LocalDatastore.js +7 -1
  46. package/lib/node/ObjectStateMutations.js +14 -2
  47. package/lib/node/OfflineQuery.js +1 -1
  48. package/lib/node/Parse.js +162 -126
  49. package/lib/node/ParseACL.js +2 -1
  50. package/lib/node/ParseCLP.js +3 -1
  51. package/lib/node/ParseConfig.js +1 -2
  52. package/lib/node/ParseError.js +15 -1
  53. package/lib/node/ParseFile.js +2 -1
  54. package/lib/node/ParseInstallation.js +1 -1
  55. package/lib/node/ParseLiveQuery.js +32 -24
  56. package/lib/node/ParseObject.js +3 -2
  57. package/lib/node/ParseQuery.js +53 -7
  58. package/lib/node/ParseRole.js +2 -1
  59. package/lib/node/ParseSchema.js +21 -2
  60. package/lib/node/ParseSession.js +1 -5
  61. package/lib/node/ParseUser.js +95 -9
  62. package/lib/node/Push.js +8 -2
  63. package/lib/node/RESTController.js +20 -0
  64. package/lib/node/SingleInstanceStateController.js +6 -1
  65. package/lib/node/Storage.js +6 -0
  66. package/lib/node/TaskQueue.js +4 -1
  67. package/lib/node/UniqueInstanceStateController.js +3 -1
  68. package/lib/node/unsavedChildren.js +4 -1
  69. package/lib/react-native/Cloud.js +3 -0
  70. package/lib/react-native/CoreManager.js +30 -4
  71. package/lib/react-native/EventEmitter.js +8 -5
  72. package/lib/react-native/EventuallyQueue.js +10 -3
  73. package/lib/react-native/LiveQueryClient.js +44 -70
  74. package/lib/react-native/LiveQuerySubscription.js +16 -46
  75. package/lib/react-native/LocalDatastore.js +6 -0
  76. package/lib/react-native/ObjectStateMutations.js +3 -1
  77. package/lib/react-native/OfflineQuery.js +1 -1
  78. package/lib/react-native/Parse.js +127 -90
  79. package/lib/react-native/ParseCLP.js +2 -2
  80. package/lib/react-native/ParseError.js +8 -1
  81. package/lib/react-native/ParseFile.js +1 -0
  82. package/lib/react-native/ParseLiveQuery.js +39 -11
  83. package/lib/react-native/ParseQuery.js +37 -17
  84. package/lib/react-native/ParseSchema.js +14 -1
  85. package/lib/react-native/ParseUser.js +74 -6
  86. package/lib/react-native/Storage.js +6 -0
  87. package/lib/weapp/AnonymousUtils.js +1 -1
  88. package/lib/weapp/Cloud.js +4 -2
  89. package/lib/weapp/CoreManager.js +31 -4
  90. package/lib/weapp/EventEmitter.js +7 -2
  91. package/lib/weapp/EventuallyQueue.js +24 -4
  92. package/lib/weapp/LiveQueryClient.js +59 -89
  93. package/lib/weapp/LiveQuerySubscription.js +16 -51
  94. package/lib/weapp/LocalDatastore.js +10 -1
  95. package/lib/weapp/LocalDatastoreController.js +3 -1
  96. package/lib/weapp/ObjectStateMutations.js +17 -2
  97. package/lib/weapp/OfflineQuery.js +1 -1
  98. package/lib/weapp/Parse.js +170 -134
  99. package/lib/weapp/ParseACL.js +2 -1
  100. package/lib/weapp/ParseCLP.js +6 -1
  101. package/lib/weapp/ParseConfig.js +1 -0
  102. package/lib/weapp/ParseError.js +12 -1
  103. package/lib/weapp/ParseFile.js +5 -1
  104. package/lib/weapp/ParseInstallation.js +4 -1
  105. package/lib/weapp/ParseLiveQuery.js +79 -51
  106. package/lib/weapp/ParseObject.js +11 -8
  107. package/lib/weapp/ParseOp.js +3 -1
  108. package/lib/weapp/ParseQuery.js +122 -72
  109. package/lib/weapp/ParseRole.js +5 -1
  110. package/lib/weapp/ParseSchema.js +23 -2
  111. package/lib/weapp/ParseSession.js +1 -1
  112. package/lib/weapp/ParseUser.js +107 -9
  113. package/lib/weapp/Push.js +8 -2
  114. package/lib/weapp/RESTController.js +20 -0
  115. package/lib/weapp/SingleInstanceStateController.js +6 -1
  116. package/lib/weapp/Storage.js +7 -0
  117. package/lib/weapp/TaskQueue.js +4 -0
  118. package/lib/weapp/UniqueInstanceStateController.js +3 -1
  119. package/lib/weapp/unsavedChildren.js +4 -1
  120. package/package.json +29 -25
@@ -15,8 +15,8 @@ function _interopRequireDefault(obj) {
15
15
  /**
16
16
  * @flow
17
17
  */
18
-
19
- const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
18
+ /*:: import type { PermissionsMap } from './ParseCLP';*/
19
+ const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
20
20
  /*:: type FieldOptions = {
21
21
  required: boolean,
22
22
  defaultValue: mixed,
@@ -226,6 +226,14 @@ class ParseSchema {
226
226
  };
227
227
  }
228
228
  }
229
+ if (type === 'Bytes') {
230
+ if (options && options.defaultValue) {
231
+ fieldOptions.defaultValue = {
232
+ __type: 'Bytes',
233
+ base64: options.defaultValue
234
+ };
235
+ }
236
+ }
229
237
  this._fields[name] = fieldOptions;
230
238
  return this;
231
239
  }
@@ -285,6 +293,17 @@ class ParseSchema {
285
293
  return this.addField(name, 'Boolean', options);
286
294
  }
287
295
 
296
+ /**
297
+ * Adding Bytes Field
298
+ *
299
+ * @param {string} name Name of the field that will be created on Parse
300
+ * @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
301
+ * @returns {Parse.Schema} Returns the schema, so you can chain this call.
302
+ */
303
+ addBytes(name /*: string*/, options /*: FieldOptions*/) {
304
+ return this.addField(name, 'Bytes', options);
305
+ }
306
+
288
307
  /**
289
308
  * Adding Date Field
290
309
  *
@@ -13,10 +13,6 @@ function _interopRequireDefault(obj) {
13
13
  default: obj
14
14
  };
15
15
  }
16
- /**
17
- * @flow
18
- */
19
-
20
16
  /**
21
17
  * <p>A Parse.Session object is a local representation of a revocable session.
22
18
  * This class is a subclass of a Parse.Object, and retains the same
@@ -29,7 +25,7 @@ class ParseSession extends _ParseObject.default {
29
25
  /**
30
26
  * @param {object} attributes The initial set of data to store in the user.
31
27
  */
32
- constructor(attributes /*: ?AttributeMap*/) {
28
+ constructor(attributes /*:: ?: any*/) {
33
29
  super('_Session');
34
30
  if (attributes && typeof attributes === 'object') {
35
31
  if (!this.set(attributes || {})) {
@@ -18,7 +18,9 @@ function _interopRequireDefault(obj) {
18
18
  /**
19
19
  * @flow
20
20
  */
21
-
21
+ /*:: import type { AttributeMap } from './ObjectStateMutations';*/
22
+ /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
23
+ /*:: export type AuthData = ?{ [key: string]: mixed };*/
22
24
  const CURRENT_USER_KEY = 'currentUser';
23
25
  let canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
24
26
  let currentUserCacheMatchesDisk = false;
@@ -108,8 +110,14 @@ class ParseUser extends _ParseObject.default {
108
110
  throw new Error('Invalid type: authData field should be an object');
109
111
  }
110
112
  authData[authType] = options.authData;
113
+ const oldAnonymousData = authData.anonymous;
114
+ this.stripAnonymity();
111
115
  const controller = _CoreManager.default.getUserController();
112
- return controller.linkWith(this, authData, saveOpts);
116
+ return controller.linkWith(this, authData, saveOpts).catch(e => {
117
+ delete authData[authType];
118
+ this.restoreAnonimity(oldAnonymousData);
119
+ throw e;
120
+ });
113
121
  } else {
114
122
  return new Promise((resolve, reject) => {
115
123
  provider.authenticate({
@@ -298,6 +306,19 @@ class ParseUser extends _ParseObject.default {
298
306
  const current = await ParseUser.currentAsync();
299
307
  return !!current && current.id === this.id;
300
308
  }
309
+ stripAnonymity() {
310
+ const authData = this.get('authData');
311
+ if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
312
+ // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
313
+ authData.anonymous = null;
314
+ }
315
+ }
316
+ restoreAnonimity(anonymousData /*: any*/) {
317
+ if (anonymousData) {
318
+ const authData = this.get('authData');
319
+ authData.anonymous = anonymousData;
320
+ }
321
+ }
301
322
 
302
323
  /**
303
324
  * Returns get("username").
@@ -318,12 +339,7 @@ class ParseUser extends _ParseObject.default {
318
339
  * @param {string} username
319
340
  */
320
341
  setUsername(username /*: string*/) {
321
- // Strip anonymity
322
- const authData = this.get('authData');
323
- if (authData && typeof authData === 'object' && authData.hasOwnProperty('anonymous')) {
324
- // We need to set anonymous to null instead of deleting it in order to remove it from Parse.
325
- authData.anonymous = null;
326
- }
342
+ this.stripAnonymity();
327
343
  this.set('username', username);
328
344
  }
329
345
 
@@ -438,6 +454,9 @@ class ParseUser extends _ParseObject.default {
438
454
  if (options.hasOwnProperty('usePost')) {
439
455
  loginOptions.usePost = options.usePost;
440
456
  }
457
+ if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
458
+ loginOptions.context = options.context;
459
+ }
441
460
  const controller = _CoreManager.default.getUserController();
442
461
  return controller.logIn(this, loginOptions);
443
462
  }
@@ -636,6 +655,57 @@ class ParseUser extends _ParseObject.default {
636
655
  return user.logIn(options);
637
656
  }
638
657
 
658
+ /**
659
+ * Logs in a user with a username (or email) and password, and authData. On success, this
660
+ * saves the session to disk, so you can retrieve the currently logged in
661
+ * user using <code>current</code>.
662
+ *
663
+ * @param {string} username The username (or email) to log in with.
664
+ * @param {string} password The password to log in with.
665
+ * @param {object} authData The authData to log in with.
666
+ * @param {object} options
667
+ * @static
668
+ * @returns {Promise} A promise that is fulfilled with the user when
669
+ * the login completes.
670
+ */
671
+ static logInWithAdditionalAuth(username /*: string*/, password /*: string*/, authData /*: AuthData*/, options /*:: ?: FullOptions*/) {
672
+ if (typeof username !== 'string') {
673
+ return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
674
+ }
675
+ if (typeof password !== 'string') {
676
+ return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
677
+ }
678
+ if (Object.prototype.toString.call(authData) !== '[object Object]') {
679
+ return Promise.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Auth must be an object.'));
680
+ }
681
+ const user = new this();
682
+ user._finishFetch({
683
+ username: username,
684
+ password: password,
685
+ authData
686
+ });
687
+ return user.logIn(options);
688
+ }
689
+
690
+ /**
691
+ * Logs in a user with an objectId. On success, this saves the session
692
+ * to disk, so you can retrieve the currently logged in user using
693
+ * <code>current</code>.
694
+ *
695
+ * @param {string} userId The objectId for the user.
696
+ * @static
697
+ * @returns {Promise} A promise that is fulfilled with the user when
698
+ * the login completes.
699
+ */
700
+ static loginAs(userId /*: string*/) {
701
+ if (!userId) {
702
+ throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
703
+ }
704
+ const controller = _CoreManager.default.getUserController();
705
+ const user = new this();
706
+ return controller.loginAs(user, userId);
707
+ }
708
+
639
709
  /**
640
710
  * Logs in a user with a session token. On success, this saves the session
641
711
  * to disk, so you can retrieve the currently logged in user using
@@ -1028,7 +1098,8 @@ const DefaultController = {
1028
1098
  const stateController = _CoreManager.default.getObjectStateController();
1029
1099
  const auth = {
1030
1100
  username: user.get('username'),
1031
- password: user.get('password')
1101
+ password: user.get('password'),
1102
+ authData: user.get('authData')
1032
1103
  };
1033
1104
  return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(response => {
1034
1105
  user._migrateId(response.objectId);
@@ -1044,6 +1115,21 @@ const DefaultController = {
1044
1115
  return DefaultController.setCurrentUser(user);
1045
1116
  });
1046
1117
  },
1118
+ loginAs(user /*: ParseUser*/, userId /*: string*/) /*: Promise<ParseUser>*/{
1119
+ const RESTController = _CoreManager.default.getRESTController();
1120
+ return RESTController.request('POST', 'loginAs', {
1121
+ userId
1122
+ }, {
1123
+ useMasterKey: true
1124
+ }).then(response => {
1125
+ user._finishFetch(response);
1126
+ user._setExisted(true);
1127
+ if (!canUseCurrentUser) {
1128
+ return Promise.resolve(user);
1129
+ }
1130
+ return DefaultController.setCurrentUser(user);
1131
+ });
1132
+ },
1047
1133
  become(user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
1048
1134
  const RESTController = _CoreManager.default.getRESTController();
1049
1135
  return RESTController.request('GET', 'users/me', {}, options).then(response => {
package/lib/node/Push.js CHANGED
@@ -15,7 +15,14 @@ function _interopRequireDefault(obj) {
15
15
  /**
16
16
  * @flow
17
17
  */
18
-
18
+ /*:: import type { WhereClause } from './ParseQuery';*/
19
+ /*:: import type { FullOptions } from './RESTController';*/
20
+ /*:: export type PushData = {
21
+ where?: WhereClause | ParseQuery,
22
+ push_time?: Date | string,
23
+ expiration_time?: Date | string,
24
+ expiration_interval?: number,
25
+ };*/
19
26
  /**
20
27
  * Contains functions to deal with Push in Parse.
21
28
  *
@@ -23,7 +30,6 @@ function _interopRequireDefault(obj) {
23
30
  * @static
24
31
  * @hideconstructor
25
32
  */
26
-
27
33
  /**
28
34
  * Sends a push notification.
29
35
  * **Available in Cloud Code only.**
@@ -13,6 +13,26 @@ function _interopRequireDefault(obj) {
13
13
  */
14
14
  /* global XMLHttpRequest, XDomainRequest */
15
15
  const uuidv4 = require('./uuid');
16
+ /*:: export type RequestOptions = {
17
+ useMasterKey?: boolean,
18
+ sessionToken?: string,
19
+ installationId?: string,
20
+ returnStatus?: boolean,
21
+ batchSize?: number,
22
+ include?: any,
23
+ progress?: any,
24
+ context?: any,
25
+ usePost?: boolean,
26
+ };*/
27
+ /*:: export type FullOptions = {
28
+ success?: any,
29
+ error?: any,
30
+ useMasterKey?: boolean,
31
+ sessionToken?: string,
32
+ installationId?: string,
33
+ progress?: any,
34
+ usePost?: boolean,
35
+ };*/
16
36
  let XHR = null;
17
37
  if (typeof XMLHttpRequest !== 'undefined') {
18
38
  XHR = XMLHttpRequest;
@@ -63,7 +63,12 @@ function _interopRequireWildcard(obj, nodeInterop) {
63
63
  /**
64
64
  * @flow
65
65
  */
66
-
66
+ /*:: import type { Op } from './ParseOp';*/
67
+ /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
68
+ /*:: type ObjectIdentifier = {
69
+ className: string,
70
+ id: string,
71
+ };*/
67
72
  let objectState
68
73
  /*: {
69
74
  [className: string]: {
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
3
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
4
8
  function _interopRequireDefault(obj) {
5
9
  return obj && obj.__esModule ? obj : {
@@ -91,4 +95,6 @@ const Storage = {
91
95
  }
92
96
  };
93
97
  module.exports = Storage;
98
+ var _default = Storage;
99
+ exports.default = _default;
94
100
  _CoreManager.default.setStorageController(require('./StorageController.default'));
@@ -4,7 +4,10 @@ var _promiseUtils = require("./promiseUtils");
4
4
  /**
5
5
  * @flow
6
6
  */
7
-
7
+ /*:: type Task = {
8
+ task: () => Promise,
9
+ _completion: Promise,
10
+ };*/
8
11
  class TaskQueue {
9
12
  /*:: queue: Array<Task>;*/
10
13
  constructor() {
@@ -69,7 +69,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
69
69
  /**
70
70
  * @flow
71
71
  */
72
-
72
+ /*:: import type { Op } from './ParseOp';*/
73
+ /*:: import type ParseObject from './ParseObject';*/
74
+ /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
73
75
  let objectState = new WeakMap();
74
76
  function getState(obj /*: ParseObject*/) /*: ?State*/{
75
77
  const classData = objectState.get(obj);
@@ -15,7 +15,10 @@ function _interopRequireDefault(obj) {
15
15
  /**
16
16
  * @flow
17
17
  */
18
-
18
+ /*:: type EncounterMap = {
19
+ objects: { [identifier: string]: ParseObject | boolean },
20
+ files: Array<ParseFile>,
21
+ };*/
19
22
  /**
20
23
  * Return an array of unsaved children, which are either Parse Objects or Files.
21
24
  * If it encounters any dirty Objects without Ids, it will throw an exception.
@@ -24,6 +24,9 @@ function run(name, data, options) {
24
24
  if (options.sessionToken) {
25
25
  requestOptions.sessionToken = options.sessionToken;
26
26
  }
27
+ if (options.installationId) {
28
+ requestOptions.installationId = options.installationId;
29
+ }
27
30
  if (options.context && typeof options.context === 'object') {
28
31
  requestOptions.context = options.context;
29
32
  }
@@ -1,3 +1,7 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.default = void 0;
1
5
  var config = {
2
6
  IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
3
7
  REQUEST_ATTEMPT_LIMIT: 5,
@@ -8,7 +12,7 @@ var config = {
8
12
  SERVER_AUTH_TOKEN: null,
9
13
  LIVEQUERY_SERVER_URL: null,
10
14
  ENCRYPTED_KEY: null,
11
- VERSION: 'js' + "4.1.0",
15
+ VERSION: 'js' + "4.2.0-alpha.10",
12
16
  APPLICATION_ID: null,
13
17
  JAVASCRIPT_KEY: null,
14
18
  MASTER_KEY: null,
@@ -17,7 +21,8 @@ var config = {
17
21
  FORCE_REVOCABLE_SESSION: false,
18
22
  ENCRYPTED_USER: false,
19
23
  IDEMPOTENCY: false,
20
- ALLOW_CUSTOM_OBJECT_ID: false
24
+ ALLOW_CUSTOM_OBJECT_ID: false,
25
+ PARSE_ERRORS: []
21
26
  };
22
27
  function requireMethods(name, methods, controller) {
23
28
  methods.forEach(function (func) {
@@ -26,7 +31,7 @@ function requireMethods(name, methods, controller) {
26
31
  }
27
32
  });
28
33
  }
29
- module.exports = {
34
+ var CoreManager = {
30
35
  get: function (key) {
31
36
  if (config.hasOwnProperty(key)) {
32
37
  return config[key];
@@ -36,6 +41,12 @@ module.exports = {
36
41
  set: function (key, value) {
37
42
  config[key] = value;
38
43
  },
44
+ setIfNeeded: function (key, value) {
45
+ if (!config.hasOwnProperty(key)) {
46
+ config[key] = value;
47
+ }
48
+ return config[key];
49
+ },
39
50
  setAnalyticsController: function (controller) {
40
51
  requireMethods('AnalyticsController', ['track'], controller);
41
52
  config['AnalyticsController'] = controller;
@@ -64,6 +75,12 @@ module.exports = {
64
75
  getCryptoController: function () {
65
76
  return config['CryptoController'];
66
77
  },
78
+ setEventEmitter: function (eventEmitter) {
79
+ config['EventEmitter'] = eventEmitter;
80
+ },
81
+ getEventEmitter: function () {
82
+ return config['EventEmitter'];
83
+ },
67
84
  setFileController: function (controller) {
68
85
  requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
69
86
  config['FileController'] = controller;
@@ -78,6 +95,12 @@ module.exports = {
78
95
  getInstallationController: function () {
79
96
  return config['InstallationController'];
80
97
  },
98
+ setLiveQuery: function (liveQuery) {
99
+ config['LiveQuery'] = liveQuery;
100
+ },
101
+ getLiveQuery: function () {
102
+ return config['LiveQuery'];
103
+ },
81
104
  setObjectController: function (controller) {
82
105
  requireMethods('ObjectController', ['save', 'fetch', 'destroy'], controller);
83
106
  config['ObjectController'] = controller;
@@ -184,4 +207,7 @@ module.exports = {
184
207
  getHooksController: function () {
185
208
  return config['HooksController'];
186
209
  }
187
- };
210
+ };
211
+ module.exports = CoreManager;
212
+ var _default = CoreManager;
213
+ exports.default = _default;
@@ -1,6 +1,9 @@
1
- var EventEmitter = require('../../../react-native/Libraries/vendor/emitter/EventEmitter');
2
- if (EventEmitter.default) {
3
- EventEmitter = EventEmitter.default;
4
- }
5
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
1
+ var EventEmitter;
2
+ try {
3
+ EventEmitter = require('react-native/Libraries/vendor/emitter/EventEmitter');
4
+ if (EventEmitter.default) {
5
+ EventEmitter = EventEmitter.default;
6
+ }
7
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
8
+ } catch (_) {}
6
9
  module.exports = EventEmitter;
@@ -1,7 +1,12 @@
1
1
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ exports.default = void 0;
2
6
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
3
7
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
4
8
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
9
+ var _ParseError = _interopRequireDefault(require("./ParseError"));
5
10
  var _ParseObject = _interopRequireDefault(require("./ParseObject"));
6
11
  var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
7
12
  var _Storage = _interopRequireDefault(require("./Storage"));
@@ -155,7 +160,7 @@ var EventuallyQueue = {
155
160
  yield object.save(queueObject.object, queueObject.serverOptions);
156
161
  yield this.remove(queueObject.queueId);
157
162
  } catch (e) {
158
- if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
163
+ if (e.code !== _ParseError.default.CONNECTION_FAILED) {
159
164
  yield this.remove(queueObject.queueId);
160
165
  }
161
166
  }
@@ -165,7 +170,7 @@ var EventuallyQueue = {
165
170
  yield object.destroy(queueObject.serverOptions);
166
171
  yield this.remove(queueObject.queueId);
167
172
  } catch (e) {
168
- if (e.message !== 'XMLHttpRequest failed: "Unable to connect to the Parse API"') {
173
+ if (e.code !== _ParseError.default.CONNECTION_FAILED) {
169
174
  yield this.remove(queueObject.queueId);
170
175
  }
171
176
  }
@@ -246,4 +251,6 @@ var EventuallyQueue = {
246
251
  }()
247
252
  }
248
253
  };
249
- module.exports = EventuallyQueue;
254
+ module.exports = EventuallyQueue;
255
+ var _default = EventuallyQueue;
256
+ exports.default = _default;