parse 4.0.1 → 4.1.0-alpha.2
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 +17995 -26193
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +8739 -17728
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/Analytics.js +2 -20
- package/lib/browser/AnonymousUtils.js +6 -35
- package/lib/browser/Cloud.js +12 -70
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -184
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -1
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -35
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -13
- package/lib/browser/LiveQueryClient.js +87 -204
- package/lib/browser/LiveQuerySubscription.js +10 -39
- package/lib/browser/LocalDatastore.js +451 -1081
- package/lib/browser/LocalDatastoreController.js +145 -602
- package/lib/browser/LocalDatastoreController.react-native.js +137 -573
- package/lib/browser/LocalDatastoreUtils.js +2 -12
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +42 -222
- package/lib/browser/Parse.js +12 -106
- package/lib/browser/ParseACL.js +33 -141
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -88
- package/lib/browser/ParseError.js +63 -90
- package/lib/browser/ParseFile.js +129 -685
- package/lib/browser/ParseGeoPoint.js +23 -82
- package/lib/browser/ParseHooks.js +1 -34
- package/lib/browser/ParseInstallation.js +4 -32
- package/lib/browser/ParseLiveQuery.js +96 -505
- package/lib/browser/ParseObject.js +628 -1840
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -63
- package/lib/browser/ParseQuery.js +404 -1505
- package/lib/browser/ParseRelation.js +12 -61
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -201
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -43
- package/lib/browser/RESTController.js +18 -140
- package/lib/browser/SingleInstanceStateController.js +19 -137
- package/lib/browser/Socket.weapp.js +2 -12
- package/lib/browser/Storage.js +10 -73
- package/lib/browser/StorageController.browser.js +4 -17
- package/lib/browser/StorageController.default.js +4 -17
- package/lib/browser/StorageController.react-native.js +6 -33
- package/lib/browser/StorageController.weapp.js +5 -16
- package/lib/browser/TaskQueue.js +1 -22
- package/lib/browser/UniqueInstanceStateController.js +19 -142
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -16
- package/lib/browser/canBeSerialized.js +3 -33
- package/lib/browser/decode.js +3 -33
- package/lib/browser/encode.js +9 -70
- package/lib/browser/equals.js +2 -25
- package/lib/browser/escape.js +1 -8
- package/lib/browser/isRevocableSession.js +2 -11
- package/lib/browser/parseDate.js +2 -13
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -17
- package/lib/browser/unsavedChildren.js +6 -50
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -18
- package/lib/node/AnonymousUtils.js +5 -37
- package/lib/node/Cloud.js +10 -66
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -220
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -1
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -37
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -15
- package/lib/node/LiveQueryClient.js +56 -136
- package/lib/node/LiveQuerySubscription.js +7 -16
- package/lib/node/LocalDatastore.js +19 -175
- package/lib/node/LocalDatastoreController.js +6 -38
- package/lib/node/LocalDatastoreController.react-native.js +6 -45
- package/lib/node/LocalDatastoreUtils.js +1 -6
- package/lib/node/ObjectStateMutations.js +13 -93
- package/lib/node/OfflineQuery.js +20 -152
- package/lib/node/Parse.js +11 -99
- package/lib/node/ParseACL.js +32 -150
- package/lib/node/ParseCLP.js +69 -262
- package/lib/node/ParseConfig.js +16 -84
- package/lib/node/ParseError.js +61 -65
- package/lib/node/ParseFile.js +50 -205
- package/lib/node/ParseGeoPoint.js +21 -82
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -10
- package/lib/node/ParseLiveQuery.js +10 -36
- package/lib/node/ParseObject.js +193 -939
- package/lib/node/ParseOp.js +31 -255
- package/lib/node/ParsePolygon.js +12 -62
- package/lib/node/ParseQuery.js +170 -882
- package/lib/node/ParseRelation.js +11 -61
- package/lib/node/ParseRole.js +10 -57
- package/lib/node/ParseSchema.js +46 -222
- package/lib/node/ParseSession.js +8 -50
- package/lib/node/ParseUser.js +107 -576
- package/lib/node/Push.js +4 -37
- package/lib/node/RESTController.js +8 -110
- package/lib/node/SingleInstanceStateController.js +17 -130
- package/lib/node/Socket.weapp.js +2 -9
- package/lib/node/Storage.js +10 -83
- package/lib/node/StorageController.browser.js +4 -23
- package/lib/node/StorageController.default.js +5 -21
- package/lib/node/StorageController.react-native.js +6 -40
- package/lib/node/StorageController.weapp.js +6 -21
- package/lib/node/TaskQueue.js +1 -17
- package/lib/node/UniqueInstanceStateController.js +16 -133
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -12
- package/lib/node/canBeSerialized.js +2 -28
- package/lib/node/decode.js +1 -26
- package/lib/node/encode.js +3 -54
- package/lib/node/equals.js +0 -18
- package/lib/node/escape.js +1 -6
- package/lib/node/isRevocableSession.js +1 -5
- package/lib/node/parseDate.js +1 -7
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -11
- package/lib/node/unsavedChildren.js +2 -38
- package/lib/node/uuid.js +6 -1
- package/lib/react-native/Analytics.js +0 -9
- package/lib/react-native/AnonymousUtils.js +0 -10
- package/lib/react-native/Cloud.js +0 -26
- package/lib/react-native/CoreManager.js +1 -5
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +4 -52
- package/lib/react-native/FacebookUtils.js +0 -22
- package/lib/react-native/IndexedDBStorageController.js +0 -1
- package/lib/react-native/InstallationController.js +0 -6
- package/lib/react-native/LiveQueryClient.js +24 -101
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +6 -113
- package/lib/react-native/LocalDatastoreController.js +0 -21
- package/lib/react-native/LocalDatastoreController.react-native.js +4 -31
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +0 -34
- package/lib/react-native/OfflineQuery.js +2 -137
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +32 -96
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +4 -72
- package/lib/react-native/ParseGeoPoint.js +0 -17
- package/lib/react-native/ParseHooks.js +0 -30
- package/lib/react-native/ParseInstallation.js +1 -23
- package/lib/react-native/ParseLiveQuery.js +3 -25
- package/lib/react-native/ParseObject.js +4 -371
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +6 -262
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +0 -51
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +1 -224
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +1 -70
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +2 -12
- package/lib/react-native/Storage.js +0 -24
- package/lib/react-native/StorageController.browser.js +0 -2
- package/lib/react-native/StorageController.default.js +0 -1
- package/lib/react-native/StorageController.react-native.js +0 -2
- package/lib/react-native/TaskQueue.js +0 -15
- package/lib/react-native/UniqueInstanceStateController.js +0 -47
- package/lib/react-native/Xhr.weapp.js +0 -16
- package/lib/react-native/arrayContainsObject.js +0 -5
- package/lib/react-native/canBeSerialized.js +0 -18
- package/lib/react-native/decode.js +0 -21
- package/lib/react-native/encode.js +0 -25
- package/lib/react-native/equals.js +0 -18
- package/lib/react-native/escape.js +0 -1
- package/lib/react-native/isRevocableSession.js +0 -1
- package/lib/react-native/parseDate.js +0 -3
- package/lib/react-native/promiseUtils.js +0 -13
- package/lib/react-native/unique.js +0 -4
- package/lib/react-native/unsavedChildren.js +0 -21
- package/lib/react-native/uuid.js +3 -1
- package/lib/weapp/Analytics.js +2 -20
- package/lib/weapp/AnonymousUtils.js +6 -35
- package/lib/weapp/Cloud.js +12 -70
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -184
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -1
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -35
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -13
- package/lib/weapp/LiveQueryClient.js +87 -204
- package/lib/weapp/LiveQuerySubscription.js +10 -39
- package/lib/weapp/LocalDatastore.js +451 -1081
- package/lib/weapp/LocalDatastoreController.js +145 -602
- package/lib/weapp/LocalDatastoreController.react-native.js +137 -573
- package/lib/weapp/LocalDatastoreUtils.js +2 -12
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +42 -222
- package/lib/weapp/Parse.js +12 -106
- package/lib/weapp/ParseACL.js +33 -141
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -88
- package/lib/weapp/ParseError.js +63 -90
- package/lib/weapp/ParseFile.js +130 -686
- package/lib/weapp/ParseGeoPoint.js +23 -82
- package/lib/weapp/ParseHooks.js +1 -34
- package/lib/weapp/ParseInstallation.js +4 -32
- package/lib/weapp/ParseLiveQuery.js +96 -505
- package/lib/weapp/ParseObject.js +628 -1840
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -63
- package/lib/weapp/ParseQuery.js +404 -1505
- package/lib/weapp/ParseRelation.js +12 -61
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -201
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -43
- package/lib/weapp/RESTController.js +18 -140
- package/lib/weapp/SingleInstanceStateController.js +19 -137
- package/lib/weapp/Socket.weapp.js +2 -12
- package/lib/weapp/Storage.js +10 -73
- package/lib/weapp/StorageController.browser.js +4 -17
- package/lib/weapp/StorageController.default.js +4 -17
- package/lib/weapp/StorageController.react-native.js +6 -33
- package/lib/weapp/StorageController.weapp.js +5 -16
- package/lib/weapp/TaskQueue.js +1 -22
- package/lib/weapp/UniqueInstanceStateController.js +19 -142
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -16
- package/lib/weapp/canBeSerialized.js +3 -33
- package/lib/weapp/decode.js +3 -33
- package/lib/weapp/encode.js +9 -70
- package/lib/weapp/equals.js +2 -25
- package/lib/weapp/escape.js +1 -8
- package/lib/weapp/isRevocableSession.js +2 -11
- package/lib/weapp/parseDate.js +2 -13
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -17
- package/lib/weapp/unsavedChildren.js +6 -50
- package/lib/weapp/uuid.js +1 -6
- package/package.json +45 -43
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
|
|
10
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
|
|
12
8
|
var _ParseOp = require("./ParseOp");
|
|
13
|
-
|
|
14
9
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
15
|
-
|
|
16
10
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
17
|
-
|
|
18
11
|
var ParseRelation = function () {
|
|
19
12
|
function ParseRelation(parent, key) {
|
|
20
13
|
(0, _classCallCheck2.default)(this, ParseRelation);
|
|
@@ -22,21 +15,17 @@ var ParseRelation = function () {
|
|
|
22
15
|
this.key = key;
|
|
23
16
|
this.targetClassName = null;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
18
|
(0, _createClass2.default)(ParseRelation, [{
|
|
27
19
|
key: "_ensureParentAndKey",
|
|
28
20
|
value: function (parent, key) {
|
|
29
21
|
this.key = this.key || key;
|
|
30
|
-
|
|
31
22
|
if (this.key !== key) {
|
|
32
23
|
throw new Error('Internal Error. Relation retrieved from two different keys.');
|
|
33
24
|
}
|
|
34
|
-
|
|
35
25
|
if (this.parent) {
|
|
36
26
|
if (this.parent.className !== parent.className) {
|
|
37
27
|
throw new Error('Internal Error. Relation retrieved from two different Objects.');
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
if (this.parent.id) {
|
|
41
30
|
if (this.parent.id !== parent.id) {
|
|
42
31
|
throw new Error('Internal Error. Relation retrieved from two different Objects.');
|
|
@@ -54,18 +43,14 @@ var ParseRelation = function () {
|
|
|
54
43
|
if (!Array.isArray(objects)) {
|
|
55
44
|
objects = [objects];
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
var change = new _ParseOp.RelationOp(objects, []);
|
|
59
47
|
var parent = this.parent;
|
|
60
|
-
|
|
61
48
|
if (!parent) {
|
|
62
49
|
throw new Error('Cannot add to a Relation without a parent');
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
if (objects.length === 0) {
|
|
66
52
|
return parent;
|
|
67
53
|
}
|
|
68
|
-
|
|
69
54
|
parent.set(this.key, change);
|
|
70
55
|
this.targetClassName = change._targetClassName;
|
|
71
56
|
return parent;
|
|
@@ -76,17 +61,13 @@ var ParseRelation = function () {
|
|
|
76
61
|
if (!Array.isArray(objects)) {
|
|
77
62
|
objects = [objects];
|
|
78
63
|
}
|
|
79
|
-
|
|
80
64
|
var change = new _ParseOp.RelationOp([], objects);
|
|
81
|
-
|
|
82
65
|
if (!this.parent) {
|
|
83
66
|
throw new Error('Cannot remove from a Relation without a parent');
|
|
84
67
|
}
|
|
85
|
-
|
|
86
68
|
if (objects.length === 0) {
|
|
87
69
|
return;
|
|
88
70
|
}
|
|
89
|
-
|
|
90
71
|
this.parent.set(this.key, change);
|
|
91
72
|
this.targetClassName = change._targetClassName;
|
|
92
73
|
}
|
|
@@ -103,31 +84,25 @@ var ParseRelation = function () {
|
|
|
103
84
|
value: function query() {
|
|
104
85
|
var query;
|
|
105
86
|
var parent = this.parent;
|
|
106
|
-
|
|
107
87
|
if (!parent) {
|
|
108
88
|
throw new Error('Cannot construct a query for a Relation without a parent');
|
|
109
89
|
}
|
|
110
|
-
|
|
111
90
|
if (!this.targetClassName) {
|
|
112
91
|
query = new _ParseQuery.default(parent.className);
|
|
113
92
|
query._extraOptions.redirectClassNameForKey = this.key;
|
|
114
93
|
} else {
|
|
115
94
|
query = new _ParseQuery.default(this.targetClassName);
|
|
116
95
|
}
|
|
117
|
-
|
|
118
96
|
query._addCondition('$relatedTo', 'object', {
|
|
119
97
|
__type: 'Pointer',
|
|
120
98
|
className: parent.className,
|
|
121
99
|
objectId: parent.id
|
|
122
100
|
});
|
|
123
|
-
|
|
124
101
|
query._addCondition('$relatedTo', 'key', this.key);
|
|
125
|
-
|
|
126
102
|
return query;
|
|
127
103
|
}
|
|
128
104
|
}]);
|
|
129
105
|
return ParseRelation;
|
|
130
106
|
}();
|
|
131
|
-
|
|
132
107
|
var _default = ParseRelation;
|
|
133
108
|
exports.default = _default;
|
|
@@ -1,51 +1,35 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
|
|
10
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
|
|
12
8
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
-
|
|
14
9
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
12
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
21
|
-
|
|
22
13
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
23
|
-
|
|
24
14
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
25
|
-
|
|
26
15
|
function _createSuper(Derived) {
|
|
27
16
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
28
|
-
|
|
29
17
|
return function () {
|
|
30
18
|
var Super = (0, _getPrototypeOf2.default)(Derived),
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
result;
|
|
33
20
|
if (hasNativeReflectConstruct) {
|
|
34
21
|
var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
|
|
35
22
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
36
23
|
} else {
|
|
37
24
|
result = Super.apply(this, arguments);
|
|
38
25
|
}
|
|
39
|
-
|
|
40
26
|
return (0, _possibleConstructorReturn2.default)(this, result);
|
|
41
27
|
};
|
|
42
28
|
}
|
|
43
|
-
|
|
44
29
|
function _isNativeReflectConstruct() {
|
|
45
30
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
46
31
|
if (Reflect.construct.sham) return false;
|
|
47
32
|
if (typeof Proxy === "function") return true;
|
|
48
|
-
|
|
49
33
|
try {
|
|
50
34
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
51
35
|
return true;
|
|
@@ -53,43 +37,32 @@ function _isNativeReflectConstruct() {
|
|
|
53
37
|
return false;
|
|
54
38
|
}
|
|
55
39
|
}
|
|
56
|
-
|
|
57
40
|
var ParseRole = function (_ParseObject) {
|
|
58
41
|
(0, _inherits2.default)(ParseRole, _ParseObject);
|
|
59
|
-
|
|
60
42
|
var _super = _createSuper(ParseRole);
|
|
61
|
-
|
|
62
43
|
function ParseRole(name, acl) {
|
|
63
44
|
var _this;
|
|
64
|
-
|
|
65
45
|
(0, _classCallCheck2.default)(this, ParseRole);
|
|
66
46
|
_this = _super.call(this, '_Role');
|
|
67
|
-
|
|
68
47
|
if (typeof name === 'string' && acl instanceof _ParseACL.default) {
|
|
69
48
|
_this.setName(name);
|
|
70
|
-
|
|
71
49
|
_this.setACL(acl);
|
|
72
50
|
}
|
|
73
|
-
|
|
74
51
|
return _this;
|
|
75
52
|
}
|
|
76
|
-
|
|
77
53
|
(0, _createClass2.default)(ParseRole, [{
|
|
78
54
|
key: "getName",
|
|
79
55
|
value: function () {
|
|
80
56
|
var name = this.get('name');
|
|
81
|
-
|
|
82
57
|
if (name == null || typeof name === 'string') {
|
|
83
58
|
return name;
|
|
84
59
|
}
|
|
85
|
-
|
|
86
60
|
return '';
|
|
87
61
|
}
|
|
88
62
|
}, {
|
|
89
63
|
key: "setName",
|
|
90
64
|
value: function (name, options) {
|
|
91
65
|
this._validateName(name);
|
|
92
|
-
|
|
93
66
|
return this.set('name', name, options);
|
|
94
67
|
}
|
|
95
68
|
}, {
|
|
@@ -108,7 +81,6 @@ var ParseRole = function (_ParseObject) {
|
|
|
108
81
|
if (typeof newName !== 'string') {
|
|
109
82
|
throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name must be a String.");
|
|
110
83
|
}
|
|
111
|
-
|
|
112
84
|
if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
|
|
113
85
|
throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.');
|
|
114
86
|
}
|
|
@@ -117,32 +89,25 @@ var ParseRole = function (_ParseObject) {
|
|
|
117
89
|
key: "validate",
|
|
118
90
|
value: function (attrs, options) {
|
|
119
91
|
var isInvalid = (0, _get2.default)((0, _getPrototypeOf2.default)(ParseRole.prototype), "validate", this).call(this, attrs, options);
|
|
120
|
-
|
|
121
92
|
if (isInvalid) {
|
|
122
93
|
return isInvalid;
|
|
123
94
|
}
|
|
124
|
-
|
|
125
95
|
if ('name' in attrs && attrs.name !== this.getName()) {
|
|
126
96
|
var newName = attrs.name;
|
|
127
|
-
|
|
128
97
|
if (this.id && this.id !== attrs.objectId) {
|
|
129
98
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
|
|
130
99
|
}
|
|
131
|
-
|
|
132
100
|
try {
|
|
133
101
|
this._validateName(newName);
|
|
134
102
|
} catch (e) {
|
|
135
103
|
return e;
|
|
136
104
|
}
|
|
137
105
|
}
|
|
138
|
-
|
|
139
106
|
return false;
|
|
140
107
|
}
|
|
141
108
|
}]);
|
|
142
109
|
return ParseRole;
|
|
143
110
|
}(_ParseObject2.default);
|
|
144
|
-
|
|
145
111
|
_ParseObject2.default.registerSubclass('_Role', ParseRole);
|
|
146
|
-
|
|
147
112
|
var _default = ParseRole;
|
|
148
113
|
exports.default = _default;
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
|
|
10
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
|
|
12
8
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
13
|
-
|
|
14
9
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
15
|
-
|
|
16
10
|
var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
17
|
-
|
|
18
11
|
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
19
|
-
|
|
20
12
|
var ParseSchema = function () {
|
|
21
13
|
function ParseSchema(className) {
|
|
22
14
|
(0, _classCallCheck2.default)(this, ParseSchema);
|
|
23
|
-
|
|
24
15
|
if (typeof className === 'string') {
|
|
25
16
|
if (className === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
|
|
26
17
|
this.className = '_User';
|
|
@@ -28,23 +19,18 @@ var ParseSchema = function () {
|
|
|
28
19
|
this.className = className;
|
|
29
20
|
}
|
|
30
21
|
}
|
|
31
|
-
|
|
32
22
|
this._fields = {};
|
|
33
23
|
this._indexes = {};
|
|
34
24
|
}
|
|
35
|
-
|
|
36
25
|
(0, _createClass2.default)(ParseSchema, [{
|
|
37
26
|
key: "get",
|
|
38
27
|
value: function () {
|
|
39
28
|
this.assertClassName();
|
|
40
|
-
|
|
41
29
|
var controller = _CoreManager.default.getSchemaController();
|
|
42
|
-
|
|
43
30
|
return controller.get(this.className).then(function (response) {
|
|
44
31
|
if (!response) {
|
|
45
32
|
throw new Error('Schema not found.');
|
|
46
33
|
}
|
|
47
|
-
|
|
48
34
|
return response;
|
|
49
35
|
});
|
|
50
36
|
}
|
|
@@ -52,9 +38,7 @@ var ParseSchema = function () {
|
|
|
52
38
|
key: "save",
|
|
53
39
|
value: function () {
|
|
54
40
|
this.assertClassName();
|
|
55
|
-
|
|
56
41
|
var controller = _CoreManager.default.getSchemaController();
|
|
57
|
-
|
|
58
42
|
var params = {
|
|
59
43
|
className: this.className,
|
|
60
44
|
fields: this._fields,
|
|
@@ -67,9 +51,7 @@ var ParseSchema = function () {
|
|
|
67
51
|
key: "update",
|
|
68
52
|
value: function () {
|
|
69
53
|
this.assertClassName();
|
|
70
|
-
|
|
71
54
|
var controller = _CoreManager.default.getSchemaController();
|
|
72
|
-
|
|
73
55
|
var params = {
|
|
74
56
|
className: this.className,
|
|
75
57
|
fields: this._fields,
|
|
@@ -84,18 +66,14 @@ var ParseSchema = function () {
|
|
|
84
66
|
key: "delete",
|
|
85
67
|
value: function () {
|
|
86
68
|
this.assertClassName();
|
|
87
|
-
|
|
88
69
|
var controller = _CoreManager.default.getSchemaController();
|
|
89
|
-
|
|
90
70
|
return controller.delete(this.className);
|
|
91
71
|
}
|
|
92
72
|
}, {
|
|
93
73
|
key: "purge",
|
|
94
74
|
value: function () {
|
|
95
75
|
this.assertClassName();
|
|
96
|
-
|
|
97
76
|
var controller = _CoreManager.default.getSchemaController();
|
|
98
|
-
|
|
99
77
|
return controller.purge(this.className);
|
|
100
78
|
}
|
|
101
79
|
}, {
|
|
@@ -113,7 +91,6 @@ var ParseSchema = function () {
|
|
|
113
91
|
} else {
|
|
114
92
|
this._clp = clp;
|
|
115
93
|
}
|
|
116
|
-
|
|
117
94
|
return this;
|
|
118
95
|
}
|
|
119
96
|
}, {
|
|
@@ -121,35 +98,27 @@ var ParseSchema = function () {
|
|
|
121
98
|
value: function (name, type) {
|
|
122
99
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
123
100
|
type = type || 'String';
|
|
124
|
-
|
|
125
101
|
if (!name) {
|
|
126
102
|
throw new Error('field name may not be null.');
|
|
127
103
|
}
|
|
128
|
-
|
|
129
104
|
if (FIELD_TYPES.indexOf(type) === -1) {
|
|
130
105
|
throw new Error(`${type} is not a valid type.`);
|
|
131
106
|
}
|
|
132
|
-
|
|
133
107
|
if (type === 'Pointer') {
|
|
134
108
|
return this.addPointer(name, options.targetClass, options);
|
|
135
109
|
}
|
|
136
|
-
|
|
137
110
|
if (type === 'Relation') {
|
|
138
111
|
return this.addRelation(name, options.targetClass, options);
|
|
139
112
|
}
|
|
140
|
-
|
|
141
113
|
var fieldOptions = {
|
|
142
114
|
type: type
|
|
143
115
|
};
|
|
144
|
-
|
|
145
116
|
if (typeof options.required === 'boolean') {
|
|
146
117
|
fieldOptions.required = options.required;
|
|
147
118
|
}
|
|
148
|
-
|
|
149
119
|
if (options.defaultValue !== undefined) {
|
|
150
120
|
fieldOptions.defaultValue = options.defaultValue;
|
|
151
121
|
}
|
|
152
|
-
|
|
153
122
|
if (type === 'Date') {
|
|
154
123
|
if (options && options.defaultValue) {
|
|
155
124
|
fieldOptions.defaultValue = {
|
|
@@ -158,7 +127,6 @@ var ParseSchema = function () {
|
|
|
158
127
|
};
|
|
159
128
|
}
|
|
160
129
|
}
|
|
161
|
-
|
|
162
130
|
this._fields[name] = fieldOptions;
|
|
163
131
|
return this;
|
|
164
132
|
}
|
|
@@ -168,11 +136,9 @@ var ParseSchema = function () {
|
|
|
168
136
|
if (!name) {
|
|
169
137
|
throw new Error('index name may not be null.');
|
|
170
138
|
}
|
|
171
|
-
|
|
172
139
|
if (!index) {
|
|
173
140
|
throw new Error('index may not be null.');
|
|
174
141
|
}
|
|
175
|
-
|
|
176
142
|
this._indexes[name] = index;
|
|
177
143
|
return this;
|
|
178
144
|
}
|
|
@@ -225,32 +191,25 @@ var ParseSchema = function () {
|
|
|
225
191
|
key: "addPointer",
|
|
226
192
|
value: function (name, targetClass) {
|
|
227
193
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
228
|
-
|
|
229
194
|
if (!name) {
|
|
230
195
|
throw new Error('field name may not be null.');
|
|
231
196
|
}
|
|
232
|
-
|
|
233
197
|
if (!targetClass) {
|
|
234
198
|
throw new Error('You need to set the targetClass of the Pointer.');
|
|
235
199
|
}
|
|
236
|
-
|
|
237
200
|
var fieldOptions = {
|
|
238
201
|
type: 'Pointer',
|
|
239
202
|
targetClass: targetClass
|
|
240
203
|
};
|
|
241
|
-
|
|
242
204
|
if (typeof options.required === 'boolean') {
|
|
243
205
|
fieldOptions.required = options.required;
|
|
244
206
|
}
|
|
245
|
-
|
|
246
207
|
if (options.defaultValue !== undefined) {
|
|
247
208
|
fieldOptions.defaultValue = options.defaultValue;
|
|
248
|
-
|
|
249
209
|
if (options.defaultValue instanceof _ParseObject.default) {
|
|
250
210
|
fieldOptions.defaultValue = options.defaultValue.toPointer();
|
|
251
211
|
}
|
|
252
212
|
}
|
|
253
|
-
|
|
254
213
|
this._fields[name] = fieldOptions;
|
|
255
214
|
return this;
|
|
256
215
|
}
|
|
@@ -260,11 +219,9 @@ var ParseSchema = function () {
|
|
|
260
219
|
if (!name) {
|
|
261
220
|
throw new Error('field name may not be null.');
|
|
262
221
|
}
|
|
263
|
-
|
|
264
222
|
if (!targetClass) {
|
|
265
223
|
throw new Error('You need to set the targetClass of the Relation.');
|
|
266
224
|
}
|
|
267
|
-
|
|
268
225
|
this._fields[name] = {
|
|
269
226
|
type: 'Relation',
|
|
270
227
|
targetClass: targetClass
|
|
@@ -291,25 +248,20 @@ var ParseSchema = function () {
|
|
|
291
248
|
key: "all",
|
|
292
249
|
value: function () {
|
|
293
250
|
var controller = _CoreManager.default.getSchemaController();
|
|
294
|
-
|
|
295
251
|
return controller.get('').then(function (response) {
|
|
296
252
|
if (response.results.length === 0) {
|
|
297
253
|
throw new Error('Schema not found.');
|
|
298
254
|
}
|
|
299
|
-
|
|
300
255
|
return response.results;
|
|
301
256
|
});
|
|
302
257
|
}
|
|
303
258
|
}]);
|
|
304
259
|
return ParseSchema;
|
|
305
260
|
}();
|
|
306
|
-
|
|
307
261
|
var DefaultController = {
|
|
308
262
|
send: function (className, method) {
|
|
309
263
|
var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
310
|
-
|
|
311
264
|
var RESTController = _CoreManager.default.getRESTController();
|
|
312
|
-
|
|
313
265
|
return RESTController.request(method, `schemas/${className}`, params, {
|
|
314
266
|
useMasterKey: true
|
|
315
267
|
});
|
|
@@ -328,14 +280,11 @@ var DefaultController = {
|
|
|
328
280
|
},
|
|
329
281
|
purge: function (className) {
|
|
330
282
|
var RESTController = _CoreManager.default.getRESTController();
|
|
331
|
-
|
|
332
283
|
return RESTController.request('DELETE', `purge/${className}`, {}, {
|
|
333
284
|
useMasterKey: true
|
|
334
285
|
});
|
|
335
286
|
}
|
|
336
287
|
};
|
|
337
|
-
|
|
338
288
|
_CoreManager.default.setSchemaController(DefaultController);
|
|
339
|
-
|
|
340
289
|
var _default = ParseSchema;
|
|
341
290
|
exports.default = _default;
|
|
@@ -1,51 +1,35 @@
|
|
|
1
1
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
|
|
10
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
|
|
12
8
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
-
|
|
14
9
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
|
|
16
10
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
|
|
18
11
|
var _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
19
|
-
|
|
20
12
|
var _isRevocableSession = _interopRequireDefault(require("./isRevocableSession"));
|
|
21
|
-
|
|
22
13
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
23
|
-
|
|
24
14
|
var _ParseUser = _interopRequireDefault(require("./ParseUser"));
|
|
25
|
-
|
|
26
15
|
function _createSuper(Derived) {
|
|
27
16
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
28
|
-
|
|
29
17
|
return function () {
|
|
30
18
|
var Super = (0, _getPrototypeOf2.default)(Derived),
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
result;
|
|
33
20
|
if (hasNativeReflectConstruct) {
|
|
34
21
|
var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
|
|
35
22
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
36
23
|
} else {
|
|
37
24
|
result = Super.apply(this, arguments);
|
|
38
25
|
}
|
|
39
|
-
|
|
40
26
|
return (0, _possibleConstructorReturn2.default)(this, result);
|
|
41
27
|
};
|
|
42
28
|
}
|
|
43
|
-
|
|
44
29
|
function _isNativeReflectConstruct() {
|
|
45
30
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
46
31
|
if (Reflect.construct.sham) return false;
|
|
47
32
|
if (typeof Proxy === "function") return true;
|
|
48
|
-
|
|
49
33
|
try {
|
|
50
34
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
51
35
|
return true;
|
|
@@ -53,36 +37,27 @@ function _isNativeReflectConstruct() {
|
|
|
53
37
|
return false;
|
|
54
38
|
}
|
|
55
39
|
}
|
|
56
|
-
|
|
57
40
|
var ParseSession = function (_ParseObject) {
|
|
58
41
|
(0, _inherits2.default)(ParseSession, _ParseObject);
|
|
59
|
-
|
|
60
42
|
var _super = _createSuper(ParseSession);
|
|
61
|
-
|
|
62
43
|
function ParseSession(attributes) {
|
|
63
44
|
var _this;
|
|
64
|
-
|
|
65
45
|
(0, _classCallCheck2.default)(this, ParseSession);
|
|
66
46
|
_this = _super.call(this, '_Session');
|
|
67
|
-
|
|
68
47
|
if (attributes && typeof attributes === 'object') {
|
|
69
48
|
if (!_this.set(attributes || {})) {
|
|
70
49
|
throw new Error("Can't create an invalid Session");
|
|
71
50
|
}
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
return _this;
|
|
75
53
|
}
|
|
76
|
-
|
|
77
54
|
(0, _createClass2.default)(ParseSession, [{
|
|
78
55
|
key: "getSessionToken",
|
|
79
56
|
value: function () {
|
|
80
57
|
var token = this.get('sessionToken');
|
|
81
|
-
|
|
82
58
|
if (typeof token === 'string') {
|
|
83
59
|
return token;
|
|
84
60
|
}
|
|
85
|
-
|
|
86
61
|
return '';
|
|
87
62
|
}
|
|
88
63
|
}], [{
|
|
@@ -94,20 +69,15 @@ var ParseSession = function (_ParseObject) {
|
|
|
94
69
|
key: "current",
|
|
95
70
|
value: function (options) {
|
|
96
71
|
options = options || {};
|
|
97
|
-
|
|
98
72
|
var controller = _CoreManager.default.getSessionController();
|
|
99
|
-
|
|
100
73
|
var sessionOptions = {};
|
|
101
|
-
|
|
102
74
|
if (options.hasOwnProperty('useMasterKey')) {
|
|
103
75
|
sessionOptions.useMasterKey = options.useMasterKey;
|
|
104
76
|
}
|
|
105
|
-
|
|
106
77
|
return _ParseUser.default.currentAsync().then(function (user) {
|
|
107
78
|
if (!user) {
|
|
108
79
|
return Promise.reject('There is no current user.');
|
|
109
80
|
}
|
|
110
|
-
|
|
111
81
|
sessionOptions.sessionToken = user.getSessionToken();
|
|
112
82
|
return controller.getSession(sessionOptions);
|
|
113
83
|
});
|
|
@@ -116,35 +86,26 @@ var ParseSession = function (_ParseObject) {
|
|
|
116
86
|
key: "isCurrentSessionRevocable",
|
|
117
87
|
value: function () {
|
|
118
88
|
var currentUser = _ParseUser.default.current();
|
|
119
|
-
|
|
120
89
|
if (currentUser) {
|
|
121
90
|
return (0, _isRevocableSession.default)(currentUser.getSessionToken() || '');
|
|
122
91
|
}
|
|
123
|
-
|
|
124
92
|
return false;
|
|
125
93
|
}
|
|
126
94
|
}]);
|
|
127
95
|
return ParseSession;
|
|
128
96
|
}(_ParseObject2.default);
|
|
129
|
-
|
|
130
97
|
_ParseObject2.default.registerSubclass('_Session', ParseSession);
|
|
131
|
-
|
|
132
98
|
var DefaultController = {
|
|
133
99
|
getSession: function (options) {
|
|
134
100
|
var RESTController = _CoreManager.default.getRESTController();
|
|
135
|
-
|
|
136
101
|
var session = new ParseSession();
|
|
137
102
|
return RESTController.request('GET', 'sessions/me', {}, options).then(function (sessionData) {
|
|
138
103
|
session._finishFetch(sessionData);
|
|
139
|
-
|
|
140
104
|
session._setExisted(true);
|
|
141
|
-
|
|
142
105
|
return session;
|
|
143
106
|
});
|
|
144
107
|
}
|
|
145
108
|
};
|
|
146
|
-
|
|
147
109
|
_CoreManager.default.setSessionController(DefaultController);
|
|
148
|
-
|
|
149
110
|
var _default = ParseSession;
|
|
150
111
|
exports.default = _default;
|