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,30 +1,36 @@
1
1
  "use strict";
2
2
 
3
- /**
4
- * @flow
5
- * @private
6
- */
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
7
  const StorageController = {
8
8
  async: 0,
9
- getItem(path /*: string*/) /*: ?string*/{
9
+ getItem(path) {
10
+ // @ts-ignore
10
11
  return wx.getStorageSync(path);
11
12
  },
12
- setItem(path /*: string*/, value /*: string*/) {
13
+ setItem(path, value) {
13
14
  try {
15
+ // @ts-ignore
14
16
  wx.setStorageSync(path, value);
15
17
  } catch (e) {
16
18
  // Quota exceeded
17
19
  }
18
20
  },
19
- removeItem(path /*: string*/) {
21
+ removeItem(path) {
22
+ // @ts-ignore
20
23
  wx.removeStorageSync(path);
21
24
  },
22
25
  getAllKeys() {
26
+ // @ts-ignore
23
27
  const res = wx.getStorageInfoSync();
24
28
  return res.keys;
25
29
  },
26
30
  clear() {
31
+ // @ts-ignore
27
32
  wx.clearStorageSync();
28
33
  }
29
34
  };
30
- module.exports = StorageController;
35
+ module.exports = StorageController;
36
+ var _default = exports.default = StorageController;
@@ -9,7 +9,7 @@ class TaskQueue {
9
9
  constructor() {
10
10
  this.queue = [];
11
11
  }
12
- enqueue(task /*: () => Promise<void>*/) /*: Promise<void>*/{
12
+ enqueue(task) {
13
13
  const taskComplete = (0, _promiseUtils.resolvingPromise)();
14
14
  this.queue.push({
15
15
  task: task,
@@ -41,5 +41,4 @@ class TaskQueue {
41
41
  }
42
42
  }
43
43
  module.exports = TaskQueue;
44
- var _default = TaskQueue;
45
- exports.default = _default;
44
+ var _default = exports.default = TaskQueue;
@@ -22,62 +22,42 @@ exports.setPendingOp = setPendingOp;
22
22
  exports.setServerData = setServerData;
23
23
  var ObjectStateMutations = _interopRequireWildcard(require("./ObjectStateMutations"));
24
24
  var _TaskQueue = _interopRequireDefault(require("./TaskQueue"));
25
- function _interopRequireDefault(obj) {
26
- return obj && obj.__esModule ? obj : {
27
- default: obj
25
+ function _interopRequireDefault(e) {
26
+ return e && e.__esModule ? e : {
27
+ default: e
28
28
  };
29
29
  }
30
- function _getRequireWildcardCache(nodeInterop) {
31
- if (typeof WeakMap !== "function") return null;
32
- var cacheBabelInterop = new WeakMap();
33
- var cacheNodeInterop = new WeakMap();
34
- return (_getRequireWildcardCache = function (nodeInterop) {
35
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
- })(nodeInterop);
37
- }
38
- function _interopRequireWildcard(obj, nodeInterop) {
39
- if (!nodeInterop && obj && obj.__esModule) {
40
- return obj;
41
- }
42
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
43
- return {
44
- default: obj
45
- };
46
- }
47
- var cache = _getRequireWildcardCache(nodeInterop);
48
- if (cache && cache.has(obj)) {
49
- return cache.get(obj);
50
- }
51
- var newObj = {};
52
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
53
- for (var key in obj) {
54
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
55
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
56
- if (desc && (desc.get || desc.set)) {
57
- Object.defineProperty(newObj, key, desc);
58
- } else {
59
- newObj[key] = obj[key];
60
- }
61
- }
62
- }
63
- newObj.default = obj;
64
- if (cache) {
65
- cache.set(obj, newObj);
30
+ function _getRequireWildcardCache(e) {
31
+ if ("function" != typeof WeakMap) return null;
32
+ var r = new WeakMap(),
33
+ t = new WeakMap();
34
+ return (_getRequireWildcardCache = function (e) {
35
+ return e ? t : r;
36
+ })(e);
37
+ }
38
+ function _interopRequireWildcard(e, r) {
39
+ if (!r && e && e.__esModule) return e;
40
+ if (null === e || "object" != typeof e && "function" != typeof e) return {
41
+ default: e
42
+ };
43
+ var t = _getRequireWildcardCache(r);
44
+ if (t && t.has(e)) return t.get(e);
45
+ var n = {
46
+ __proto__: null
47
+ },
48
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
49
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
50
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
51
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
66
52
  }
67
- return newObj;
68
- }
69
- /**
70
- * @flow
71
- */
72
- /*:: import type { Op } from './ParseOp';*/
73
- /*:: import type ParseObject from './ParseObject';*/
74
- /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
53
+ return n.default = e, t && t.set(e, n), n;
54
+ }
75
55
  let objectState = new WeakMap();
76
- function getState(obj /*: ParseObject*/) /*: ?State*/{
56
+ function getState(obj) {
77
57
  const classData = objectState.get(obj);
78
58
  return classData || null;
79
59
  }
80
- function initializeState(obj /*: ParseObject*/, initial /*:: ?: State*/) /*: State*/{
60
+ function initializeState(obj, initial) {
81
61
  let state = getState(obj);
82
62
  if (state) {
83
63
  return state;
@@ -95,7 +75,7 @@ function initializeState(obj /*: ParseObject*/, initial /*:: ?: State*/) /*: Sta
95
75
  objectState.set(obj, state);
96
76
  return state;
97
77
  }
98
- function removeState(obj /*: ParseObject*/) /*: ?State*/{
78
+ function removeState(obj) {
99
79
  const state = getState(obj);
100
80
  if (state === null) {
101
81
  return null;
@@ -103,66 +83,66 @@ function removeState(obj /*: ParseObject*/) /*: ?State*/{
103
83
  objectState.delete(obj);
104
84
  return state;
105
85
  }
106
- function getServerData(obj /*: ParseObject*/) /*: AttributeMap*/{
86
+ function getServerData(obj) {
107
87
  const state = getState(obj);
108
88
  if (state) {
109
89
  return state.serverData;
110
90
  }
111
91
  return {};
112
92
  }
113
- function setServerData(obj /*: ParseObject*/, attributes /*: AttributeMap*/) {
93
+ function setServerData(obj, attributes) {
114
94
  const serverData = initializeState(obj).serverData;
115
95
  ObjectStateMutations.setServerData(serverData, attributes);
116
96
  }
117
- function getPendingOps(obj /*: ParseObject*/) /*: Array<OpsMap>*/{
97
+ function getPendingOps(obj) {
118
98
  const state = getState(obj);
119
99
  if (state) {
120
100
  return state.pendingOps;
121
101
  }
122
102
  return [{}];
123
103
  }
124
- function setPendingOp(obj /*: ParseObject*/, attr /*: string*/, op /*: ?Op*/) {
104
+ function setPendingOp(obj, attr, op) {
125
105
  const pendingOps = initializeState(obj).pendingOps;
126
106
  ObjectStateMutations.setPendingOp(pendingOps, attr, op);
127
107
  }
128
- function pushPendingState(obj /*: ParseObject*/) {
108
+ function pushPendingState(obj) {
129
109
  const pendingOps = initializeState(obj).pendingOps;
130
110
  ObjectStateMutations.pushPendingState(pendingOps);
131
111
  }
132
- function popPendingState(obj /*: ParseObject*/) /*: OpsMap*/{
112
+ function popPendingState(obj) {
133
113
  const pendingOps = initializeState(obj).pendingOps;
134
114
  return ObjectStateMutations.popPendingState(pendingOps);
135
115
  }
136
- function mergeFirstPendingState(obj /*: ParseObject*/) {
116
+ function mergeFirstPendingState(obj) {
137
117
  const pendingOps = getPendingOps(obj);
138
118
  ObjectStateMutations.mergeFirstPendingState(pendingOps);
139
119
  }
140
- function getObjectCache(obj /*: ParseObject*/) /*: ObjectCache*/{
120
+ function getObjectCache(obj) {
141
121
  const state = getState(obj);
142
122
  if (state) {
143
123
  return state.objectCache;
144
124
  }
145
125
  return {};
146
126
  }
147
- function estimateAttribute(obj /*: ParseObject*/, attr /*: string*/) /*: any*/{
127
+ function estimateAttribute(obj, attr) {
148
128
  const serverData = getServerData(obj);
149
129
  const pendingOps = getPendingOps(obj);
150
130
  return ObjectStateMutations.estimateAttribute(serverData, pendingOps, obj, attr);
151
131
  }
152
- function estimateAttributes(obj /*: ParseObject*/) /*: AttributeMap*/{
132
+ function estimateAttributes(obj) {
153
133
  const serverData = getServerData(obj);
154
134
  const pendingOps = getPendingOps(obj);
155
135
  return ObjectStateMutations.estimateAttributes(serverData, pendingOps, obj);
156
136
  }
157
- function commitServerChanges(obj /*: ParseObject*/, changes /*: AttributeMap*/) {
137
+ function commitServerChanges(obj, changes) {
158
138
  const state = initializeState(obj);
159
139
  ObjectStateMutations.commitServerChanges(state.serverData, state.objectCache, changes);
160
140
  }
161
- function enqueueTask(obj /*: ParseObject*/, task /*: () => Promise*/) /*: Promise*/{
141
+ function enqueueTask(obj, task) {
162
142
  const state = initializeState(obj);
163
143
  return state.tasks.enqueue(task);
164
144
  }
165
- function duplicateState(source /*: ParseObject*/, dest /*: ParseObject*/) /*: void*/{
145
+ function duplicateState(source, dest) {
166
146
  const oldState = initializeState(source);
167
147
  const newState = initializeState(dest);
168
148
  for (const key in oldState.serverData) {
@@ -1,10 +1,23 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ws = _interopRequireDefault(require("ws"));
8
+ var _Socket = _interopRequireDefault(require("./Socket.weapp"));
9
+ function _interopRequireDefault(e) {
10
+ return e && e.__esModule ? e : {
11
+ default: e
12
+ };
13
+ }
3
14
  /* global WebSocket */
15
+
4
16
  let WebSocketController;
5
17
  try {
6
- WebSocketController = require('ws');
18
+ WebSocketController = _ws.default;
7
19
  } catch (_) {
8
20
  // WebSocket unavailable
9
21
  }
10
- module.exports = WebSocketController;
22
+ module.exports = WebSocketController;
23
+ var _default = exports.default = WebSocketController;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
 
3
- module.exports = class {
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ class XhrWeapp {
4
8
  constructor() {
5
9
  this.UNSENT = 0;
6
10
  this.OPENED = 1;
@@ -50,6 +54,7 @@ module.exports = class {
50
54
  this.onreadystatechange();
51
55
  }
52
56
  send(data) {
57
+ // @ts-ignore
53
58
  this.requestTask = wx.request({
54
59
  url: this.url,
55
60
  method: this.method,
@@ -66,6 +71,7 @@ module.exports = class {
66
71
  },
67
72
  fail: err => {
68
73
  this.requestTask = null;
74
+ // @ts-ignore
69
75
  this.onerror(err);
70
76
  }
71
77
  });
@@ -75,7 +81,10 @@ module.exports = class {
75
81
  loaded: res.totalBytesWritten,
76
82
  total: res.totalBytesExpectedToWrite
77
83
  };
84
+ // @ts-ignore
78
85
  this.onprogress(event);
79
86
  });
80
87
  }
81
- };
88
+ }
89
+ module.exports = XhrWeapp;
90
+ var _default = exports.default = XhrWeapp;
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = arrayContainsObject;
7
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
- function _interopRequireDefault(obj) {
9
- return obj && obj.__esModule ? obj : {
10
- default: obj
8
+ function _interopRequireDefault(e) {
9
+ return e && e.__esModule ? e : {
10
+ default: e
11
11
  };
12
12
  }
13
- function arrayContainsObject(array /*: Array<any>*/, object /*: ParseObject*/) /*: boolean*/{
13
+ function arrayContainsObject(array, object) {
14
14
  if (array.indexOf(object) > -1) {
15
15
  return true;
16
16
  }
@@ -7,12 +7,12 @@ exports.default = canBeSerialized;
7
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
8
  var _ParseFile = _interopRequireDefault(require("./ParseFile"));
9
9
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
10
- function _interopRequireDefault(obj) {
11
- return obj && obj.__esModule ? obj : {
12
- default: obj
10
+ function _interopRequireDefault(e) {
11
+ return e && e.__esModule ? e : {
12
+ default: e
13
13
  };
14
14
  }
15
- function canBeSerialized(obj /*: ParseObject*/) /*: boolean*/{
15
+ function canBeSerialized(obj) {
16
16
  const ParseObject = _CoreManager.default.getParseObject();
17
17
  if (!(obj instanceof ParseObject)) {
18
18
  return true;
@@ -26,7 +26,7 @@ function canBeSerialized(obj /*: ParseObject*/) /*: boolean*/{
26
26
  }
27
27
  return true;
28
28
  }
29
- function canBeSerializedHelper(value /*: any*/) /*: boolean*/{
29
+ function canBeSerializedHelper(value) {
30
30
  if (typeof value !== 'object') {
31
31
  return true;
32
32
  }
@@ -9,12 +9,12 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
9
9
  var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
10
10
  var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
11
11
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
12
- function _interopRequireDefault(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- default: obj
12
+ function _interopRequireDefault(e) {
13
+ return e && e.__esModule ? e : {
14
+ default: e
15
15
  };
16
16
  }
17
- function decode(value /*: any*/) /*: any*/{
17
+ function decode(value) {
18
18
  if (value === null || typeof value !== 'object' || value instanceof Date) {
19
19
  return value;
20
20
  }
@@ -10,12 +10,12 @@ var _ParseFile = _interopRequireDefault(require("./ParseFile"));
10
10
  var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
11
11
  var _ParsePolygon = _interopRequireDefault(require("./ParsePolygon"));
12
12
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
13
- function _interopRequireDefault(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
13
+ function _interopRequireDefault(e) {
14
+ return e && e.__esModule ? e : {
15
+ default: e
16
16
  };
17
17
  }
18
- function encode(value /*: any*/, disallowObjects /*: boolean*/, forcePointers /*: boolean*/, seen /*: Array<any>*/, offline /*: boolean*/) /*: any*/{
18
+ function encode(value, disallowObjects, forcePointers, seen, offline) {
19
19
  const ParseObject = _CoreManager.default.getParseObject();
20
20
  if (value instanceof ParseObject) {
21
21
  if (disallowObjects) {
@@ -69,6 +69,6 @@ function encode(value /*: any*/, disallowObjects /*: boolean*/, forcePointers /*
69
69
  }
70
70
  return value;
71
71
  }
72
- function _default(value /*: any*/, disallowObjects /*:: ?: boolean*/, forcePointers /*:: ?: boolean*/, seen /*:: ?: Array<any>*/, offline /*:: ?: boolean*/) /*: any*/{
72
+ function _default(value, disallowObjects, forcePointers, seen, offline) {
73
73
  return encode(value, !!disallowObjects, !!forcePointers, seen || [], offline);
74
74
  }
@@ -8,12 +8,12 @@ var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
8
  var _ParseACL = _interopRequireDefault(require("./ParseACL"));
9
9
  var _ParseFile = _interopRequireDefault(require("./ParseFile"));
10
10
  var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
11
- function _interopRequireDefault(obj) {
12
- return obj && obj.__esModule ? obj : {
13
- default: obj
11
+ function _interopRequireDefault(e) {
12
+ return e && e.__esModule ? e : {
13
+ default: e
14
14
  };
15
15
  }
16
- function equals(a /*: any*/, b /*: any*/) /*: boolean*/{
16
+ function equals(a, b) {
17
17
  const toString = Object.prototype.toString;
18
18
  if (toString.call(a) === '[object Date]' || toString.call(b) === '[object Date]') {
19
19
  const dateA = new Date(a);
@@ -12,7 +12,7 @@ const encoded = {
12
12
  "'": '&#x27;',
13
13
  '"': '&quot;'
14
14
  };
15
- function escape(str /*: string*/) /*: string*/{
15
+ function escape(str) {
16
16
  return str.replace(/[&<>\/'"]/g, function (char) {
17
17
  return encoded[char];
18
18
  });
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isRevocableSession;
7
- function isRevocableSession(token /*: string*/) /*: boolean*/{
7
+ function isRevocableSession(token) {
8
8
  return token.indexOf('r:') > -1;
9
9
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = parseDate;
7
- function parseDate(iso8601 /*: string*/) /*: Date | null*/{
7
+ function parseDate(iso8601) {
8
8
  const regexp = new RegExp('^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})' + 'T' + '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})' + '(.([0-9]+))?' + 'Z$');
9
9
  const match = regexp.exec(iso8601);
10
10
  if (!match) {
@@ -7,19 +7,19 @@ exports.continueWhile = continueWhile;
7
7
  exports.resolvingPromise = resolvingPromise;
8
8
  exports.when = when;
9
9
  // Create Deferred Promise
10
- function resolvingPromise /*:: <T = any>*/() {
11
- let res /*: (value: T) => void*/;
12
- let rej /*: (error: T) => void*/;
10
+ function resolvingPromise() {
11
+ let res;
12
+ let rej;
13
13
  const promise = new Promise((resolve, reject) => {
14
14
  res = resolve;
15
15
  rej = reject;
16
16
  });
17
- const defer /*: typeof promise & { resolve: (res: T) => void, reject: (err: any) => void }*/ = promise;
17
+ const defer = promise;
18
18
  defer.resolve = res;
19
19
  defer.reject = rej;
20
20
  return defer;
21
21
  }
22
- function when(promises /*: any*/) {
22
+ function when(promises) {
23
23
  let objects;
24
24
  const arrayArgument = Array.isArray(promises);
25
25
  if (arrayArgument) {
@@ -48,7 +48,7 @@ function when(promises /*: any*/) {
48
48
  }
49
49
  }
50
50
  };
51
- const chain = function (object /*: Promise<any>*/, index /*: number*/) {
51
+ const chain = function (object, index) {
52
52
  if (object && typeof object.then === 'function') {
53
53
  object.then(function (result) {
54
54
  results[index] = result;
@@ -68,7 +68,7 @@ function when(promises /*: any*/) {
68
68
  }
69
69
  return promise;
70
70
  }
71
- function continueWhile(test /*: () => any*/, emitter /*: () => Promise<any>*/) {
71
+ function continueWhile(test, emitter) {
72
72
  if (test()) {
73
73
  return emitter().then(() => {
74
74
  return continueWhile(test, emitter);
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = unique;
7
7
  var _arrayContainsObject = _interopRequireDefault(require("./arrayContainsObject"));
8
8
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
9
+ function _interopRequireDefault(e) {
10
+ return e && e.__esModule ? e : {
11
+ default: e
12
12
  };
13
13
  }
14
- function unique /*:: <T>*/(arr /*: Array<T>*/) /*: Array<T>*/{
15
- const uniques /*: T[]*/ = [];
14
+ function unique(arr) {
15
+ const uniques = [];
16
16
  arr.forEach(value => {
17
17
  const ParseObject = _CoreManager.default.getParseObject();
18
18
  if (value instanceof ParseObject) {
@@ -7,9 +7,9 @@ exports.default = unsavedChildren;
7
7
  var _CoreManager = _interopRequireDefault(require("./CoreManager"));
8
8
  var _ParseFile = _interopRequireDefault(require("./ParseFile"));
9
9
  var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
10
- function _interopRequireDefault(obj) {
11
- return obj && obj.__esModule ? obj : {
12
- default: obj
10
+ function _interopRequireDefault(e) {
11
+ return e && e.__esModule ? e : {
12
+ default: e
13
13
  };
14
14
  }
15
15
  /**
@@ -20,7 +20,7 @@ function _interopRequireDefault(obj) {
20
20
  * @param {boolean} allowDeepUnsaved
21
21
  * @returns {Array}
22
22
  */
23
- function unsavedChildren(obj /*: ParseObject*/, allowDeepUnsaved /*:: ?: boolean*/) /*: Array<ParseFile | ParseObject>*/{
23
+ function unsavedChildren(obj, allowDeepUnsaved) {
24
24
  const encountered = {
25
25
  objects: {},
26
26
  files: []
@@ -41,7 +41,7 @@ function unsavedChildren(obj /*: ParseObject*/, allowDeepUnsaved /*:: ?: boolean
41
41
  }
42
42
  return unsaved.concat(encountered.files);
43
43
  }
44
- function traverse(obj /*: ParseObject*/, encountered /*: EncounterMap*/, shouldThrow /*: boolean*/, allowDeepUnsaved /*: boolean*/) {
44
+ function traverse(obj, encountered, shouldThrow, allowDeepUnsaved) {
45
45
  const ParseObject = _CoreManager.default.getParseObject();
46
46
  if (obj instanceof ParseObject) {
47
47
  if (!obj.id && shouldThrow) {
package/lib/node/uuid.js CHANGED
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _uuid = require("uuid");
8
- let uuid = _uuid.v4 /*: () => string*/;
9
-
8
+ let uuid = _uuid.v4;
10
9
  module.exports = uuid;
11
- var _default = uuid;
12
- exports.default = _default;
10
+ var _default = exports.default = uuid;
@@ -11,8 +11,8 @@ function track(name, dimensions) {
11
11
  if (name.length === 0) {
12
12
  throw new TypeError('A name for the custom event must be provided');
13
13
  }
14
- for (var _key in dimensions) {
15
- if (typeof _key !== 'string' || typeof dimensions[_key] !== 'string') {
14
+ for (var key in dimensions) {
15
+ if (typeof key !== 'string' || typeof dimensions[key] !== 'string') {
16
16
  throw new TypeError('track() dimensions expects keys and values of type "string".');
17
17
  }
18
18
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.default = void 0;
6
6
  var _ParseUser = _interopRequireDefault(require("./ParseUser"));
7
- var uuidv4 = require('./uuid');
7
+ var _uuid = _interopRequireDefault(require("./uuid"));
8
8
  var registered = false;
9
9
  var AnonymousUtils = {
10
10
  isLinked: function (user) {
@@ -33,7 +33,7 @@ var AnonymousUtils = {
33
33
  getAuthData: function () {
34
34
  return {
35
35
  authData: {
36
- id: uuidv4()
36
+ id: (0, _uuid.default)()
37
37
  }
38
38
  };
39
39
  }
@@ -45,5 +45,4 @@ var AnonymousUtils = {
45
45
  return provider;
46
46
  }
47
47
  };
48
- var _default = AnonymousUtils;
49
- exports.default = _default;
48
+ var _default = exports.default = AnonymousUtils;
@@ -12,7 +12,7 @@ var config = {
12
12
  SERVER_AUTH_TOKEN: null,
13
13
  LIVEQUERY_SERVER_URL: null,
14
14
  ENCRYPTED_KEY: null,
15
- VERSION: 'js' + "5.2.0-alpha.1",
15
+ VERSION: 'js' + "5.2.0-alpha.3",
16
16
  APPLICATION_ID: null,
17
17
  JAVASCRIPT_KEY: null,
18
18
  MASTER_KEY: null,
@@ -246,5 +246,4 @@ var CoreManager = {
246
246
  }
247
247
  };
248
248
  module.exports = CoreManager;
249
- var _default = CoreManager;
250
- exports.default = _default;
249
+ var _default = exports.default = CoreManager;
@@ -1,3 +1,7 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.default = void 0;
1
5
  var AES;
2
6
  var ENC;
3
7
  var CryptoJS = require('react-native-crypto-js');
@@ -13,4 +17,5 @@ var CryptoController = {
13
17
  return decryptedStr;
14
18
  }
15
19
  };
16
- module.exports = CryptoController;
20
+ module.exports = CryptoController;
21
+ var _default = exports.default = CryptoController;
@@ -1,3 +1,7 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.default = void 0;
1
5
  var EventEmitter;
2
6
  try {
3
7
  EventEmitter = require('react-native/Libraries/vendor/emitter/EventEmitter');
@@ -6,4 +10,5 @@ try {
6
10
  }
7
11
  EventEmitter.prototype.on = EventEmitter.prototype.addListener;
8
12
  } catch (_) {}
9
- module.exports = EventEmitter;
13
+ module.exports = EventEmitter;
14
+ var _default = exports.default = EventEmitter;
@@ -252,5 +252,4 @@ var EventuallyQueue = {
252
252
  }
253
253
  };
254
254
  module.exports = EventuallyQueue;
255
- var _default = EventuallyQueue;
256
- exports.default = _default;
255
+ var _default = exports.default = EventuallyQueue;
@@ -112,5 +112,4 @@ var FacebookUtils = {
112
112
  return provider;
113
113
  }
114
114
  };
115
- var _default = FacebookUtils;
116
- exports.default = _default;
115
+ var _default = exports.default = FacebookUtils;