parse 3.4.2 → 3.4.3-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.
- package/README.md +1 -1
- package/dist/parse.js +71 -54
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +71 -54
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/LiveQueryClient.js +1 -1
- package/lib/browser/ParseFile.js +52 -46
- package/lib/browser/ParseRole.js +17 -6
- package/lib/browser/ParseUser.js +1 -1
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/LiveQueryClient.js +1 -1
- package/lib/node/ParseFile.js +20 -18
- package/lib/node/ParseRole.js +16 -6
- package/lib/node/ParseUser.js +1 -1
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +1 -1
- package/lib/react-native/ParseFile.js +20 -19
- package/lib/react-native/ParseRole.js +17 -6
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/LiveQueryClient.js +1 -1
- package/lib/weapp/ParseFile.js +52 -46
- package/lib/weapp/ParseRole.js +17 -6
- package/lib/weapp/ParseUser.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
[](https://github.com/parse-community/parse-dashboard/releases)
|
|
12
12
|
|
|
13
13
|
[](https://www.npmjs.com/package/parse)
|
|
14
|
+
[](https://www.npmjs.com/package/parse)
|
|
14
15
|
[](https://www.npmjs.com/package/parse)
|
|
15
|
-
<!-- [](https://www.npmjs.com/package/parse) -->
|
|
16
16
|
|
|
17
17
|
[][open-collective-link]
|
|
18
18
|
[][open-collective-link]
|
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v3.4.
|
|
2
|
+
* Parse JavaScript SDK v3.4.3-alpha.3
|
|
3
3
|
*
|
|
4
4
|
* The source tree of this library can be found at
|
|
5
5
|
* https://github.com/ParsePlatform/Parse-SDK-JS
|
|
@@ -699,7 +699,7 @@ var config
|
|
|
699
699
|
SERVER_AUTH_TOKEN: null,
|
|
700
700
|
LIVEQUERY_SERVER_URL: null,
|
|
701
701
|
ENCRYPTED_KEY: null,
|
|
702
|
-
VERSION: 'js' + "3.4.
|
|
702
|
+
VERSION: 'js' + "3.4.3-alpha.3",
|
|
703
703
|
APPLICATION_ID: null,
|
|
704
704
|
JAVASCRIPT_KEY: null,
|
|
705
705
|
MASTER_KEY: null,
|
|
@@ -2772,7 +2772,7 @@ var LiveQueryClient = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2772
2772
|
|
|
2773
2773
|
delete data.object.__type;
|
|
2774
2774
|
|
|
2775
|
-
var parseObject = _ParseObject.default.fromJSON(data.object, override);
|
|
2775
|
+
var parseObject = _ParseObject.default.fromJSON(data.object, !(subscription.query && subscription.query._select) ? override : false);
|
|
2776
2776
|
|
|
2777
2777
|
if (data.original) {
|
|
2778
2778
|
subscription.emit(data.op, parseObject, data.original, response);
|
|
@@ -8390,6 +8390,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8390
8390
|
|
|
8391
8391
|
exports.default = void 0;
|
|
8392
8392
|
|
|
8393
|
+
var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
8394
|
+
|
|
8393
8395
|
var _slicedToArray2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
8394
8396
|
|
|
8395
8397
|
var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
@@ -8406,8 +8408,6 @@ var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/
|
|
|
8406
8408
|
|
|
8407
8409
|
var _slice = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
8408
8410
|
|
|
8409
|
-
var _indexOf = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
8410
|
-
|
|
8411
8411
|
var _isArray = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
8412
8412
|
|
|
8413
8413
|
var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -8434,12 +8434,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
8434
8434
|
|
|
8435
8435
|
function _objectSpread(target) {
|
|
8436
8436
|
for (var i = 1; i < arguments.length; i++) {
|
|
8437
|
-
var
|
|
8437
|
+
var _context8, _context9;
|
|
8438
8438
|
|
|
8439
8439
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
8440
|
-
i % 2 ? _forEachInstanceProperty2(
|
|
8440
|
+
i % 2 ? _forEachInstanceProperty2(_context8 = ownKeys(Object(source), !0)).call(_context8, function (key) {
|
|
8441
8441
|
(0, _defineProperty2.default)(target, key, source[key]);
|
|
8442
|
-
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(
|
|
8442
|
+
}) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context9 = ownKeys(Object(source))).call(_context9, function (key) {
|
|
8443
8443
|
_Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
|
|
8444
8444
|
});
|
|
8445
8445
|
}
|
|
@@ -8477,7 +8477,8 @@ if (typeof XMLHttpRequest !== 'undefined') {
|
|
|
8477
8477
|
uri: string,
|
|
8478
8478
|
type: string,
|
|
8479
8479
|
};*/
|
|
8480
|
-
var
|
|
8480
|
+
var base64Regex = new RegExp('([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))', 'i');
|
|
8481
|
+
var dataUriRegex = new RegExp("^data:([a-zA-Z]+\\/[-a-zA-Z0-9+.]+(;[a-z-]+=[a-zA-Z0-9+.-]+)?)?(;base64)?,(".concat(base64Regex.source, ")*$"), 'i');
|
|
8481
8482
|
|
|
8482
8483
|
function b64Digit(number
|
|
8483
8484
|
/*: number*/
|
|
@@ -8591,26 +8592,31 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
8591
8592
|
type: specifiedType
|
|
8592
8593
|
};
|
|
8593
8594
|
} else if (data && typeof data.base64 === 'string') {
|
|
8594
|
-
var
|
|
8595
|
-
var commaIndex = (0, _indexOf.default)(base64).call(base64, ',');
|
|
8595
|
+
var _context, _context2, _context3; // Check if data URI or base64 string is valid
|
|
8596
8596
|
|
|
8597
|
-
if (commaIndex !== -1) {
|
|
8598
|
-
var matches = dataUriRegexp.exec((0, _slice.default)(base64).call(base64, 0, commaIndex + 1)); // if data URI with type and charset, there will be 4 matches.
|
|
8599
8597
|
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
type: matches[1]
|
|
8605
|
-
};
|
|
8606
|
-
} else {
|
|
8607
|
-
this._data = base64;
|
|
8608
|
-
this._source = {
|
|
8609
|
-
format: 'base64',
|
|
8610
|
-
base64: base64,
|
|
8611
|
-
type: specifiedType
|
|
8612
|
-
};
|
|
8598
|
+
var validationRegex = new RegExp(base64Regex.source + '|' + dataUriRegex.source, 'i');
|
|
8599
|
+
|
|
8600
|
+
if (!validationRegex.test(data.base64)) {
|
|
8601
|
+
throw new Error('Cannot create a Parse.File without valid data URIs or base64 encoded data.');
|
|
8613
8602
|
}
|
|
8603
|
+
|
|
8604
|
+
var base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];
|
|
8605
|
+
|
|
8606
|
+
var _type = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || ''; // https://tools.ietf.org/html/rfc2397
|
|
8607
|
+
// If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII.
|
|
8608
|
+
// As a shorthand, "text/plain" can be omitted but the charset parameter supplied.
|
|
8609
|
+
|
|
8610
|
+
|
|
8611
|
+
if (dataUriRegex.test(data.base64)) {
|
|
8612
|
+
_type = _type || 'text/plain';
|
|
8613
|
+
}
|
|
8614
|
+
|
|
8615
|
+
this._source = {
|
|
8616
|
+
format: 'base64',
|
|
8617
|
+
base64: base64,
|
|
8618
|
+
type: _type
|
|
8619
|
+
};
|
|
8614
8620
|
} else {
|
|
8615
8621
|
throw new TypeError('Cannot create a Parse.File with that data.');
|
|
8616
8622
|
}
|
|
@@ -8632,20 +8638,20 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
8632
8638
|
var _this = this;
|
|
8633
8639
|
|
|
8634
8640
|
var options, controller, result;
|
|
8635
|
-
return _regenerator.default.wrap(function (
|
|
8641
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
8636
8642
|
while (1) {
|
|
8637
|
-
switch (
|
|
8643
|
+
switch (_context4.prev = _context4.next) {
|
|
8638
8644
|
case 0:
|
|
8639
8645
|
if (!this._data) {
|
|
8640
|
-
|
|
8646
|
+
_context4.next = 2;
|
|
8641
8647
|
break;
|
|
8642
8648
|
}
|
|
8643
8649
|
|
|
8644
|
-
return
|
|
8650
|
+
return _context4.abrupt("return", this._data);
|
|
8645
8651
|
|
|
8646
8652
|
case 2:
|
|
8647
8653
|
if (this._url) {
|
|
8648
|
-
|
|
8654
|
+
_context4.next = 4;
|
|
8649
8655
|
break;
|
|
8650
8656
|
}
|
|
8651
8657
|
|
|
@@ -8658,17 +8664,17 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
8658
8664
|
}
|
|
8659
8665
|
};
|
|
8660
8666
|
controller = _CoreManager.default.getFileController();
|
|
8661
|
-
|
|
8667
|
+
_context4.next = 8;
|
|
8662
8668
|
return controller.download(this._url, options);
|
|
8663
8669
|
|
|
8664
8670
|
case 8:
|
|
8665
|
-
result =
|
|
8671
|
+
result = _context4.sent;
|
|
8666
8672
|
this._data = result.base64;
|
|
8667
|
-
return
|
|
8673
|
+
return _context4.abrupt("return", this._data);
|
|
8668
8674
|
|
|
8669
8675
|
case 11:
|
|
8670
8676
|
case "end":
|
|
8671
|
-
return
|
|
8677
|
+
return _context4.stop();
|
|
8672
8678
|
}
|
|
8673
8679
|
}
|
|
8674
8680
|
}, _callee, this);
|
|
@@ -8924,9 +8930,9 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
8924
8930
|
var _this4 = this;
|
|
8925
8931
|
|
|
8926
8932
|
if (metadata && (0, _typeof2.default)(metadata) === 'object') {
|
|
8927
|
-
var
|
|
8933
|
+
var _context5;
|
|
8928
8934
|
|
|
8929
|
-
(0, _forEach.default)(
|
|
8935
|
+
(0, _forEach.default)(_context5 = (0, _keys.default)(metadata)).call(_context5, function (key) {
|
|
8930
8936
|
_this4.addMetadata(key, metadata[key]);
|
|
8931
8937
|
});
|
|
8932
8938
|
}
|
|
@@ -8963,9 +8969,9 @@ var ParseFile = /*#__PURE__*/function () {
|
|
|
8963
8969
|
var _this5 = this;
|
|
8964
8970
|
|
|
8965
8971
|
if (tags && (0, _typeof2.default)(tags) === 'object') {
|
|
8966
|
-
var
|
|
8972
|
+
var _context6;
|
|
8967
8973
|
|
|
8968
|
-
(0, _forEach.default)(
|
|
8974
|
+
(0, _forEach.default)(_context6 = (0, _keys.default)(tags)).call(_context6, function (key) {
|
|
8969
8975
|
_this5.addTag(key, tags[key]);
|
|
8970
8976
|
});
|
|
8971
8977
|
}
|
|
@@ -9037,19 +9043,19 @@ var DefaultController = {
|
|
|
9037
9043
|
) {
|
|
9038
9044
|
var base64Data, _base64Data$split, _base64Data$split2, first, second, data, newSource;
|
|
9039
9045
|
|
|
9040
|
-
return _regenerator.default.wrap(function (
|
|
9046
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
9041
9047
|
while (1) {
|
|
9042
|
-
switch (
|
|
9048
|
+
switch (_context7.prev = _context7.next) {
|
|
9043
9049
|
case 0:
|
|
9044
9050
|
if (!(source.format !== 'file')) {
|
|
9045
|
-
|
|
9051
|
+
_context7.next = 2;
|
|
9046
9052
|
break;
|
|
9047
9053
|
}
|
|
9048
9054
|
|
|
9049
9055
|
throw new Error('saveFile can only be used with File-type sources.');
|
|
9050
9056
|
|
|
9051
9057
|
case 2:
|
|
9052
|
-
|
|
9058
|
+
_context7.next = 4;
|
|
9053
9059
|
return new _promise.default(function (res, rej) {
|
|
9054
9060
|
// eslint-disable-next-line no-undef
|
|
9055
9061
|
var reader = new FileReader();
|
|
@@ -9066,7 +9072,7 @@ var DefaultController = {
|
|
|
9066
9072
|
});
|
|
9067
9073
|
|
|
9068
9074
|
case 4:
|
|
9069
|
-
base64Data =
|
|
9075
|
+
base64Data = _context7.sent; // we only want the data after the comma
|
|
9070
9076
|
// For example: "data:application/pdf;base64,JVBERi0xLjQKJ..." we would only want "JVBERi0xLjQKJ..."
|
|
9071
9077
|
|
|
9072
9078
|
_base64Data$split = base64Data.split(','), _base64Data$split2 = (0, _slicedToArray2.default)(_base64Data$split, 2), first = _base64Data$split2[0], second = _base64Data$split2[1]; // in the event there is no 'data:application/pdf;base64,' at the beginning of the base64 string
|
|
@@ -9078,15 +9084,15 @@ var DefaultController = {
|
|
|
9078
9084
|
base64: data,
|
|
9079
9085
|
type: source.type || (source.file ? source.file.type : null)
|
|
9080
9086
|
};
|
|
9081
|
-
|
|
9087
|
+
_context7.next = 10;
|
|
9082
9088
|
return DefaultController.saveBase64(name, newSource, options);
|
|
9083
9089
|
|
|
9084
9090
|
case 10:
|
|
9085
|
-
return
|
|
9091
|
+
return _context7.abrupt("return", _context7.sent);
|
|
9086
9092
|
|
|
9087
9093
|
case 11:
|
|
9088
9094
|
case "end":
|
|
9089
|
-
return
|
|
9095
|
+
return _context7.stop();
|
|
9090
9096
|
}
|
|
9091
9097
|
}
|
|
9092
9098
|
}, _callee2);
|
|
@@ -18143,6 +18149,8 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
18143
18149
|
)
|
|
18144
18150
|
/*: ParseObject | boolean*/
|
|
18145
18151
|
{
|
|
18152
|
+
this._validateName(name);
|
|
18153
|
+
|
|
18146
18154
|
return this.set('name', name, options);
|
|
18147
18155
|
}
|
|
18148
18156
|
/**
|
|
@@ -18183,6 +18191,17 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
18183
18191
|
{
|
|
18184
18192
|
return this.relation('roles');
|
|
18185
18193
|
}
|
|
18194
|
+
}, {
|
|
18195
|
+
key: "_validateName",
|
|
18196
|
+
value: function (newName) {
|
|
18197
|
+
if (typeof newName !== 'string') {
|
|
18198
|
+
throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name must be a String.");
|
|
18199
|
+
}
|
|
18200
|
+
|
|
18201
|
+
if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
|
|
18202
|
+
throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.');
|
|
18203
|
+
}
|
|
18204
|
+
}
|
|
18186
18205
|
}, {
|
|
18187
18206
|
key: "validate",
|
|
18188
18207
|
value: function (attrs
|
|
@@ -18208,12 +18227,10 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
18208
18227
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
|
|
18209
18228
|
}
|
|
18210
18229
|
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
}
|
|
18214
|
-
|
|
18215
|
-
if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
|
|
18216
|
-
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.');
|
|
18230
|
+
try {
|
|
18231
|
+
this._validateName(newName);
|
|
18232
|
+
} catch (e) {
|
|
18233
|
+
return e;
|
|
18217
18234
|
}
|
|
18218
18235
|
}
|
|
18219
18236
|
|
|
@@ -20396,7 +20413,7 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
|
|
|
20396
20413
|
* Request an email verification.
|
|
20397
20414
|
*
|
|
20398
20415
|
* @param {string} email The email address associated with the user that
|
|
20399
|
-
*
|
|
20416
|
+
* needs to verify their email.
|
|
20400
20417
|
* @param {object} options
|
|
20401
20418
|
* @static
|
|
20402
20419
|
* @returns {Promise}
|