parse 5.1.1-alpha.1 → 5.2.0-alpha.2

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 (249) hide show
  1. package/dist/parse.js +10186 -14918
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +10180 -15057
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/Analytics.js +7 -11
  6. package/lib/browser/AnonymousUtils.js +17 -22
  7. package/lib/browser/Cloud.js +24 -46
  8. package/lib/browser/CoreManager.js +71 -79
  9. package/lib/browser/CryptoController.js +14 -9
  10. package/lib/browser/EventEmitter.js +9 -2
  11. package/lib/browser/EventuallyQueue.js +156 -357
  12. package/lib/browser/FacebookUtils.js +23 -28
  13. package/lib/browser/IndexedDBStorageController.js +18 -14
  14. package/lib/browser/InstallationController.js +55 -121
  15. package/lib/browser/LiveQueryClient.js +312 -446
  16. package/lib/browser/LiveQuerySubscription.js +25 -28
  17. package/lib/browser/LocalDatastore.js +254 -578
  18. package/lib/browser/LocalDatastoreController.default.js +48 -227
  19. package/lib/browser/LocalDatastoreController.js +11 -1
  20. package/lib/browser/LocalDatastoreController.react-native.js +72 -164
  21. package/lib/browser/LocalDatastoreUtils.js +4 -12
  22. package/lib/browser/ObjectStateMutations.js +89 -95
  23. package/lib/browser/OfflineQuery.js +106 -198
  24. package/lib/browser/Parse.js +45 -61
  25. package/lib/browser/ParseACL.js +242 -288
  26. package/lib/browser/ParseCLP.js +372 -580
  27. package/lib/browser/ParseConfig.js +115 -138
  28. package/lib/browser/ParseError.js +85 -182
  29. package/lib/browser/ParseFile.js +296 -444
  30. package/lib/browser/ParseGeoPoint.js +121 -140
  31. package/lib/browser/ParseHooks.js +12 -14
  32. package/lib/browser/ParseInstallation.js +226 -354
  33. package/lib/browser/ParseLiveQuery.js +74 -148
  34. package/lib/browser/ParseObject.js +2017 -2622
  35. package/lib/browser/ParseOp.js +343 -484
  36. package/lib/browser/ParsePolygon.js +101 -120
  37. package/lib/browser/ParseQuery.js +1722 -2068
  38. package/lib/browser/ParseRelation.js +99 -118
  39. package/lib/browser/ParseRole.js +88 -144
  40. package/lib/browser/ParseSchema.js +372 -434
  41. package/lib/browser/ParseSession.js +62 -110
  42. package/lib/browser/ParseUser.js +942 -1270
  43. package/lib/browser/Push.js +16 -44
  44. package/lib/browser/RESTController.js +85 -124
  45. package/lib/browser/SingleInstanceStateController.js +57 -86
  46. package/lib/browser/Socket.weapp.js +50 -33
  47. package/lib/browser/Storage.js +23 -28
  48. package/lib/browser/StorageController.browser.js +16 -13
  49. package/lib/browser/StorageController.default.js +15 -14
  50. package/lib/browser/StorageController.js +14 -1
  51. package/lib/browser/StorageController.react-native.js +31 -30
  52. package/lib/browser/StorageController.weapp.js +19 -13
  53. package/lib/browser/TaskQueue.js +37 -49
  54. package/lib/browser/UniqueInstanceStateController.js +65 -86
  55. package/lib/browser/WebSocketController.js +11 -4
  56. package/lib/browser/Xhr.weapp.js +90 -78
  57. package/lib/browser/arrayContainsObject.js +3 -3
  58. package/lib/browser/canBeSerialized.js +10 -11
  59. package/lib/browser/decode.js +11 -11
  60. package/lib/browser/encode.js +11 -11
  61. package/lib/browser/equals.js +9 -10
  62. package/lib/browser/escape.js +2 -2
  63. package/lib/browser/isRevocableSession.js +1 -1
  64. package/lib/browser/parseDate.js +10 -10
  65. package/lib/browser/promiseUtils.js +19 -19
  66. package/lib/browser/unique.js +4 -4
  67. package/lib/browser/unsavedChildren.js +20 -21
  68. package/lib/browser/uuid.js +2 -4
  69. package/lib/node/Analytics.js +2 -6
  70. package/lib/node/AnonymousUtils.js +7 -12
  71. package/lib/node/Cloud.js +8 -12
  72. package/lib/node/CoreManager.js +59 -67
  73. package/lib/node/CryptoController.js +8 -3
  74. package/lib/node/EventEmitter.js +7 -1
  75. package/lib/node/EventuallyQueue.js +18 -37
  76. package/lib/node/FacebookUtils.js +1 -5
  77. package/lib/node/IndexedDBStorageController.js +14 -10
  78. package/lib/node/InstallationController.js +7 -8
  79. package/lib/node/LiveQueryClient.js +20 -32
  80. package/lib/node/LiveQuerySubscription.js +3 -4
  81. package/lib/node/LocalDatastore.js +20 -24
  82. package/lib/node/LocalDatastoreController.default.js +12 -11
  83. package/lib/node/LocalDatastoreController.js +14 -1
  84. package/lib/node/LocalDatastoreController.react-native.js +27 -22
  85. package/lib/node/LocalDatastoreUtils.js +4 -12
  86. package/lib/node/ObjectStateMutations.js +52 -36
  87. package/lib/node/OfflineQuery.js +37 -23
  88. package/lib/node/Parse.js +35 -49
  89. package/lib/node/ParseACL.js +18 -27
  90. package/lib/node/ParseCLP.js +38 -50
  91. package/lib/node/ParseConfig.js +7 -14
  92. package/lib/node/ParseError.js +457 -458
  93. package/lib/node/ParseFile.js +33 -66
  94. package/lib/node/ParseGeoPoint.js +22 -17
  95. package/lib/node/ParseHooks.js +0 -2
  96. package/lib/node/ParseInstallation.js +21 -8
  97. package/lib/node/ParseLiveQuery.js +6 -11
  98. package/lib/node/ParseObject.js +138 -167
  99. package/lib/node/ParseOp.js +32 -44
  100. package/lib/node/ParsePolygon.js +11 -17
  101. package/lib/node/ParseQuery.js +118 -164
  102. package/lib/node/ParseRelation.js +7 -16
  103. package/lib/node/ParseRole.js +7 -13
  104. package/lib/node/ParseSchema.js +26 -39
  105. package/lib/node/ParseSession.js +7 -8
  106. package/lib/node/ParseUser.js +70 -76
  107. package/lib/node/Push.js +5 -15
  108. package/lib/node/RESTController.js +21 -33
  109. package/lib/node/SingleInstanceStateController.js +41 -69
  110. package/lib/node/Socket.weapp.js +23 -2
  111. package/lib/node/Storage.js +11 -16
  112. package/lib/node/StorageController.browser.js +10 -8
  113. package/lib/node/StorageController.default.js +9 -9
  114. package/lib/node/StorageController.js +16 -1
  115. package/lib/node/StorageController.react-native.js +17 -17
  116. package/lib/node/StorageController.weapp.js +14 -8
  117. package/lib/node/TaskQueue.js +8 -11
  118. package/lib/node/UniqueInstanceStateController.js +40 -60
  119. package/lib/node/WebSocketController.js +15 -2
  120. package/lib/node/Xhr.weapp.js +11 -2
  121. package/lib/node/arrayContainsObject.js +1 -1
  122. package/lib/node/canBeSerialized.js +2 -2
  123. package/lib/node/decode.js +1 -1
  124. package/lib/node/encode.js +2 -2
  125. package/lib/node/equals.js +1 -1
  126. package/lib/node/escape.js +1 -1
  127. package/lib/node/isRevocableSession.js +1 -1
  128. package/lib/node/parseDate.js +1 -1
  129. package/lib/node/promiseUtils.js +7 -7
  130. package/lib/node/unique.js +2 -2
  131. package/lib/node/unsavedChildren.js +2 -2
  132. package/lib/node/uuid.js +2 -4
  133. package/lib/react-native/Analytics.js +2 -2
  134. package/lib/react-native/AnonymousUtils.js +3 -4
  135. package/lib/react-native/Cloud.js +0 -1
  136. package/lib/react-native/CoreManager.js +2 -3
  137. package/lib/react-native/CryptoController.js +6 -1
  138. package/lib/react-native/EventEmitter.js +6 -1
  139. package/lib/react-native/EventuallyQueue.js +1 -2
  140. package/lib/react-native/FacebookUtils.js +1 -2
  141. package/lib/react-native/IndexedDBStorageController.js +11 -5
  142. package/lib/react-native/InstallationController.js +1 -2
  143. package/lib/react-native/LiveQueryClient.js +51 -36
  144. package/lib/react-native/LiveQuerySubscription.js +2 -4
  145. package/lib/react-native/LocalDatastore.js +41 -17
  146. package/lib/react-native/LocalDatastoreController.default.js +6 -1
  147. package/lib/react-native/LocalDatastoreController.js +11 -1
  148. package/lib/react-native/LocalDatastoreController.react-native.js +16 -11
  149. package/lib/react-native/LocalDatastoreUtils.js +3 -6
  150. package/lib/react-native/ObjectStateMutations.js +30 -9
  151. package/lib/react-native/OfflineQuery.js +25 -20
  152. package/lib/react-native/Parse.js +24 -38
  153. package/lib/react-native/ParseACL.js +4 -6
  154. package/lib/react-native/ParseCLP.js +5 -7
  155. package/lib/react-native/ParseConfig.js +4 -6
  156. package/lib/react-native/ParseError.js +13 -31
  157. package/lib/react-native/ParseFile.js +10 -10
  158. package/lib/react-native/ParseGeoPoint.js +2 -4
  159. package/lib/react-native/ParseInstallation.js +13 -30
  160. package/lib/react-native/ParseLiveQuery.js +2 -4
  161. package/lib/react-native/ParseObject.js +81 -90
  162. package/lib/react-native/ParseOp.js +41 -79
  163. package/lib/react-native/ParsePolygon.js +2 -4
  164. package/lib/react-native/ParseQuery.js +87 -81
  165. package/lib/react-native/ParseRelation.js +2 -4
  166. package/lib/react-native/ParseRole.js +14 -31
  167. package/lib/react-native/ParseSchema.js +3 -5
  168. package/lib/react-native/ParseSession.js +12 -29
  169. package/lib/react-native/ParseUser.js +32 -51
  170. package/lib/react-native/RESTController.js +10 -4
  171. package/lib/react-native/SingleInstanceStateController.js +23 -37
  172. package/lib/react-native/Socket.weapp.js +9 -4
  173. package/lib/react-native/Storage.js +1 -2
  174. package/lib/react-native/StorageController.browser.js +6 -1
  175. package/lib/react-native/StorageController.default.js +6 -1
  176. package/lib/react-native/StorageController.js +13 -1
  177. package/lib/react-native/StorageController.react-native.js +11 -6
  178. package/lib/react-native/StorageController.weapp.js +6 -1
  179. package/lib/react-native/TaskQueue.js +8 -4
  180. package/lib/react-native/UniqueInstanceStateController.js +23 -37
  181. package/lib/react-native/WebSocketController.js +9 -1
  182. package/lib/react-native/Xhr.weapp.js +9 -4
  183. package/lib/react-native/unsavedChildren.js +3 -3
  184. package/lib/react-native/uuid.js +1 -2
  185. package/lib/weapp/Analytics.js +7 -11
  186. package/lib/weapp/AnonymousUtils.js +17 -22
  187. package/lib/weapp/Cloud.js +24 -46
  188. package/lib/weapp/CoreManager.js +71 -79
  189. package/lib/weapp/CryptoController.js +14 -9
  190. package/lib/weapp/EventEmitter.js +9 -2
  191. package/lib/weapp/EventuallyQueue.js +156 -357
  192. package/lib/weapp/FacebookUtils.js +23 -28
  193. package/lib/weapp/IndexedDBStorageController.js +18 -14
  194. package/lib/weapp/InstallationController.js +55 -121
  195. package/lib/weapp/LiveQueryClient.js +312 -446
  196. package/lib/weapp/LiveQuerySubscription.js +25 -28
  197. package/lib/weapp/LocalDatastore.js +254 -578
  198. package/lib/weapp/LocalDatastoreController.default.js +48 -227
  199. package/lib/weapp/LocalDatastoreController.js +11 -1
  200. package/lib/weapp/LocalDatastoreController.react-native.js +72 -164
  201. package/lib/weapp/LocalDatastoreUtils.js +4 -12
  202. package/lib/weapp/ObjectStateMutations.js +89 -95
  203. package/lib/weapp/OfflineQuery.js +106 -198
  204. package/lib/weapp/Parse.js +45 -60
  205. package/lib/weapp/ParseACL.js +242 -288
  206. package/lib/weapp/ParseCLP.js +372 -580
  207. package/lib/weapp/ParseConfig.js +115 -138
  208. package/lib/weapp/ParseError.js +85 -182
  209. package/lib/weapp/ParseFile.js +297 -446
  210. package/lib/weapp/ParseGeoPoint.js +121 -140
  211. package/lib/weapp/ParseHooks.js +12 -14
  212. package/lib/weapp/ParseInstallation.js +226 -354
  213. package/lib/weapp/ParseLiveQuery.js +74 -148
  214. package/lib/weapp/ParseObject.js +2017 -2622
  215. package/lib/weapp/ParseOp.js +343 -484
  216. package/lib/weapp/ParsePolygon.js +101 -120
  217. package/lib/weapp/ParseQuery.js +1722 -2068
  218. package/lib/weapp/ParseRelation.js +99 -118
  219. package/lib/weapp/ParseRole.js +88 -144
  220. package/lib/weapp/ParseSchema.js +372 -434
  221. package/lib/weapp/ParseSession.js +62 -110
  222. package/lib/weapp/ParseUser.js +942 -1270
  223. package/lib/weapp/Push.js +16 -44
  224. package/lib/weapp/RESTController.js +86 -125
  225. package/lib/weapp/SingleInstanceStateController.js +57 -86
  226. package/lib/weapp/Socket.weapp.js +50 -33
  227. package/lib/weapp/Storage.js +23 -28
  228. package/lib/weapp/StorageController.browser.js +16 -13
  229. package/lib/weapp/StorageController.default.js +15 -14
  230. package/lib/weapp/StorageController.js +14 -1
  231. package/lib/weapp/StorageController.react-native.js +31 -30
  232. package/lib/weapp/StorageController.weapp.js +19 -13
  233. package/lib/weapp/TaskQueue.js +37 -49
  234. package/lib/weapp/UniqueInstanceStateController.js +65 -86
  235. package/lib/weapp/WebSocketController.js +11 -4
  236. package/lib/weapp/Xhr.weapp.js +90 -78
  237. package/lib/weapp/arrayContainsObject.js +3 -3
  238. package/lib/weapp/canBeSerialized.js +10 -11
  239. package/lib/weapp/decode.js +11 -11
  240. package/lib/weapp/encode.js +11 -11
  241. package/lib/weapp/equals.js +9 -10
  242. package/lib/weapp/escape.js +2 -2
  243. package/lib/weapp/isRevocableSession.js +1 -1
  244. package/lib/weapp/parseDate.js +10 -10
  245. package/lib/weapp/promiseUtils.js +19 -19
  246. package/lib/weapp/unique.js +4 -4
  247. package/lib/weapp/unsavedChildren.js +20 -21
  248. package/lib/weapp/uuid.js +6 -8
  249. package/package.json +23 -30
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
5
  _Object$defineProperty(exports, "__esModule", {
@@ -8,45 +7,10 @@ _Object$defineProperty(exports, "__esModule", {
8
7
  });
9
8
  exports.default = void 0;
10
9
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
11
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
13
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
14
- var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
15
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
17
- var _get2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/get"));
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
19
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
21
10
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
22
11
  var _ParseError = _interopRequireDefault(require("./ParseError"));
23
- var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
24
- function _createSuper(Derived) {
25
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
26
- return function () {
27
- var Super = (0, _getPrototypeOf2.default)(Derived),
28
- result;
29
- if (hasNativeReflectConstruct) {
30
- var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
31
- result = _Reflect$construct(Super, arguments, NewTarget);
32
- } else {
33
- result = Super.apply(this, arguments);
34
- }
35
- return (0, _possibleConstructorReturn2.default)(this, result);
36
- };
37
- }
38
- function _isNativeReflectConstruct() {
39
- if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
40
- if (_Reflect$construct.sham) return false;
41
- if (typeof Proxy === "function") return true;
42
- try {
43
- Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
44
- return true;
45
- } catch (e) {
46
- return false;
47
- }
48
- }
49
- var DEVICE_TYPES /*: DeviceInterface*/ = {
12
+ var _ParseObject = _interopRequireDefault(require("./ParseObject"));
13
+ const DEVICE_TYPES = {
50
14
  IOS: 'ios',
51
15
  MACOS: 'macos',
52
16
  TVOS: 'tvos',
@@ -66,22 +30,17 @@ var DEVICE_TYPES /*: DeviceInterface*/ = {
66
30
  *
67
31
  * @alias Parse.Installation
68
32
  */
69
- var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
70
- (0, _inherits2.default)(ParseInstallation, _ParseObject);
71
- var _super = _createSuper(ParseInstallation);
33
+ class ParseInstallation extends _ParseObject.default {
72
34
  /**
73
35
  * @param {object} attributes The initial set of data to store in the object.
74
36
  */
75
- function ParseInstallation(attributes /*:: ?: AttributeMap*/) {
76
- var _this;
77
- (0, _classCallCheck2.default)(this, ParseInstallation);
78
- _this = _super.call(this, '_Installation');
79
- if (attributes && (0, _typeof2.default)(attributes) === 'object') {
80
- if (!_this.set(attributes)) {
37
+ constructor(attributes) {
38
+ super('_Installation');
39
+ if (attributes && typeof attributes === 'object') {
40
+ if (!this.set(attributes)) {
81
41
  throw new Error("Can't create an invalid Installation");
82
42
  }
83
43
  }
84
- return _this;
85
44
  }
86
45
 
87
46
  /**
@@ -89,329 +48,242 @@ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
89
48
  *
90
49
  * @property {string} appIdentifier
91
50
  * @static
51
+ * @returns {string}
92
52
  */
93
- (0, _createClass2.default)(ParseInstallation, [{
94
- key: "appIdentifier",
95
- get: function () {
96
- return this.get('appIdentifier');
97
- }
53
+ get appIdentifier() {
54
+ return this.get('appIdentifier');
55
+ }
98
56
 
99
- /**
100
- * The version string of the client application to which this installation belongs.
101
- *
102
- * @property {string} appVersion
103
- * @static
104
- */
105
- }, {
106
- key: "appVersion",
107
- get: function () {
108
- return this.get('appVersion');
109
- }
57
+ /**
58
+ * The version string of the client application to which this installation belongs.
59
+ *
60
+ * @property {string} appVersion
61
+ * @static
62
+ * @returns {string}
63
+ */
64
+ get appVersion() {
65
+ return this.get('appVersion');
66
+ }
110
67
 
111
- /**
112
- * The display name of the client application to which this installation belongs.
113
- *
114
- * @property {string} appName
115
- * @static
116
- */
117
- }, {
118
- key: "appName",
119
- get: function () {
120
- return this.get('appName');
121
- }
68
+ /**
69
+ * The display name of the client application to which this installation belongs.
70
+ *
71
+ * @property {string} appName
72
+ * @static
73
+ * @returns {string}
74
+ */
75
+ get appName() {
76
+ return this.get('appName');
77
+ }
122
78
 
123
- /**
124
- * The current value of the icon badge for iOS apps.
125
- * Changes to this value on the server will be used
126
- * for future badge-increment push notifications.
127
- *
128
- * @property {number} badge
129
- * @static
130
- */
131
- }, {
132
- key: "badge",
133
- get: function () {
134
- return this.get('badge');
135
- }
79
+ /**
80
+ * The current value of the icon badge for iOS apps.
81
+ * Changes to this value on the server will be used
82
+ * for future badge-increment push notifications.
83
+ *
84
+ * @property {number} badge
85
+ * @static
86
+ * @returns {number}
87
+ */
88
+ get badge() {
89
+ return this.get('badge');
90
+ }
136
91
 
137
- /**
138
- * An array of the channels to which a device is currently subscribed.
139
- *
140
- * @property {string[]} channels
141
- * @static
142
- */
143
- }, {
144
- key: "channels",
145
- get: function () {
146
- return this.get('channels');
147
- }
92
+ /**
93
+ * An array of the channels to which a device is currently subscribed.
94
+ *
95
+ * @property {string[]} channels
96
+ * @static
97
+ * @returns {string[]}
98
+ */
99
+ get channels() {
100
+ return this.get('channels');
101
+ }
148
102
 
149
- /**
150
- * Token used to deliver push notifications to the device.
151
- *
152
- * @property {string} deviceToken
153
- * @static
154
- */
155
- }, {
156
- key: "deviceToken",
157
- get: function () {
158
- return this.get('deviceToken');
159
- }
103
+ /**
104
+ * Token used to deliver push notifications to the device.
105
+ *
106
+ * @property {string} deviceToken
107
+ * @static
108
+ * @returns {string}
109
+ */
110
+ get deviceToken() {
111
+ return this.get('deviceToken');
112
+ }
160
113
 
161
- /**
162
- * The type of device, “ios”, “android”, “web”, etc.
163
- *
164
- * @property {string} deviceType
165
- * @static
166
- */
167
- }, {
168
- key: "deviceType",
169
- get: function () {
170
- return this.get('deviceType');
171
- }
114
+ /**
115
+ * The type of device, “ios”, “android”, “web”, etc.
116
+ *
117
+ * @property {string} deviceType
118
+ * @static
119
+ * @returns {string}
120
+ */
121
+ get deviceType() {
122
+ return this.get('deviceType');
123
+ }
172
124
 
173
- /**
174
- * Gets the GCM sender identifier for this installation
175
- *
176
- * @property {string} GCMSenderId
177
- * @static
178
- */
179
- }, {
180
- key: "GCMSenderId",
181
- get: function () {
182
- return this.get('GCMSenderId');
183
- }
125
+ /**
126
+ * Gets the GCM sender identifier for this installation
127
+ *
128
+ * @property {string} GCMSenderId
129
+ * @static
130
+ * @returns {string}
131
+ */
132
+ get GCMSenderId() {
133
+ return this.get('GCMSenderId');
134
+ }
184
135
 
185
- /**
186
- * Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.
187
- *
188
- * @property {string} installationId
189
- * @static
190
- */
191
- }, {
192
- key: "installationId",
193
- get: function () {
194
- return this.get('installationId');
195
- }
136
+ /**
137
+ * Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.
138
+ *
139
+ * @property {string} installationId
140
+ * @static
141
+ * @returns {string}
142
+ */
143
+ get installationId() {
144
+ return this.get('installationId');
145
+ }
196
146
 
197
- /**
198
- * Gets the local identifier for this installation
199
- *
200
- * @property {string} localeIdentifier
201
- * @static
202
- */
203
- }, {
204
- key: "localeIdentifier",
205
- get: function () {
206
- return this.get('localeIdentifier');
207
- }
147
+ /**
148
+ * Gets the local identifier for this installation
149
+ *
150
+ * @property {string} localeIdentifier
151
+ * @static
152
+ * @returns {string}
153
+ */
154
+ get localeIdentifier() {
155
+ return this.get('localeIdentifier');
156
+ }
208
157
 
209
- /**
210
- * Gets the parse server version for this installation
211
- *
212
- * @property {string} parseVersion
213
- * @static
214
- */
215
- }, {
216
- key: "parseVersion",
217
- get: function () {
218
- return this.get('parseVersion');
219
- }
158
+ /**
159
+ * Gets the parse server version for this installation
160
+ *
161
+ * @property {string} parseVersion
162
+ * @static
163
+ * @returns {string}
164
+ */
165
+ get parseVersion() {
166
+ return this.get('parseVersion');
167
+ }
220
168
 
221
- /**
222
- * This field is reserved for directing Parse to the push delivery network to be used.
223
- *
224
- * @property {string} pushType
225
- * @static
226
- */
227
- }, {
228
- key: "pushType",
229
- get: function () {
230
- return this.get('pushType');
231
- }
169
+ /**
170
+ * This field is reserved for directing Parse to the push delivery network to be used.
171
+ *
172
+ * @property {string} pushType
173
+ * @static
174
+ * @returns {string}
175
+ */
176
+ get pushType() {
177
+ return this.get('pushType');
178
+ }
232
179
 
233
- /**
234
- * Gets the time zone for this installation
235
- *
236
- * @property {string} timeZone
237
- * @static
238
- */
239
- }, {
240
- key: "timeZone",
241
- get: function () {
242
- return this.get('timeZone');
243
- }
180
+ /**
181
+ * Gets the time zone for this installation
182
+ *
183
+ * @property {string} timeZone
184
+ * @static
185
+ * @returns {string}
186
+ */
187
+ get timeZone() {
188
+ return this.get('timeZone');
189
+ }
244
190
 
245
- /**
246
- * Returns the device types for used for Push Notifications.
247
- *
248
- * <pre>
249
- * Parse.Installation.DEVICE_TYPES.IOS
250
- * Parse.Installation.DEVICE_TYPES.MACOS
251
- * Parse.Installation.DEVICE_TYPES.TVOS
252
- * Parse.Installation.DEVICE_TYPES.FCM
253
- * Parse.Installation.DEVICE_TYPES.ANDROID
254
- * Parse.Installation.DEVICE_TYPES.WEB
255
- * </pre
256
- *
257
- * @property {object} DEVICE_TYPES
258
- * @static
259
- */
260
- }, {
261
- key: "fetch",
262
- value:
263
- /**
264
- * Wrap the default fetch behavior with functionality to update local storage.
265
- * If the installation is deleted on the server, retry the fetch as a save operation.
266
- *
267
- * @param {...any} args
268
- * @returns {Promise}
269
- */
270
- function () {
271
- var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
272
- var _len,
273
- args,
274
- _key,
275
- _args = arguments;
276
- return _regenerator.default.wrap(function (_context) {
277
- while (1) switch (_context.prev = _context.next) {
278
- case 0:
279
- for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
280
- args[_key] = _args[_key];
281
- }
282
- _context.prev = 1;
283
- _context.next = 4;
284
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "fetch", this).apply(this, args);
285
- case 4:
286
- _context.next = 15;
287
- break;
288
- case 6:
289
- _context.prev = 6;
290
- _context.t0 = _context["catch"](1);
291
- if (!(_context.t0.code !== _ParseError.default.OBJECT_NOT_FOUND)) {
292
- _context.next = 10;
293
- break;
294
- }
295
- throw _context.t0;
296
- case 10:
297
- // The installation was deleted from the server.
298
- // We always want fetch to succeed.
299
- delete this.id;
300
- this._getId(); // Generate localId
301
- this._markAllFieldsDirty();
302
- _context.next = 15;
303
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
304
- case 15:
305
- _context.next = 17;
306
- return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
307
- case 17:
308
- return _context.abrupt("return", this);
309
- case 18:
310
- case "end":
311
- return _context.stop();
312
- }
313
- }, _callee, this, [[1, 6]]);
314
- }));
315
- function fetch() {
316
- return _fetch.apply(this, arguments);
317
- }
318
- return fetch;
319
- }()
320
- /**
321
- * Wrap the default save behavior with functionality to update the local storage.
322
- * If the installation is deleted on the server, retry saving a new installation.
323
- *
324
- * @param {...any} args
325
- * @returns {Promise}
326
- */
327
- }, {
328
- key: "save",
329
- value: function () {
330
- var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
331
- var _len2,
332
- args,
333
- _key2,
334
- _args2 = arguments;
335
- return _regenerator.default.wrap(function (_context2) {
336
- while (1) switch (_context2.prev = _context2.next) {
337
- case 0:
338
- for (_len2 = _args2.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
339
- args[_key2] = _args2[_key2];
340
- }
341
- _context2.prev = 1;
342
- _context2.next = 4;
343
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
344
- case 4:
345
- _context2.next = 15;
346
- break;
347
- case 6:
348
- _context2.prev = 6;
349
- _context2.t0 = _context2["catch"](1);
350
- if (!(_context2.t0.code !== _ParseError.default.OBJECT_NOT_FOUND)) {
351
- _context2.next = 10;
352
- break;
353
- }
354
- throw _context2.t0;
355
- case 10:
356
- // The installation was deleted from the server.
357
- // We always want save to succeed.
358
- delete this.id;
359
- this._getId(); // Generate localId
360
- this._markAllFieldsDirty();
361
- _context2.next = 15;
362
- return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
363
- case 15:
364
- _context2.next = 17;
365
- return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
366
- case 17:
367
- return _context2.abrupt("return", this);
368
- case 18:
369
- case "end":
370
- return _context2.stop();
371
- }
372
- }, _callee2, this, [[1, 6]]);
373
- }));
374
- function save() {
375
- return _save.apply(this, arguments);
376
- }
377
- return save;
378
- }()
379
- }, {
380
- key: "_markAllFieldsDirty",
381
- value: function () {
382
- for (var _i = 0, _Object$entries = (0, _entries.default)(this.attributes); _i < _Object$entries.length; _i++) {
383
- var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
384
- key = _Object$entries$_i[0],
385
- value = _Object$entries$_i[1];
386
- this.set(key, value);
191
+ /**
192
+ * Returns the device types for used for Push Notifications.
193
+ *
194
+ * <pre>
195
+ * Parse.Installation.DEVICE_TYPES.IOS
196
+ * Parse.Installation.DEVICE_TYPES.MACOS
197
+ * Parse.Installation.DEVICE_TYPES.TVOS
198
+ * Parse.Installation.DEVICE_TYPES.FCM
199
+ * Parse.Installation.DEVICE_TYPES.ANDROID
200
+ * Parse.Installation.DEVICE_TYPES.WEB
201
+ * </pre
202
+ *
203
+ * @property {object} DEVICE_TYPES
204
+ * @static
205
+ * @returns {object}
206
+ */
207
+ static get DEVICE_TYPES() {
208
+ return DEVICE_TYPES;
209
+ }
210
+
211
+ /**
212
+ * Wrap the default fetch behavior with functionality to update local storage.
213
+ * If the installation is deleted on the server, retry the fetch as a save operation.
214
+ *
215
+ * @param {...any} args
216
+ * @returns {Promise}
217
+ */
218
+ async fetch() {
219
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
220
+ args[_key] = arguments[_key];
221
+ }
222
+ try {
223
+ await super.fetch.apply(this, args);
224
+ } catch (e) {
225
+ if (e.code !== _ParseError.default.OBJECT_NOT_FOUND) {
226
+ throw e;
387
227
  }
228
+ // The installation was deleted from the server.
229
+ // We always want fetch to succeed.
230
+ delete this.id;
231
+ this._getId(); // Generate localId
232
+ this._markAllFieldsDirty();
233
+ await super.save.apply(this, args);
388
234
  }
235
+ await _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
236
+ return this;
237
+ }
389
238
 
390
- /**
391
- * Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
392
- *
393
- * <pre>
394
- * const installation = await Parse.Installation.currentInstallation();
395
- * installation.set('deviceToken', '123');
396
- * await installation.save();
397
- * </pre>
398
- *
399
- * @returns {Promise} A promise that resolves to the local installation object.
400
- */
401
- }], [{
402
- key: "DEVICE_TYPES",
403
- get: function () /*: DeviceInterface*/{
404
- return DEVICE_TYPES;
239
+ /**
240
+ * Wrap the default save behavior with functionality to update the local storage.
241
+ * If the installation is deleted on the server, retry saving a new installation.
242
+ *
243
+ * @param {...any} args
244
+ * @returns {Promise}
245
+ */
246
+ async save() {
247
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
248
+ args[_key2] = arguments[_key2];
405
249
  }
406
- }, {
407
- key: "currentInstallation",
408
- value: function () /*: Promise<ParseInstallation>*/{
409
- return _CoreManager.default.getInstallationController().currentInstallation();
250
+ try {
251
+ await super.save.apply(this, args);
252
+ } catch (e) {
253
+ if (e.code !== _ParseError.default.OBJECT_NOT_FOUND) {
254
+ throw e;
255
+ }
256
+ // The installation was deleted from the server.
257
+ // We always want save to succeed.
258
+ delete this.id;
259
+ this._getId(); // Generate localId
260
+ this._markAllFieldsDirty();
261
+ await super.save.apply(this, args);
410
262
  }
411
- }]);
412
- return ParseInstallation;
413
- }(_ParseObject2.default);
414
- _ParseObject2.default.registerSubclass('_Installation', ParseInstallation);
263
+ await _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
264
+ return this;
265
+ }
266
+ _markAllFieldsDirty() {
267
+ for (const [key, value] of (0, _entries.default)(this.attributes)) {
268
+ this.set(key, value);
269
+ }
270
+ }
271
+
272
+ /**
273
+ * Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
274
+ *
275
+ * <pre>
276
+ * const installation = await Parse.Installation.currentInstallation();
277
+ * installation.set('deviceToken', '123');
278
+ * await installation.save();
279
+ * </pre>
280
+ *
281
+ * @returns {Promise} A promise that resolves to the local installation object.
282
+ */
283
+ static currentInstallation() {
284
+ return _CoreManager.default.getInstallationController().currentInstallation();
285
+ }
286
+ }
287
+ _ParseObject.default.registerSubclass('_Installation', ParseInstallation);
415
288
  module.exports = ParseInstallation;
416
- var _default = ParseInstallation;
417
- exports.default = _default;
289
+ var _default = exports.default = ParseInstallation;