parse 5.2.0-alpha.1 → 5.2.0-alpha.3

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