parse 8.6.1-alpha.1 → 8.6.1
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 +5 -3
- package/dist/parse.min.js +4 -2
- package/dist/parse.weapp.js +5 -3
- package/dist/parse.weapp.min.js +4 -2
- package/lib/browser/Cloud.js +1 -2
- package/lib/browser/CoreManager.js +2 -4
- package/lib/browser/EventuallyQueue.js +3 -4
- package/lib/browser/InstallationController.js +1 -2
- package/lib/browser/LiveQueryClient.js +16 -27
- package/lib/browser/LiveQuerySubscription.js +1 -7
- package/lib/browser/LocalDatastore.js +4 -6
- package/lib/browser/ObjectStateMutations.js +3 -31
- package/lib/browser/OfflineQuery.js +15 -19
- package/lib/browser/Parse.js +4 -39
- package/lib/browser/ParseCLP.js +20 -48
- package/lib/browser/ParseFile.js +23 -54
- package/lib/browser/ParseInstallation.js +2 -8
- package/lib/browser/ParseLiveQuery.js +1 -7
- package/lib/browser/ParseObject.js +13 -43
- package/lib/browser/ParseQuery.js +37 -78
- package/lib/browser/ParseSchema.js +6 -7
- package/lib/browser/ParseUser.js +18 -62
- package/lib/browser/Push.js +3 -6
- package/lib/browser/RESTController.js +7 -35
- package/lib/node/CoreManager.js +1 -1
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/weapp/Cloud.js +1 -2
- package/lib/weapp/CoreManager.js +2 -4
- package/lib/weapp/EventuallyQueue.js +3 -4
- package/lib/weapp/InstallationController.js +1 -2
- package/lib/weapp/LiveQueryClient.js +16 -27
- package/lib/weapp/LiveQuerySubscription.js +1 -7
- package/lib/weapp/LocalDatastore.js +4 -6
- package/lib/weapp/ObjectStateMutations.js +3 -31
- package/lib/weapp/OfflineQuery.js +15 -19
- package/lib/weapp/Parse.js +4 -39
- package/lib/weapp/ParseCLP.js +20 -48
- package/lib/weapp/ParseFile.js +23 -54
- package/lib/weapp/ParseInstallation.js +2 -8
- package/lib/weapp/ParseLiveQuery.js +1 -7
- package/lib/weapp/ParseObject.js +13 -43
- package/lib/weapp/ParseQuery.js +37 -78
- package/lib/weapp/ParseSchema.js +6 -7
- package/lib/weapp/ParseUser.js +18 -62
- package/lib/weapp/Push.js +3 -6
- package/lib/weapp/RESTController.js +7 -35
- package/package.json +10 -11
|
@@ -20,6 +20,7 @@ var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
|
|
|
20
20
|
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/splice"));
|
|
21
21
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
22
22
|
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
23
|
+
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
23
24
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
24
25
|
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
25
26
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
@@ -146,7 +147,7 @@ function handleOfflineSort(a, b, sorts) {
|
|
|
146
147
|
order = 'updatedAt';
|
|
147
148
|
}
|
|
148
149
|
if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {
|
|
149
|
-
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME,
|
|
150
|
+
throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${order}`);
|
|
150
151
|
}
|
|
151
152
|
const field1 = a.get(order);
|
|
152
153
|
const field2 = b.get(order);
|
|
@@ -600,12 +601,12 @@ class ParseQuery {
|
|
|
600
601
|
return this._handleOfflineQuery(this.toJSON());
|
|
601
602
|
}
|
|
602
603
|
return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(response => {
|
|
603
|
-
var
|
|
604
|
+
var _context4, _context5;
|
|
604
605
|
// Return generic object when explain is used
|
|
605
606
|
if (this._explain) {
|
|
606
607
|
return response.results;
|
|
607
608
|
}
|
|
608
|
-
const results = (
|
|
609
|
+
const results = ((_context4 = response.results) == null ? void 0 : (0, _bind.default)(_context5 = Function.call).call(_context5, (0, _map.default)(_context4), _context4))?.(data => {
|
|
609
610
|
// In cases of relations, the server may send back a className
|
|
610
611
|
// on the top level of the payload
|
|
611
612
|
const override = response.className || this.className;
|
|
@@ -752,10 +753,10 @@ class ParseQuery {
|
|
|
752
753
|
explain: this._explain,
|
|
753
754
|
readPreference: this._readPreference
|
|
754
755
|
};
|
|
755
|
-
if (
|
|
756
|
+
if (options?.rawValues !== undefined) {
|
|
756
757
|
params.rawValues = options.rawValues;
|
|
757
758
|
}
|
|
758
|
-
if (
|
|
759
|
+
if (options?.rawFieldNames !== undefined) {
|
|
759
760
|
params.rawFieldNames = options.rawFieldNames;
|
|
760
761
|
}
|
|
761
762
|
const aggregateOptions = _ParseObject.default._getRequestOptions(options);
|
|
@@ -785,8 +786,7 @@ class ParseQuery {
|
|
|
785
786
|
* @returns {Promise} A promise that is resolved with the object when
|
|
786
787
|
* the query completes.
|
|
787
788
|
*/
|
|
788
|
-
first() {
|
|
789
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
789
|
+
first(options = {}) {
|
|
790
790
|
const findOptions = _ParseObject.default._getRequestOptions(options);
|
|
791
791
|
this._setRequestTask(findOptions);
|
|
792
792
|
const controller = _CoreManager.default.getQueryController();
|
|
@@ -928,8 +928,7 @@ class ParseQuery {
|
|
|
928
928
|
* @param {boolean} explain Used to toggle the information on the query plan.
|
|
929
929
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
930
930
|
*/
|
|
931
|
-
explain() {
|
|
932
|
-
let explain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
931
|
+
explain(explain = true) {
|
|
933
932
|
if (typeof explain !== 'boolean') {
|
|
934
933
|
throw new Error('You can only set explain to a boolean value');
|
|
935
934
|
}
|
|
@@ -1066,11 +1065,8 @@ class ParseQuery {
|
|
|
1066
1065
|
*/
|
|
1067
1066
|
equalTo(key, value) {
|
|
1068
1067
|
if (key && typeof key === 'object') {
|
|
1069
|
-
var
|
|
1070
|
-
(0, _forEach.default)(
|
|
1071
|
-
let [k, val] = _ref;
|
|
1072
|
-
return this.equalTo(k, val);
|
|
1073
|
-
});
|
|
1068
|
+
var _context6;
|
|
1069
|
+
(0, _forEach.default)(_context6 = (0, _entries.default)(key)).call(_context6, ([k, val]) => this.equalTo(k, val));
|
|
1074
1070
|
return this;
|
|
1075
1071
|
}
|
|
1076
1072
|
if (typeof value === 'undefined') {
|
|
@@ -1090,11 +1086,8 @@ class ParseQuery {
|
|
|
1090
1086
|
*/
|
|
1091
1087
|
notEqualTo(key, value) {
|
|
1092
1088
|
if (key && typeof key === 'object') {
|
|
1093
|
-
var
|
|
1094
|
-
(0, _forEach.default)(
|
|
1095
|
-
let [k, val] = _ref2;
|
|
1096
|
-
return this.notEqualTo(k, val);
|
|
1097
|
-
});
|
|
1089
|
+
var _context7;
|
|
1090
|
+
(0, _forEach.default)(_context7 = (0, _entries.default)(key)).call(_context7, ([k, val]) => this.notEqualTo(k, val));
|
|
1098
1091
|
return this;
|
|
1099
1092
|
}
|
|
1100
1093
|
return this._addCondition(key, '$ne', value);
|
|
@@ -1404,7 +1397,7 @@ class ParseQuery {
|
|
|
1404
1397
|
fullOptions.$diacriticSensitive = options[option];
|
|
1405
1398
|
break;
|
|
1406
1399
|
default:
|
|
1407
|
-
throw new Error(
|
|
1400
|
+
throw new Error(`Unknown option: ${option}`);
|
|
1408
1401
|
}
|
|
1409
1402
|
}
|
|
1410
1403
|
return this._addCondition(key, '$text', {
|
|
@@ -1594,11 +1587,8 @@ class ParseQuery {
|
|
|
1594
1587
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
1595
1588
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1596
1589
|
*/
|
|
1597
|
-
ascending() {
|
|
1590
|
+
ascending(...keys) {
|
|
1598
1591
|
this._order = [];
|
|
1599
|
-
for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1600
|
-
keys[_key] = arguments[_key];
|
|
1601
|
-
}
|
|
1602
1592
|
return this.addAscending.apply(this, keys);
|
|
1603
1593
|
}
|
|
1604
1594
|
|
|
@@ -1610,19 +1600,16 @@ class ParseQuery {
|
|
|
1610
1600
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
1611
1601
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1612
1602
|
*/
|
|
1613
|
-
addAscending() {
|
|
1603
|
+
addAscending(...keys) {
|
|
1614
1604
|
if (!this._order) {
|
|
1615
1605
|
this._order = [];
|
|
1616
1606
|
}
|
|
1617
|
-
for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1618
|
-
keys[_key2] = arguments[_key2];
|
|
1619
|
-
}
|
|
1620
1607
|
(0, _forEach.default)(keys).call(keys, key => {
|
|
1621
|
-
var
|
|
1608
|
+
var _context8;
|
|
1622
1609
|
if ((0, _isArray.default)(key)) {
|
|
1623
1610
|
key = key.join();
|
|
1624
1611
|
}
|
|
1625
|
-
this._order = (0, _concat.default)(
|
|
1612
|
+
this._order = (0, _concat.default)(_context8 = this._order).call(_context8, key.replace(/\s/g, '').split(','));
|
|
1626
1613
|
});
|
|
1627
1614
|
return this;
|
|
1628
1615
|
}
|
|
@@ -1634,11 +1621,8 @@ class ParseQuery {
|
|
|
1634
1621
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
1635
1622
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1636
1623
|
*/
|
|
1637
|
-
descending() {
|
|
1624
|
+
descending(...keys) {
|
|
1638
1625
|
this._order = [];
|
|
1639
|
-
for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1640
|
-
keys[_key3] = arguments[_key3];
|
|
1641
|
-
}
|
|
1642
1626
|
return this.addDescending.apply(this, keys);
|
|
1643
1627
|
}
|
|
1644
1628
|
|
|
@@ -1650,19 +1634,16 @@ class ParseQuery {
|
|
|
1650
1634
|
* string of comma separated values, or an Array of keys, or multiple keys.
|
|
1651
1635
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1652
1636
|
*/
|
|
1653
|
-
addDescending() {
|
|
1637
|
+
addDescending(...keys) {
|
|
1654
1638
|
if (!this._order) {
|
|
1655
1639
|
this._order = [];
|
|
1656
1640
|
}
|
|
1657
|
-
for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1658
|
-
keys[_key4] = arguments[_key4];
|
|
1659
|
-
}
|
|
1660
1641
|
(0, _forEach.default)(keys).call(keys, key => {
|
|
1661
|
-
var
|
|
1642
|
+
var _context9, _context0;
|
|
1662
1643
|
if ((0, _isArray.default)(key)) {
|
|
1663
1644
|
key = key.join();
|
|
1664
1645
|
}
|
|
1665
|
-
this._order = (0, _concat.default)(
|
|
1646
|
+
this._order = (0, _concat.default)(_context9 = this._order).call(_context9, (0, _map.default)(_context0 = key.replace(/\s/g, '').split(',')).call(_context0, k => {
|
|
1666
1647
|
return '-' + k;
|
|
1667
1648
|
}));
|
|
1668
1649
|
});
|
|
@@ -1710,8 +1691,7 @@ class ParseQuery {
|
|
|
1710
1691
|
* @param {boolean} includeCount false - disable, true - enable.
|
|
1711
1692
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1712
1693
|
*/
|
|
1713
|
-
withCount() {
|
|
1714
|
-
let includeCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1694
|
+
withCount(includeCount = true) {
|
|
1715
1695
|
if (typeof includeCount !== 'boolean') {
|
|
1716
1696
|
throw new Error('You can only set withCount to a boolean value');
|
|
1717
1697
|
}
|
|
@@ -1729,14 +1709,11 @@ class ParseQuery {
|
|
|
1729
1709
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to include.
|
|
1730
1710
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1731
1711
|
*/
|
|
1732
|
-
include() {
|
|
1733
|
-
for (var _len5 = arguments.length, keys = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1734
|
-
keys[_key5] = arguments[_key5];
|
|
1735
|
-
}
|
|
1712
|
+
include(...keys) {
|
|
1736
1713
|
(0, _forEach.default)(keys).call(keys, key => {
|
|
1737
1714
|
if ((0, _isArray.default)(key)) {
|
|
1738
|
-
var
|
|
1739
|
-
this._include = (0, _concat.default)(
|
|
1715
|
+
var _context1;
|
|
1716
|
+
this._include = (0, _concat.default)(_context1 = this._include).call(_context1, key);
|
|
1740
1717
|
} else {
|
|
1741
1718
|
this._include.push(key);
|
|
1742
1719
|
}
|
|
@@ -1768,17 +1745,14 @@ class ParseQuery {
|
|
|
1768
1745
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to include.
|
|
1769
1746
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1770
1747
|
*/
|
|
1771
|
-
select() {
|
|
1748
|
+
select(...keys) {
|
|
1772
1749
|
if (!this._select) {
|
|
1773
1750
|
this._select = [];
|
|
1774
1751
|
}
|
|
1775
|
-
for (var _len6 = arguments.length, keys = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
1776
|
-
keys[_key6] = arguments[_key6];
|
|
1777
|
-
}
|
|
1778
1752
|
(0, _forEach.default)(keys).call(keys, key => {
|
|
1779
1753
|
if ((0, _isArray.default)(key)) {
|
|
1780
|
-
var
|
|
1781
|
-
this._select = (0, _concat.default)(
|
|
1754
|
+
var _context10;
|
|
1755
|
+
this._select = (0, _concat.default)(_context10 = this._select).call(_context10, key);
|
|
1782
1756
|
} else {
|
|
1783
1757
|
this._select.push(key);
|
|
1784
1758
|
}
|
|
@@ -1795,14 +1769,11 @@ class ParseQuery {
|
|
|
1795
1769
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.
|
|
1796
1770
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1797
1771
|
*/
|
|
1798
|
-
exclude() {
|
|
1799
|
-
for (var _len7 = arguments.length, keys = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
1800
|
-
keys[_key7] = arguments[_key7];
|
|
1801
|
-
}
|
|
1772
|
+
exclude(...keys) {
|
|
1802
1773
|
(0, _forEach.default)(keys).call(keys, key => {
|
|
1803
1774
|
if ((0, _isArray.default)(key)) {
|
|
1804
|
-
var
|
|
1805
|
-
this._exclude = (0, _concat.default)(
|
|
1775
|
+
var _context11;
|
|
1776
|
+
this._exclude = (0, _concat.default)(_context11 = this._exclude).call(_context11, key);
|
|
1806
1777
|
} else {
|
|
1807
1778
|
this._exclude.push(key);
|
|
1808
1779
|
}
|
|
@@ -1818,14 +1789,11 @@ class ParseQuery {
|
|
|
1818
1789
|
* @param {...string|Array<string>} keys The name(s) of the key(s) to watch.
|
|
1819
1790
|
* @returns {Parse.Query} Returns the query, so you can chain this call.
|
|
1820
1791
|
*/
|
|
1821
|
-
watch() {
|
|
1822
|
-
for (var _len8 = arguments.length, keys = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
1823
|
-
keys[_key8] = arguments[_key8];
|
|
1824
|
-
}
|
|
1792
|
+
watch(...keys) {
|
|
1825
1793
|
(0, _forEach.default)(keys).call(keys, key => {
|
|
1826
1794
|
if ((0, _isArray.default)(key)) {
|
|
1827
|
-
var
|
|
1828
|
-
this._watch = (0, _concat.default)(
|
|
1795
|
+
var _context12;
|
|
1796
|
+
this._watch = (0, _concat.default)(_context12 = this._watch).call(_context12, key);
|
|
1829
1797
|
} else {
|
|
1830
1798
|
this._watch.push(key);
|
|
1831
1799
|
}
|
|
@@ -1882,10 +1850,7 @@ class ParseQuery {
|
|
|
1882
1850
|
* @static
|
|
1883
1851
|
* @returns {Parse.Query} The query that is the OR of the passed in queries.
|
|
1884
1852
|
*/
|
|
1885
|
-
static or() {
|
|
1886
|
-
for (var _len9 = arguments.length, queries = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
1887
|
-
queries[_key9] = arguments[_key9];
|
|
1888
|
-
}
|
|
1853
|
+
static or(...queries) {
|
|
1889
1854
|
const className = _getClassNameFromQueries(queries);
|
|
1890
1855
|
const query = new ParseQuery(className);
|
|
1891
1856
|
query._orQuery(queries);
|
|
@@ -1904,10 +1869,7 @@ class ParseQuery {
|
|
|
1904
1869
|
* @static
|
|
1905
1870
|
* @returns {Parse.Query} The query that is the AND of the passed in queries.
|
|
1906
1871
|
*/
|
|
1907
|
-
static and() {
|
|
1908
|
-
for (var _len0 = arguments.length, queries = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
1909
|
-
queries[_key0] = arguments[_key0];
|
|
1910
|
-
}
|
|
1872
|
+
static and(...queries) {
|
|
1911
1873
|
const className = _getClassNameFromQueries(queries);
|
|
1912
1874
|
const query = new ParseQuery(className);
|
|
1913
1875
|
query._andQuery(queries);
|
|
@@ -1926,10 +1888,7 @@ class ParseQuery {
|
|
|
1926
1888
|
* @static
|
|
1927
1889
|
* @returns {Parse.Query} The query that is the NOR of the passed in queries.
|
|
1928
1890
|
*/
|
|
1929
|
-
static nor() {
|
|
1930
|
-
for (var _len1 = arguments.length, queries = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
|
|
1931
|
-
queries[_key1] = arguments[_key1];
|
|
1932
|
-
}
|
|
1891
|
+
static nor(...queries) {
|
|
1933
1892
|
const className = _getClassNameFromQueries(queries);
|
|
1934
1893
|
const query = new ParseQuery(className);
|
|
1935
1894
|
query._norQuery(queries);
|
|
@@ -194,7 +194,7 @@ class ParseSchema {
|
|
|
194
194
|
throw new Error('field name may not be null.');
|
|
195
195
|
}
|
|
196
196
|
if ((0, _indexOf.default)(FIELD_TYPES).call(FIELD_TYPES, type) === -1) {
|
|
197
|
-
throw new Error(
|
|
197
|
+
throw new Error(`${type} is not a valid type.`);
|
|
198
198
|
}
|
|
199
199
|
if (type === 'Pointer') {
|
|
200
200
|
return this.addPointer(name, options.targetClass, options);
|
|
@@ -382,10 +382,10 @@ class ParseSchema {
|
|
|
382
382
|
type: 'Pointer',
|
|
383
383
|
targetClass
|
|
384
384
|
};
|
|
385
|
-
if (typeof
|
|
385
|
+
if (typeof options?.required === 'boolean') {
|
|
386
386
|
fieldOptions.required = options.required;
|
|
387
387
|
}
|
|
388
|
-
if (
|
|
388
|
+
if (options?.defaultValue !== undefined) {
|
|
389
389
|
fieldOptions.defaultValue = options.defaultValue;
|
|
390
390
|
if (options.defaultValue instanceof _ParseObject.default) {
|
|
391
391
|
fieldOptions.defaultValue = options.defaultValue.toPointer();
|
|
@@ -443,10 +443,9 @@ class ParseSchema {
|
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
445
|
const DefaultController = {
|
|
446
|
-
send(className, method) {
|
|
447
|
-
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
446
|
+
send(className, method, params = {}) {
|
|
448
447
|
const RESTController = _CoreManager.default.getRESTController();
|
|
449
|
-
return RESTController.request(method,
|
|
448
|
+
return RESTController.request(method, `schemas/${className}`, params, {
|
|
450
449
|
useMasterKey: true
|
|
451
450
|
});
|
|
452
451
|
},
|
|
@@ -464,7 +463,7 @@ const DefaultController = {
|
|
|
464
463
|
},
|
|
465
464
|
purge(className) {
|
|
466
465
|
const RESTController = _CoreManager.default.getRESTController();
|
|
467
|
-
return RESTController.request('DELETE',
|
|
466
|
+
return RESTController.request('DELETE', `purge/${className}`, {}, {
|
|
468
467
|
useMasterKey: true
|
|
469
468
|
});
|
|
470
469
|
}
|
package/lib/browser/ParseUser.js
CHANGED
|
@@ -1,49 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
5
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
6
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
7
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
8
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
9
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
10
3
|
var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
11
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
5
|
_Object$defineProperty2(exports, "__esModule", {
|
|
13
6
|
value: true
|
|
14
7
|
});
|
|
15
8
|
exports.default = void 0;
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
17
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
18
|
-
var
|
|
10
|
+
var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
|
19
11
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
20
12
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
21
13
|
var _isRevocableSession = _interopRequireDefault(require("./isRevocableSession"));
|
|
22
14
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
23
15
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
24
16
|
var _Storage = _interopRequireDefault(require("./Storage"));
|
|
25
|
-
function ownKeys(e, r) {
|
|
26
|
-
var t = _Object$keys(e);
|
|
27
|
-
if (_Object$getOwnPropertySymbols) {
|
|
28
|
-
var o = _Object$getOwnPropertySymbols(e);
|
|
29
|
-
r && (o = _filterInstanceProperty(o).call(o, function (r) {
|
|
30
|
-
return _Object$getOwnPropertyDescriptor(e, r).enumerable;
|
|
31
|
-
})), t.push.apply(t, o);
|
|
32
|
-
}
|
|
33
|
-
return t;
|
|
34
|
-
}
|
|
35
|
-
function _objectSpread(e) {
|
|
36
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
37
|
-
var _context, _context2;
|
|
38
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
39
|
-
r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) {
|
|
40
|
-
(0, _defineProperty2.default)(e, r, t[r]);
|
|
41
|
-
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) {
|
|
42
|
-
_Object$defineProperty2(e, r, _Object$getOwnPropertyDescriptor(t, r));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return e;
|
|
46
|
-
}
|
|
47
17
|
const CURRENT_USER_KEY = 'currentUser';
|
|
48
18
|
let canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
|
|
49
19
|
let currentUserCacheMatchesDisk = false;
|
|
@@ -108,8 +78,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
108
78
|
* @param {object} saveOpts useMasterKey / sessionToken
|
|
109
79
|
* @returns {Promise} A promise that is fulfilled with the user is linked
|
|
110
80
|
*/
|
|
111
|
-
linkWith(provider, options) {
|
|
112
|
-
let saveOpts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
81
|
+
linkWith(provider, options, saveOpts = {}) {
|
|
113
82
|
saveOpts.sessionToken = saveOpts.sessionToken || this.getSessionToken() || '';
|
|
114
83
|
let authType;
|
|
115
84
|
if (typeof provider === 'string') {
|
|
@@ -173,8 +142,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
173
142
|
* @deprecated since 2.9.0 see {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.User.html#linkWith linkWith}
|
|
174
143
|
* @returns {Promise}
|
|
175
144
|
*/
|
|
176
|
-
_linkWith(provider, options) {
|
|
177
|
-
let saveOpts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
145
|
+
_linkWith(provider, options, saveOpts = {}) {
|
|
178
146
|
return this.linkWith(provider, options, saveOpts);
|
|
179
147
|
}
|
|
180
148
|
|
|
@@ -472,8 +440,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
472
440
|
* @returns {Promise} A promise that is fulfilled with the user when
|
|
473
441
|
* the login is complete.
|
|
474
442
|
*/
|
|
475
|
-
logIn() {
|
|
476
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
443
|
+
logIn(options = {}) {
|
|
477
444
|
const loginOptions = _ParseObject.default._getRequestOptions(options);
|
|
478
445
|
if (!Object.hasOwn(loginOptions, 'usePost')) {
|
|
479
446
|
loginOptions.usePost = true;
|
|
@@ -489,10 +456,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
489
456
|
* @param {...any} args
|
|
490
457
|
* @returns {Promise}
|
|
491
458
|
*/
|
|
492
|
-
async save() {
|
|
493
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
494
|
-
args[_key] = arguments[_key];
|
|
495
|
-
}
|
|
459
|
+
async save(...args) {
|
|
496
460
|
await super.save.apply(this, args);
|
|
497
461
|
const current = await this.isCurrentAsync();
|
|
498
462
|
if (current) {
|
|
@@ -508,10 +472,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
508
472
|
* @param {...any} args
|
|
509
473
|
* @returns {Parse.User}
|
|
510
474
|
*/
|
|
511
|
-
async destroy() {
|
|
512
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
513
|
-
args[_key2] = arguments[_key2];
|
|
514
|
-
}
|
|
475
|
+
async destroy(...args) {
|
|
515
476
|
await super.destroy.apply(this, args);
|
|
516
477
|
const current = await this.isCurrentAsync();
|
|
517
478
|
if (current) {
|
|
@@ -527,10 +488,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
527
488
|
* @param {...any} args
|
|
528
489
|
* @returns {Parse.User}
|
|
529
490
|
*/
|
|
530
|
-
async fetch() {
|
|
531
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
532
|
-
args[_key3] = arguments[_key3];
|
|
533
|
-
}
|
|
491
|
+
async fetch(...args) {
|
|
534
492
|
await super.fetch.apply(this, args);
|
|
535
493
|
const current = await this.isCurrentAsync();
|
|
536
494
|
if (current) {
|
|
@@ -546,10 +504,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
546
504
|
* @param {...any} args
|
|
547
505
|
* @returns {Parse.User}
|
|
548
506
|
*/
|
|
549
|
-
async fetchWithInclude() {
|
|
550
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
551
|
-
args[_key4] = arguments[_key4];
|
|
552
|
-
}
|
|
507
|
+
async fetchWithInclude(...args) {
|
|
553
508
|
await super.fetchWithInclude.apply(this, args);
|
|
554
509
|
const current = await this.isCurrentAsync();
|
|
555
510
|
if (current) {
|
|
@@ -587,7 +542,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
587
542
|
if (protoProps) {
|
|
588
543
|
for (const prop in protoProps) {
|
|
589
544
|
if (prop !== 'className') {
|
|
590
|
-
(0,
|
|
545
|
+
(0, _defineProperty.default)(ParseUser.prototype, prop, {
|
|
591
546
|
value: protoProps[prop],
|
|
592
547
|
enumerable: false,
|
|
593
548
|
writable: true,
|
|
@@ -599,7 +554,7 @@ class ParseUser extends _ParseObject.default {
|
|
|
599
554
|
if (classProps) {
|
|
600
555
|
for (const prop in classProps) {
|
|
601
556
|
if (prop !== 'className') {
|
|
602
|
-
(0,
|
|
557
|
+
(0, _defineProperty.default)(ParseUser, prop, {
|
|
603
558
|
value: classProps[prop],
|
|
604
559
|
enumerable: false,
|
|
605
560
|
writable: true,
|
|
@@ -1182,7 +1137,7 @@ const DefaultController = {
|
|
|
1182
1137
|
},
|
|
1183
1138
|
logOut(options) {
|
|
1184
1139
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1185
|
-
if (options
|
|
1140
|
+
if (options?.sessionToken) {
|
|
1186
1141
|
return RESTController.request('POST', 'logout', {}, options);
|
|
1187
1142
|
}
|
|
1188
1143
|
return DefaultController.currentUserAsync().then(currentUser => {
|
|
@@ -1222,7 +1177,7 @@ const DefaultController = {
|
|
|
1222
1177
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1223
1178
|
const result = await RESTController.request('POST', 'upgradeToRevocableSession', {}, options);
|
|
1224
1179
|
user._finishFetch({
|
|
1225
|
-
sessionToken:
|
|
1180
|
+
sessionToken: result?.sessionToken || ''
|
|
1226
1181
|
});
|
|
1227
1182
|
const current = await user.isCurrentAsync();
|
|
1228
1183
|
if (current) {
|
|
@@ -1242,12 +1197,13 @@ const DefaultController = {
|
|
|
1242
1197
|
},
|
|
1243
1198
|
verifyPassword(username, password, options) {
|
|
1244
1199
|
const RESTController = _CoreManager.default.getRESTController();
|
|
1245
|
-
const data =
|
|
1200
|
+
const data = {
|
|
1246
1201
|
username,
|
|
1247
|
-
password
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1202
|
+
password,
|
|
1203
|
+
...(options.ignoreEmailVerification !== undefined && {
|
|
1204
|
+
ignoreEmailVerification: options.ignoreEmailVerification
|
|
1205
|
+
})
|
|
1206
|
+
};
|
|
1251
1207
|
return RESTController.request('GET', 'verifyPassword', data, options);
|
|
1252
1208
|
},
|
|
1253
1209
|
requestEmailVerification(email, options) {
|
package/lib/browser/Push.js
CHANGED
|
@@ -47,8 +47,7 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
|
47
47
|
* @returns {Promise} A promise that is fulfilled when the push request
|
|
48
48
|
* completes and returns `pushStatusId`.
|
|
49
49
|
*/
|
|
50
|
-
function send(data) {
|
|
51
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50
|
+
function send(data, options = {}) {
|
|
52
51
|
if (data.where && data.where instanceof _ParseQuery.default) {
|
|
53
52
|
data.where = data.where.toJSON().where;
|
|
54
53
|
}
|
|
@@ -83,8 +82,7 @@ function send(data) {
|
|
|
83
82
|
* </ul>
|
|
84
83
|
* @returns {Parse.Object} Status of Push.
|
|
85
84
|
*/
|
|
86
|
-
function getPushStatus(pushStatusId) {
|
|
87
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
85
|
+
function getPushStatus(pushStatusId, options = {}) {
|
|
88
86
|
const pushOptions = {
|
|
89
87
|
useMasterKey: true
|
|
90
88
|
};
|
|
@@ -96,10 +94,9 @@ function getPushStatus(pushStatusId) {
|
|
|
96
94
|
}
|
|
97
95
|
const DefaultController = {
|
|
98
96
|
async send(data, options) {
|
|
99
|
-
var _response$_headers;
|
|
100
97
|
options.returnStatus = true;
|
|
101
98
|
const response = await _CoreManager.default.getRESTController().request('POST', 'push', data, options);
|
|
102
|
-
return
|
|
99
|
+
return response._headers?.['X-Parse-Push-Status-Id'];
|
|
103
100
|
}
|
|
104
101
|
};
|
|
105
102
|
_CoreManager.default.setPushController(DefaultController);
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
-
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
5
|
-
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
6
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
7
|
-
var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
8
|
-
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
9
|
-
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
10
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
11
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
13
6
|
value: true
|
|
14
7
|
});
|
|
15
8
|
exports.default = void 0;
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
17
9
|
var _endsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/ends-with"));
|
|
18
10
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
19
11
|
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/starts-with"));
|
|
@@ -27,28 +19,8 @@ var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
|
27
19
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
28
20
|
var _promiseUtils = require("./promiseUtils");
|
|
29
21
|
var _Xhr = require("./Xhr.weapp");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (_Object$getOwnPropertySymbols) {
|
|
33
|
-
var o = _Object$getOwnPropertySymbols(e);
|
|
34
|
-
r && (o = _filterInstanceProperty(o).call(o, function (r) {
|
|
35
|
-
return _Object$getOwnPropertyDescriptor(e, r).enumerable;
|
|
36
|
-
})), t.push.apply(t, o);
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
function _objectSpread(e) {
|
|
41
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
42
|
-
var _context4, _context5;
|
|
43
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
44
|
-
r % 2 ? _forEachInstanceProperty2(_context4 = ownKeys(Object(t), !0)).call(_context4, function (r) {
|
|
45
|
-
(0, _defineProperty2.default)(e, r, t[r]);
|
|
46
|
-
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty2(_context5 = ownKeys(Object(t))).call(_context5, function (r) {
|
|
47
|
-
_Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r));
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return e;
|
|
51
|
-
} /* global XMLHttpRequest, XDomainRequest */
|
|
22
|
+
/* global XMLHttpRequest, XDomainRequest */
|
|
23
|
+
|
|
52
24
|
/** Base options for all Parse requests that go through _getRequestOptions */
|
|
53
25
|
|
|
54
26
|
let useXDomainRequest = false;
|
|
@@ -189,7 +161,7 @@ const RESTController = {
|
|
|
189
161
|
break;
|
|
190
162
|
}
|
|
191
163
|
chunks.push(value);
|
|
192
|
-
recieved +=
|
|
164
|
+
recieved += value?.length || 0;
|
|
193
165
|
options.progress(recieved / length, recieved, length);
|
|
194
166
|
}
|
|
195
167
|
const body = new Uint8Array(recieved);
|
|
@@ -239,7 +211,6 @@ const RESTController = {
|
|
|
239
211
|
promise.reject(response);
|
|
240
212
|
}
|
|
241
213
|
} catch (error) {
|
|
242
|
-
var _error$cause;
|
|
243
214
|
if (error.name === 'AbortError') {
|
|
244
215
|
promise.resolve({
|
|
245
216
|
response: {
|
|
@@ -247,7 +218,7 @@ const RESTController = {
|
|
|
247
218
|
},
|
|
248
219
|
status: 0
|
|
249
220
|
});
|
|
250
|
-
} else if (
|
|
221
|
+
} else if (error.cause?.code === 'ECONNREFUSED') {
|
|
251
222
|
promise.reject('Unable to connect to the Parse API');
|
|
252
223
|
} else {
|
|
253
224
|
promise.reject(error);
|
|
@@ -351,10 +322,11 @@ const RESTController = {
|
|
|
351
322
|
headers
|
|
352
323
|
} = result;
|
|
353
324
|
if (options.returnStatus) {
|
|
354
|
-
return
|
|
325
|
+
return {
|
|
326
|
+
...response,
|
|
355
327
|
_status: status,
|
|
356
328
|
_headers: headers
|
|
357
|
-
}
|
|
329
|
+
};
|
|
358
330
|
} else {
|
|
359
331
|
return response;
|
|
360
332
|
}
|
package/lib/node/CoreManager.js
CHANGED
package/lib/weapp/Cloud.js
CHANGED
|
@@ -125,12 +125,11 @@ const DefaultController = {
|
|
|
125
125
|
return RESTController.request('GET', 'cloud_code/jobs/data', null, options);
|
|
126
126
|
},
|
|
127
127
|
async startJob(name, data, options) {
|
|
128
|
-
var _response$_headers;
|
|
129
128
|
const RESTController = _CoreManager.default.getRESTController();
|
|
130
129
|
const payload = (0, _encode.default)(data, true);
|
|
131
130
|
options.returnStatus = true;
|
|
132
131
|
const response = await RESTController.request('POST', 'jobs/' + name, payload, options);
|
|
133
|
-
return
|
|
132
|
+
return response._headers?.['X-Parse-Job-Status-Id'];
|
|
134
133
|
}
|
|
135
134
|
};
|
|
136
135
|
_CoreManager.default.setCloudController(DefaultController);
|