parse 4.2.0-alpha.1 → 4.2.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.js +1887 -1501
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +1883 -1497
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Cloud.js +3 -0
- package/lib/browser/CoreManager.js +31 -4
- package/lib/browser/EventEmitter.js +7 -2
- package/lib/browser/EventuallyQueue.js +11 -3
- package/lib/browser/LiveQueryClient.js +52 -86
- package/lib/browser/LiveQuerySubscription.js +16 -51
- package/lib/browser/LocalDatastore.js +7 -0
- package/lib/browser/ObjectStateMutations.js +3 -1
- package/lib/browser/OfflineQuery.js +1 -1
- package/lib/browser/Parse.js +171 -135
- package/lib/browser/ParseError.js +12 -1
- package/lib/browser/ParseLiveQuery.js +79 -51
- package/lib/browser/ParseObject.js +1 -1
- package/lib/browser/ParseQuery.js +53 -58
- package/lib/browser/ParseSchema.js +22 -1
- package/lib/browser/ParseSession.js +2 -6
- package/lib/browser/ParseUser.js +65 -8
- package/lib/browser/Storage.js +7 -0
- package/lib/node/Cloud.js +3 -0
- package/lib/node/CoreManager.js +30 -4
- package/lib/node/EventEmitter.js +7 -1
- package/lib/node/EventuallyQueue.js +10 -3
- package/lib/node/LiveQueryClient.js +5 -5
- package/lib/node/LiveQuerySubscription.js +5 -7
- package/lib/node/LocalDatastore.js +6 -0
- package/lib/node/ObjectStateMutations.js +3 -1
- package/lib/node/OfflineQuery.js +1 -1
- package/lib/node/Parse.js +162 -126
- package/lib/node/ParseError.js +15 -1
- package/lib/node/ParseLiveQuery.js +32 -24
- package/lib/node/ParseObject.js +1 -1
- package/lib/node/ParseQuery.js +3 -6
- package/lib/node/ParseSchema.js +20 -1
- package/lib/node/ParseSession.js +1 -6
- package/lib/node/ParseUser.js +58 -8
- package/lib/node/Storage.js +6 -0
- package/lib/react-native/Cloud.js +3 -0
- package/lib/react-native/CoreManager.js +30 -4
- package/lib/react-native/EventEmitter.js +8 -5
- package/lib/react-native/EventuallyQueue.js +10 -3
- package/lib/react-native/LiveQueryClient.js +38 -68
- package/lib/react-native/LiveQuerySubscription.js +16 -46
- package/lib/react-native/LocalDatastore.js +6 -0
- package/lib/react-native/ObjectStateMutations.js +3 -1
- package/lib/react-native/OfflineQuery.js +1 -1
- package/lib/react-native/Parse.js +127 -90
- package/lib/react-native/ParseError.js +8 -1
- package/lib/react-native/ParseLiveQuery.js +39 -11
- package/lib/react-native/ParseQuery.js +3 -6
- package/lib/react-native/ParseSchema.js +14 -1
- package/lib/react-native/ParseUser.js +49 -6
- package/lib/react-native/Storage.js +6 -0
- package/lib/weapp/Cloud.js +3 -0
- package/lib/weapp/CoreManager.js +31 -4
- package/lib/weapp/EventEmitter.js +7 -2
- package/lib/weapp/EventuallyQueue.js +11 -3
- package/lib/weapp/LiveQueryClient.js +52 -86
- package/lib/weapp/LiveQuerySubscription.js +16 -51
- package/lib/weapp/LocalDatastore.js +7 -0
- package/lib/weapp/ObjectStateMutations.js +3 -1
- package/lib/weapp/OfflineQuery.js +1 -1
- package/lib/weapp/Parse.js +170 -134
- package/lib/weapp/ParseError.js +12 -1
- package/lib/weapp/ParseLiveQuery.js +79 -51
- package/lib/weapp/ParseObject.js +1 -1
- package/lib/weapp/ParseQuery.js +53 -58
- package/lib/weapp/ParseSchema.js +22 -1
- package/lib/weapp/ParseSession.js +2 -6
- package/lib/weapp/ParseUser.js +65 -8
- package/lib/weapp/Storage.js +7 -0
- package/package.json +21 -17
package/lib/weapp/ParseQuery.js
CHANGED
|
@@ -965,21 +965,16 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
965
965
|
}, {
|
|
966
966
|
key: "eachBatch",
|
|
967
967
|
value: function (callback /*: (objs: Array<ParseObject>) => Promise<*>*/, options /*:: ?: BatchOptions*/) /*: Promise<void>*/{
|
|
968
|
-
var _context8;
|
|
969
968
|
options = options || {};
|
|
970
969
|
if (this._order || this._skip || this._limit >= 0) {
|
|
971
970
|
return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');
|
|
972
971
|
}
|
|
973
972
|
var query = new ParseQuery(this.className);
|
|
974
973
|
query._limit = options.batchSize || 100;
|
|
975
|
-
query._include = (0,
|
|
976
|
-
|
|
977
|
-
});
|
|
974
|
+
query._include = (0, _toConsumableArray2.default)(this._include);
|
|
975
|
+
query._exclude = (0, _toConsumableArray2.default)(this._exclude);
|
|
978
976
|
if (this._select) {
|
|
979
|
-
|
|
980
|
-
query._select = (0, _map2.default)(_context9 = this._select).call(_context9, function (s) {
|
|
981
|
-
return s;
|
|
982
|
-
});
|
|
977
|
+
query._select = (0, _toConsumableArray2.default)(this._select);
|
|
983
978
|
}
|
|
984
979
|
query._hint = this._hint;
|
|
985
980
|
query._where = {};
|
|
@@ -1019,39 +1014,39 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1019
1014
|
return !finished;
|
|
1020
1015
|
}, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
1021
1016
|
var _yield$Promise$all, _yield$Promise$all2, results;
|
|
1022
|
-
return _regenerator.default.wrap(function (
|
|
1023
|
-
while (1) switch (
|
|
1017
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
1018
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1024
1019
|
case 0:
|
|
1025
|
-
|
|
1020
|
+
_context8.next = 2;
|
|
1026
1021
|
return _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);
|
|
1027
1022
|
case 2:
|
|
1028
|
-
_yield$Promise$all =
|
|
1023
|
+
_yield$Promise$all = _context8.sent;
|
|
1029
1024
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 1);
|
|
1030
1025
|
results = _yield$Promise$all2[0];
|
|
1031
1026
|
if (!(results.length >= query._limit)) {
|
|
1032
|
-
|
|
1027
|
+
_context8.next = 10;
|
|
1033
1028
|
break;
|
|
1034
1029
|
}
|
|
1035
1030
|
query.greaterThan('objectId', results[results.length - 1].id);
|
|
1036
1031
|
previousResults = results;
|
|
1037
|
-
|
|
1032
|
+
_context8.next = 17;
|
|
1038
1033
|
break;
|
|
1039
1034
|
case 10:
|
|
1040
1035
|
if (!(results.length > 0)) {
|
|
1041
|
-
|
|
1036
|
+
_context8.next = 16;
|
|
1042
1037
|
break;
|
|
1043
1038
|
}
|
|
1044
|
-
|
|
1039
|
+
_context8.next = 13;
|
|
1045
1040
|
return _promise.default.resolve(callback(results));
|
|
1046
1041
|
case 13:
|
|
1047
1042
|
finished = true;
|
|
1048
|
-
|
|
1043
|
+
_context8.next = 17;
|
|
1049
1044
|
break;
|
|
1050
1045
|
case 16:
|
|
1051
1046
|
finished = true;
|
|
1052
1047
|
case 17:
|
|
1053
1048
|
case "end":
|
|
1054
|
-
return
|
|
1049
|
+
return _context8.stop();
|
|
1055
1050
|
}
|
|
1056
1051
|
}, _callee3);
|
|
1057
1052
|
})));
|
|
@@ -1152,12 +1147,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1152
1147
|
var _map = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => any*/, options /*:: ?: BatchOptions*/) {
|
|
1153
1148
|
var _this5 = this;
|
|
1154
1149
|
var array, index;
|
|
1155
|
-
return _regenerator.default.wrap(function (
|
|
1156
|
-
while (1) switch (
|
|
1150
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
1151
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1157
1152
|
case 0:
|
|
1158
1153
|
array = [];
|
|
1159
1154
|
index = 0;
|
|
1160
|
-
|
|
1155
|
+
_context9.next = 4;
|
|
1161
1156
|
return this.each(function (object) {
|
|
1162
1157
|
return _promise.default.resolve(callback(object, index, _this5)).then(function (result) {
|
|
1163
1158
|
array.push(result);
|
|
@@ -1165,10 +1160,10 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1165
1160
|
});
|
|
1166
1161
|
}, options);
|
|
1167
1162
|
case 4:
|
|
1168
|
-
return
|
|
1163
|
+
return _context9.abrupt("return", array);
|
|
1169
1164
|
case 5:
|
|
1170
1165
|
case "end":
|
|
1171
|
-
return
|
|
1166
|
+
return _context9.stop();
|
|
1172
1167
|
}
|
|
1173
1168
|
}, _callee4, this);
|
|
1174
1169
|
}));
|
|
@@ -1205,12 +1200,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1205
1200
|
value: function () {
|
|
1206
1201
|
var _reduce = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(callback /*: (accumulator: any, currentObject: ParseObject, index: number) => any*/, initialValue /*: any*/, options /*:: ?: BatchOptions*/) {
|
|
1207
1202
|
var accumulator, index;
|
|
1208
|
-
return _regenerator.default.wrap(function (
|
|
1209
|
-
while (1) switch (
|
|
1203
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
1204
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1210
1205
|
case 0:
|
|
1211
1206
|
accumulator = initialValue;
|
|
1212
1207
|
index = 0;
|
|
1213
|
-
|
|
1208
|
+
_context10.next = 4;
|
|
1214
1209
|
return this.each(function (object) {
|
|
1215
1210
|
// If no initial value was given, we take the first object from the query
|
|
1216
1211
|
// as the initial value and don't call the callback with it.
|
|
@@ -1226,15 +1221,15 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1226
1221
|
}, options);
|
|
1227
1222
|
case 4:
|
|
1228
1223
|
if (!(index === 0 && initialValue === undefined)) {
|
|
1229
|
-
|
|
1224
|
+
_context10.next = 6;
|
|
1230
1225
|
break;
|
|
1231
1226
|
}
|
|
1232
1227
|
throw new TypeError('Reducing empty query result set with no initial value');
|
|
1233
1228
|
case 6:
|
|
1234
|
-
return
|
|
1229
|
+
return _context10.abrupt("return", accumulator);
|
|
1235
1230
|
case 7:
|
|
1236
1231
|
case "end":
|
|
1237
|
-
return
|
|
1232
|
+
return _context10.stop();
|
|
1238
1233
|
}
|
|
1239
1234
|
}, _callee5, this);
|
|
1240
1235
|
}));
|
|
@@ -1271,12 +1266,12 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1271
1266
|
var _filter = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(callback /*: (currentObject: ParseObject, index: number, query: ParseQuery) => boolean*/, options /*:: ?: BatchOptions*/) {
|
|
1272
1267
|
var _this6 = this;
|
|
1273
1268
|
var array, index;
|
|
1274
|
-
return _regenerator.default.wrap(function (
|
|
1275
|
-
while (1) switch (
|
|
1269
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
1270
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1276
1271
|
case 0:
|
|
1277
1272
|
array = [];
|
|
1278
1273
|
index = 0;
|
|
1279
|
-
|
|
1274
|
+
_context11.next = 4;
|
|
1280
1275
|
return this.each(function (object) {
|
|
1281
1276
|
return _promise.default.resolve(callback(object, index, _this6)).then(function (flag) {
|
|
1282
1277
|
if (flag) {
|
|
@@ -1286,10 +1281,10 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1286
1281
|
});
|
|
1287
1282
|
}, options);
|
|
1288
1283
|
case 4:
|
|
1289
|
-
return
|
|
1284
|
+
return _context11.abrupt("return", array);
|
|
1290
1285
|
case 5:
|
|
1291
1286
|
case "end":
|
|
1292
|
-
return
|
|
1287
|
+
return _context11.stop();
|
|
1293
1288
|
}
|
|
1294
1289
|
}, _callee6, this);
|
|
1295
1290
|
}));
|
|
@@ -1312,8 +1307,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1312
1307
|
value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
|
|
1313
1308
|
var _this7 = this;
|
|
1314
1309
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
1315
|
-
var
|
|
1316
|
-
(0, _forEach.default)(
|
|
1310
|
+
var _context12;
|
|
1311
|
+
(0, _forEach.default)(_context12 = (0, _entries.default)(key)).call(_context12, function (_ref2) {
|
|
1317
1312
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
1318
1313
|
k = _ref3[0],
|
|
1319
1314
|
val = _ref3[1];
|
|
@@ -1341,8 +1336,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1341
1336
|
value: function (key /*: string | { [key: string]: any }*/, value /*: ?mixed*/) /*: ParseQuery*/{
|
|
1342
1337
|
var _this8 = this;
|
|
1343
1338
|
if (key && (0, _typeof2.default)(key) === 'object') {
|
|
1344
|
-
var
|
|
1345
|
-
(0, _forEach.default)(
|
|
1339
|
+
var _context13;
|
|
1340
|
+
(0, _forEach.default)(_context13 = (0, _entries.default)(key)).call(_context13, function (_ref4) {
|
|
1346
1341
|
var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
1347
1342
|
k = _ref5[0],
|
|
1348
1343
|
val = _ref5[1];
|
|
@@ -1931,11 +1926,11 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1931
1926
|
keys[_key6] = arguments[_key6];
|
|
1932
1927
|
}
|
|
1933
1928
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
1934
|
-
var
|
|
1929
|
+
var _context14;
|
|
1935
1930
|
if ((0, _isArray.default)(key)) {
|
|
1936
1931
|
key = key.join();
|
|
1937
1932
|
}
|
|
1938
|
-
_this9._order = (0, _concat.default)(
|
|
1933
|
+
_this9._order = (0, _concat.default)(_context14 = _this9._order).call(_context14, key.replace(/\s/g, '').split(','));
|
|
1939
1934
|
});
|
|
1940
1935
|
return this;
|
|
1941
1936
|
}
|
|
@@ -1976,11 +1971,11 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
1976
1971
|
keys[_key8] = arguments[_key8];
|
|
1977
1972
|
}
|
|
1978
1973
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
1979
|
-
var
|
|
1974
|
+
var _context15, _context16;
|
|
1980
1975
|
if ((0, _isArray.default)(key)) {
|
|
1981
1976
|
key = key.join();
|
|
1982
1977
|
}
|
|
1983
|
-
_this10._order = (0, _concat.default)(
|
|
1978
|
+
_this10._order = (0, _concat.default)(_context15 = _this10._order).call(_context15, (0, _map2.default)(_context16 = key.replace(/\s/g, '').split(',')).call(_context16, function (k) {
|
|
1984
1979
|
return '-' + k;
|
|
1985
1980
|
}));
|
|
1986
1981
|
});
|
|
@@ -2062,8 +2057,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2062
2057
|
}
|
|
2063
2058
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2064
2059
|
if ((0, _isArray.default)(key)) {
|
|
2065
|
-
var
|
|
2066
|
-
_this11._include = (0, _concat.default)(
|
|
2060
|
+
var _context17;
|
|
2061
|
+
_this11._include = (0, _concat.default)(_context17 = _this11._include).call(_context17, key);
|
|
2067
2062
|
} else {
|
|
2068
2063
|
_this11._include.push(key);
|
|
2069
2064
|
}
|
|
@@ -2104,8 +2099,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2104
2099
|
}
|
|
2105
2100
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2106
2101
|
if ((0, _isArray.default)(key)) {
|
|
2107
|
-
var
|
|
2108
|
-
_this12._select = (0, _concat.default)(
|
|
2102
|
+
var _context18;
|
|
2103
|
+
_this12._select = (0, _concat.default)(_context18 = _this12._select).call(_context18, key);
|
|
2109
2104
|
} else {
|
|
2110
2105
|
_this12._select.push(key);
|
|
2111
2106
|
}
|
|
@@ -2131,8 +2126,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2131
2126
|
}
|
|
2132
2127
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2133
2128
|
if ((0, _isArray.default)(key)) {
|
|
2134
|
-
var
|
|
2135
|
-
_this13._exclude = (0, _concat.default)(
|
|
2129
|
+
var _context19;
|
|
2130
|
+
_this13._exclude = (0, _concat.default)(_context19 = _this13._exclude).call(_context19, key);
|
|
2136
2131
|
} else {
|
|
2137
2132
|
_this13._exclude.push(key);
|
|
2138
2133
|
}
|
|
@@ -2157,8 +2152,8 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2157
2152
|
}
|
|
2158
2153
|
(0, _forEach.default)(keys).call(keys, function (key) {
|
|
2159
2154
|
if ((0, _isArray.default)(key)) {
|
|
2160
|
-
var
|
|
2161
|
-
_this14._watch = (0, _concat.default)(
|
|
2155
|
+
var _context20;
|
|
2156
|
+
_this14._watch = (0, _concat.default)(_context20 = _this14._watch).call(_context20, key);
|
|
2162
2157
|
} else {
|
|
2163
2158
|
_this14._watch.push(key);
|
|
2164
2159
|
}
|
|
@@ -2195,30 +2190,30 @@ var ParseQuery = /*#__PURE__*/function () {
|
|
|
2195
2190
|
value: function () {
|
|
2196
2191
|
var _subscribe = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(sessionToken /*:: ?: string*/) {
|
|
2197
2192
|
var currentUser, liveQueryClient, subscription;
|
|
2198
|
-
return _regenerator.default.wrap(function (
|
|
2199
|
-
while (1) switch (
|
|
2193
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
2194
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2200
2195
|
case 0:
|
|
2201
|
-
|
|
2196
|
+
_context21.next = 2;
|
|
2202
2197
|
return _CoreManager.default.getUserController().currentUserAsync();
|
|
2203
2198
|
case 2:
|
|
2204
|
-
currentUser =
|
|
2199
|
+
currentUser = _context21.sent;
|
|
2205
2200
|
if (!sessionToken) {
|
|
2206
2201
|
sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
|
|
2207
2202
|
}
|
|
2208
|
-
|
|
2203
|
+
_context21.next = 6;
|
|
2209
2204
|
return _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
|
|
2210
2205
|
case 6:
|
|
2211
|
-
liveQueryClient =
|
|
2206
|
+
liveQueryClient = _context21.sent;
|
|
2212
2207
|
if (liveQueryClient.shouldOpen()) {
|
|
2213
2208
|
liveQueryClient.open();
|
|
2214
2209
|
}
|
|
2215
2210
|
subscription = liveQueryClient.subscribe(this, sessionToken);
|
|
2216
|
-
return
|
|
2211
|
+
return _context21.abrupt("return", subscription.subscribePromise.then(function () {
|
|
2217
2212
|
return subscription;
|
|
2218
2213
|
}));
|
|
2219
2214
|
case 10:
|
|
2220
2215
|
case "end":
|
|
2221
|
-
return
|
|
2216
|
+
return _context21.stop();
|
|
2222
2217
|
}
|
|
2223
2218
|
}, _callee7, this);
|
|
2224
2219
|
}));
|
package/lib/weapp/ParseSchema.js
CHANGED
|
@@ -17,7 +17,7 @@ var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
|
17
17
|
* @flow
|
|
18
18
|
*/
|
|
19
19
|
/*:: import type { PermissionsMap } from './ParseCLP';*/
|
|
20
|
-
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
20
|
+
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Bytes', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
21
21
|
/*:: type FieldOptions = {
|
|
22
22
|
required: boolean,
|
|
23
23
|
defaultValue: mixed,
|
|
@@ -236,6 +236,14 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
+
if (type === 'Bytes') {
|
|
240
|
+
if (options && options.defaultValue) {
|
|
241
|
+
fieldOptions.defaultValue = {
|
|
242
|
+
__type: 'Bytes',
|
|
243
|
+
base64: options.defaultValue
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
239
247
|
this._fields[name] = fieldOptions;
|
|
240
248
|
return this;
|
|
241
249
|
}
|
|
@@ -303,6 +311,19 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
303
311
|
return this.addField(name, 'Boolean', options);
|
|
304
312
|
}
|
|
305
313
|
|
|
314
|
+
/**
|
|
315
|
+
* Adding Bytes Field
|
|
316
|
+
*
|
|
317
|
+
* @param {string} name Name of the field that will be created on Parse
|
|
318
|
+
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
319
|
+
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
320
|
+
*/
|
|
321
|
+
}, {
|
|
322
|
+
key: "addBytes",
|
|
323
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
324
|
+
return this.addField(name, 'Bytes', options);
|
|
325
|
+
}
|
|
326
|
+
|
|
306
327
|
/**
|
|
307
328
|
* Adding Date Field
|
|
308
329
|
*
|
|
@@ -42,11 +42,7 @@ function _isNativeReflectConstruct() {
|
|
|
42
42
|
} catch (e) {
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
-
}
|
|
46
|
-
* @flow
|
|
47
|
-
*/
|
|
48
|
-
/*:: import type { AttributeMap } from './ObjectStateMutations';*/
|
|
49
|
-
/*:: import type { RequestOptions, FullOptions } from './RESTController';*/
|
|
45
|
+
}
|
|
50
46
|
/**
|
|
51
47
|
* <p>A Parse.Session object is a local representation of a revocable session.
|
|
52
48
|
* This class is a subclass of a Parse.Object, and retains the same
|
|
@@ -61,7 +57,7 @@ var ParseSession = /*#__PURE__*/function (_ParseObject) {
|
|
|
61
57
|
/**
|
|
62
58
|
* @param {object} attributes The initial set of data to store in the user.
|
|
63
59
|
*/
|
|
64
|
-
function ParseSession(attributes
|
|
60
|
+
function ParseSession(attributes /*:: ?: any*/) {
|
|
65
61
|
var _this;
|
|
66
62
|
(0, _classCallCheck2.default)(this, ParseSession);
|
|
67
63
|
_this = _super.call(this, '_Session');
|
package/lib/weapp/ParseUser.js
CHANGED
|
@@ -155,8 +155,14 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
155
155
|
throw new Error('Invalid type: authData field should be an object');
|
|
156
156
|
}
|
|
157
157
|
authData[authType] = options.authData;
|
|
158
|
+
var oldAnonymousData = authData.anonymous;
|
|
159
|
+
this.stripAnonymity();
|
|
158
160
|
var controller = _CoreManager.default.getUserController();
|
|
159
|
-
return controller.linkWith(this, authData, saveOpts)
|
|
161
|
+
return controller.linkWith(this, authData, saveOpts).catch(function (e) {
|
|
162
|
+
delete authData[authType];
|
|
163
|
+
_this2.restoreAnonimity(oldAnonymousData);
|
|
164
|
+
throw e;
|
|
165
|
+
});
|
|
160
166
|
} else {
|
|
161
167
|
return new _promise.default(function (resolve, reject) {
|
|
162
168
|
provider.authenticate({
|
|
@@ -387,6 +393,24 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
387
393
|
}
|
|
388
394
|
return isCurrentAsync;
|
|
389
395
|
}()
|
|
396
|
+
}, {
|
|
397
|
+
key: "stripAnonymity",
|
|
398
|
+
value: function () {
|
|
399
|
+
var authData = this.get('authData');
|
|
400
|
+
if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
401
|
+
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
402
|
+
authData.anonymous = null;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}, {
|
|
406
|
+
key: "restoreAnonimity",
|
|
407
|
+
value: function (anonymousData /*: any*/) {
|
|
408
|
+
if (anonymousData) {
|
|
409
|
+
var authData = this.get('authData');
|
|
410
|
+
authData.anonymous = anonymousData;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
390
414
|
/**
|
|
391
415
|
* Returns get("username").
|
|
392
416
|
*
|
|
@@ -410,12 +434,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
410
434
|
}, {
|
|
411
435
|
key: "setUsername",
|
|
412
436
|
value: function (username /*: string*/) {
|
|
413
|
-
|
|
414
|
-
var authData = this.get('authData');
|
|
415
|
-
if (authData && (0, _typeof2.default)(authData) === 'object' && authData.hasOwnProperty('anonymous')) {
|
|
416
|
-
// We need to set anonymous to null instead of deleting it in order to remove it from Parse.
|
|
417
|
-
authData.anonymous = null;
|
|
418
|
-
}
|
|
437
|
+
this.stripAnonymity();
|
|
419
438
|
this.set('username', username);
|
|
420
439
|
}
|
|
421
440
|
|
|
@@ -544,6 +563,9 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
544
563
|
if (options.hasOwnProperty('usePost')) {
|
|
545
564
|
loginOptions.usePost = options.usePost;
|
|
546
565
|
}
|
|
566
|
+
if (options.hasOwnProperty('context') && Object.prototype.toString.call(options.context) === '[object Object]') {
|
|
567
|
+
loginOptions.context = options.context;
|
|
568
|
+
}
|
|
547
569
|
var controller = _CoreManager.default.getUserController();
|
|
548
570
|
return controller.logIn(this, loginOptions);
|
|
549
571
|
}
|
|
@@ -880,6 +902,40 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
880
902
|
return user.logIn(options);
|
|
881
903
|
}
|
|
882
904
|
|
|
905
|
+
/**
|
|
906
|
+
* Logs in a user with a username (or email) and password, and authData. On success, this
|
|
907
|
+
* saves the session to disk, so you can retrieve the currently logged in
|
|
908
|
+
* user using <code>current</code>.
|
|
909
|
+
*
|
|
910
|
+
* @param {string} username The username (or email) to log in with.
|
|
911
|
+
* @param {string} password The password to log in with.
|
|
912
|
+
* @param {object} authData The authData to log in with.
|
|
913
|
+
* @param {object} options
|
|
914
|
+
* @static
|
|
915
|
+
* @returns {Promise} A promise that is fulfilled with the user when
|
|
916
|
+
* the login completes.
|
|
917
|
+
*/
|
|
918
|
+
}, {
|
|
919
|
+
key: "logInWithAdditionalAuth",
|
|
920
|
+
value: function (username /*: string*/, password /*: string*/, authData /*: AuthData*/, options /*:: ?: FullOptions*/) {
|
|
921
|
+
if (typeof username !== 'string') {
|
|
922
|
+
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Username must be a string.'));
|
|
923
|
+
}
|
|
924
|
+
if (typeof password !== 'string') {
|
|
925
|
+
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Password must be a string.'));
|
|
926
|
+
}
|
|
927
|
+
if (Object.prototype.toString.call(authData) !== '[object Object]') {
|
|
928
|
+
return _promise.default.reject(new _ParseError.default(_ParseError.default.OTHER_CAUSE, 'Auth must be an object.'));
|
|
929
|
+
}
|
|
930
|
+
var user = new this();
|
|
931
|
+
user._finishFetch({
|
|
932
|
+
username: username,
|
|
933
|
+
password: password,
|
|
934
|
+
authData: authData
|
|
935
|
+
});
|
|
936
|
+
return user.logIn(options);
|
|
937
|
+
}
|
|
938
|
+
|
|
883
939
|
/**
|
|
884
940
|
* Logs in a user with an objectId. On success, this saves the session
|
|
885
941
|
* to disk, so you can retrieve the currently logged in user using
|
|
@@ -1329,7 +1385,8 @@ var DefaultController = {
|
|
|
1329
1385
|
var stateController = _CoreManager.default.getObjectStateController();
|
|
1330
1386
|
var auth = {
|
|
1331
1387
|
username: user.get('username'),
|
|
1332
|
-
password: user.get('password')
|
|
1388
|
+
password: user.get('password'),
|
|
1389
|
+
authData: user.get('authData')
|
|
1333
1390
|
};
|
|
1334
1391
|
return RESTController.request(options.usePost ? 'POST' : 'GET', 'login', auth, options).then(function (response) {
|
|
1335
1392
|
user._migrateId(response.objectId);
|
package/lib/weapp/Storage.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
4
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
5
10
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
6
11
|
/**
|
|
@@ -88,4 +93,6 @@ var Storage = {
|
|
|
88
93
|
}
|
|
89
94
|
};
|
|
90
95
|
module.exports = Storage;
|
|
96
|
+
var _default = Storage;
|
|
97
|
+
exports.default = _default;
|
|
91
98
|
_CoreManager.default.setStorageController(require('./StorageController.weapp'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parse",
|
|
3
|
-
"version": "4.2.0-alpha.
|
|
3
|
+
"version": "4.2.0-alpha.10",
|
|
4
4
|
"description": "Parse JavaScript SDK",
|
|
5
5
|
"homepage": "https://parseplatform.org",
|
|
6
6
|
"keywords": [
|
|
@@ -29,22 +29,24 @@
|
|
|
29
29
|
"react-native": false
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@babel/runtime-corejs3": "7.
|
|
33
|
-
"idb-keyval": "6.2.
|
|
32
|
+
"@babel/runtime-corejs3": "7.22.10",
|
|
33
|
+
"idb-keyval": "6.2.1",
|
|
34
34
|
"react-native-crypto-js": "1.0.0",
|
|
35
35
|
"uuid": "9.0.0",
|
|
36
36
|
"ws": "8.13.0",
|
|
37
37
|
"xmlhttprequest": "1.8.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "7.
|
|
41
|
-
"@babel/eslint-parser": "7.21.
|
|
40
|
+
"@babel/core": "7.22.0",
|
|
41
|
+
"@babel/eslint-parser": "7.21.8",
|
|
42
42
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
43
|
-
"@babel/plugin-transform-flow-comments": "7.
|
|
43
|
+
"@babel/plugin-transform-flow-comments": "7.22.5",
|
|
44
44
|
"@babel/plugin-transform-flow-strip-types": "7.21.0",
|
|
45
45
|
"@babel/plugin-transform-runtime": "7.21.4",
|
|
46
|
-
"@babel/preset-env": "7.21.
|
|
47
|
-
"@babel/preset-react": "7.
|
|
46
|
+
"@babel/preset-env": "7.21.5",
|
|
47
|
+
"@babel/preset-react": "7.22.5",
|
|
48
|
+
"@babel/preset-typescript": "7.22.5",
|
|
49
|
+
"@definitelytyped/dtslint": "0.0.163",
|
|
48
50
|
"@parse/minami": "1.0.0",
|
|
49
51
|
"@saithodev/semantic-release-backmerge": "2.1.3",
|
|
50
52
|
"@semantic-release/changelog": "6.0.3",
|
|
@@ -59,9 +61,9 @@
|
|
|
59
61
|
"babel-plugin-transform-inline-environment-variables": "0.4.4",
|
|
60
62
|
"browserify": "17.0.0",
|
|
61
63
|
"codecov": "3.8.3",
|
|
62
|
-
"core-js": "3.30.
|
|
64
|
+
"core-js": "3.30.2",
|
|
63
65
|
"cross-env": "7.0.2",
|
|
64
|
-
"eslint": "8.
|
|
66
|
+
"eslint": "8.40.0",
|
|
65
67
|
"eslint-plugin-flowtype": "8.0.3",
|
|
66
68
|
"eslint-plugin-jsdoc": "43.0.7",
|
|
67
69
|
"express": "4.18.2",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"gulp-uglify": "3.0.2",
|
|
74
76
|
"gulp-watch": "5.0.1",
|
|
75
77
|
"husky": "8.0.3",
|
|
76
|
-
"jasmine": "
|
|
78
|
+
"jasmine": "5.0.0",
|
|
77
79
|
"jasmine-reporters": "2.5.2",
|
|
78
80
|
"jasmine-spec-reporter": "7.0.0",
|
|
79
81
|
"jest": "29.5.0",
|
|
@@ -81,11 +83,11 @@
|
|
|
81
83
|
"jsdoc": "4.0.2",
|
|
82
84
|
"jsdoc-babel": "0.5.0",
|
|
83
85
|
"lint-staged": "13.2.2",
|
|
84
|
-
"metro-react-native-babel-preset": "0.76.
|
|
85
|
-
"mongodb-runner": "4.
|
|
86
|
+
"metro-react-native-babel-preset": "0.76.4",
|
|
87
|
+
"mongodb-runner": "5.4.3",
|
|
86
88
|
"parse-server": "git+https://github.com/parse-community/parse-server#alpha",
|
|
87
|
-
"prettier": "
|
|
88
|
-
"puppeteer": "
|
|
89
|
+
"prettier": "3.0.2",
|
|
90
|
+
"puppeteer": "20.4.0",
|
|
89
91
|
"regenerator-runtime": "0.13.11",
|
|
90
92
|
"semantic-release": "19.0.5",
|
|
91
93
|
"vinyl-source-stream": "2.0.0"
|
|
@@ -95,11 +97,13 @@
|
|
|
95
97
|
},
|
|
96
98
|
"scripts": {
|
|
97
99
|
"build": "node build_releases.js",
|
|
100
|
+
"build:types": "tsc",
|
|
98
101
|
"release": "node build_releases.js && npm publish",
|
|
99
102
|
"test": "cross-env PARSE_BUILD=node jest",
|
|
100
103
|
"test:mongodb": "npm run test:mongodb:runnerstart && npm run integration",
|
|
101
|
-
"test:mongodb:runnerstart": "mongodb-runner start",
|
|
102
|
-
"
|
|
104
|
+
"test:mongodb:runnerstart": "mongodb-runner start -- --port 27017",
|
|
105
|
+
"test:types": "dtslint --expectOnly types",
|
|
106
|
+
"posttest:mongodb": "mongodb-runner stop --all",
|
|
103
107
|
"lint": "eslint --cache src/ integration/",
|
|
104
108
|
"lint:fix": "eslint --fix --cache src/ integration/",
|
|
105
109
|
"watch": "cross-env PARSE_BUILD=${PARSE_BUILD} gulp watch",
|