parse 4.0.0-alpha.1 → 4.0.0-alpha.11
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/LICENSE +167 -25
- package/NOTICE +10 -0
- package/README.md +6 -5
- package/dist/parse.js +12838 -21190
- package/dist/parse.min.js +7 -6
- package/dist/parse.weapp.js +7921 -17062
- package/dist/parse.weapp.min.js +7 -6
- package/lib/browser/Analytics.js +2 -27
- package/lib/browser/AnonymousUtils.js +6 -42
- package/lib/browser/Cloud.js +12 -77
- package/lib/browser/CloudCode.js +0 -3
- package/lib/browser/CoreManager.js +46 -191
- package/lib/browser/CryptoController.js +2 -16
- package/lib/browser/EventEmitter.js +1 -8
- package/lib/browser/EventuallyQueue.js +277 -824
- package/lib/browser/FacebookUtils.js +6 -42
- package/lib/browser/IndexedDBStorageController.js +3 -14
- package/lib/browser/InstallationController.js +2 -20
- package/lib/browser/LiveQueryClient.js +105 -213
- 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 -19
- package/lib/browser/ObjectStateMutations.js +18 -121
- package/lib/browser/OfflineQuery.js +61 -222
- package/lib/browser/Parse.js +12 -115
- package/lib/browser/ParseACL.js +33 -148
- package/lib/browser/ParseCLP.js +96 -314
- package/lib/browser/ParseConfig.js +18 -95
- package/lib/browser/ParseError.js +63 -99
- package/lib/browser/ParseFile.js +128 -685
- package/lib/browser/ParseGeoPoint.js +23 -89
- 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 +665 -1845
- package/lib/browser/ParseOp.js +41 -287
- package/lib/browser/ParsePolygon.js +13 -70
- package/lib/browser/ParseQuery.js +403 -1504
- package/lib/browser/ParseRelation.js +12 -68
- package/lib/browser/ParseRole.js +13 -75
- package/lib/browser/ParseSchema.js +49 -208
- package/lib/browser/ParseSession.js +11 -69
- package/lib/browser/ParseUser.js +274 -1127
- package/lib/browser/Push.js +7 -50
- package/lib/browser/RESTController.js +28 -157
- package/lib/browser/SingleInstanceStateController.js +19 -144
- package/lib/browser/Socket.weapp.js +0 -10
- package/lib/browser/Storage.js +10 -80
- package/lib/browser/StorageController.browser.js +4 -24
- package/lib/browser/StorageController.default.js +4 -24
- package/lib/browser/StorageController.react-native.js +6 -40
- package/lib/browser/StorageController.weapp.js +5 -23
- package/lib/browser/TaskQueue.js +1 -29
- package/lib/browser/UniqueInstanceStateController.js +19 -149
- package/lib/browser/Xhr.weapp.js +0 -17
- package/lib/browser/arrayContainsObject.js +2 -23
- package/lib/browser/canBeSerialized.js +3 -40
- package/lib/browser/decode.js +3 -40
- package/lib/browser/encode.js +9 -77
- package/lib/browser/equals.js +2 -34
- package/lib/browser/escape.js +1 -15
- package/lib/browser/isRevocableSession.js +2 -18
- package/lib/browser/parseDate.js +2 -20
- package/lib/browser/promiseUtils.js +3 -21
- package/lib/browser/unique.js +3 -24
- package/lib/browser/unsavedChildren.js +6 -57
- package/lib/browser/uuid.js +3 -1
- package/lib/node/Analytics.js +1 -25
- package/lib/node/AnonymousUtils.js +5 -44
- package/lib/node/Cloud.js +10 -73
- package/lib/node/CloudCode.js +0 -3
- package/lib/node/CoreManager.js +47 -227
- package/lib/node/CryptoController.js +2 -16
- package/lib/node/EventEmitter.js +1 -8
- package/lib/node/EventuallyQueue.js +16 -123
- package/lib/node/FacebookUtils.js +5 -44
- package/lib/node/IndexedDBStorageController.js +3 -19
- package/lib/node/InstallationController.js +2 -22
- package/lib/node/LiveQueryClient.js +72 -154
- package/lib/node/LiveQuerySubscription.js +7 -26
- package/lib/node/LocalDatastore.js +19 -182
- package/lib/node/LocalDatastoreController.js +6 -45
- package/lib/node/LocalDatastoreController.react-native.js +6 -52
- package/lib/node/LocalDatastoreUtils.js +1 -13
- package/lib/node/ObjectStateMutations.js +13 -100
- package/lib/node/OfflineQuery.js +27 -151
- package/lib/node/Parse.js +11 -108
- package/lib/node/ParseACL.js +32 -157
- package/lib/node/ParseCLP.js +69 -269
- package/lib/node/ParseConfig.js +16 -91
- package/lib/node/ParseError.js +61 -74
- package/lib/node/ParseFile.js +49 -212
- package/lib/node/ParseGeoPoint.js +21 -89
- package/lib/node/ParseHooks.js +0 -35
- package/lib/node/ParseInstallation.js +1 -17
- package/lib/node/ParseLiveQuery.js +10 -43
- package/lib/node/ParseObject.js +229 -964
- package/lib/node/ParseOp.js +31 -262
- package/lib/node/ParsePolygon.js +12 -69
- package/lib/node/ParseQuery.js +169 -888
- package/lib/node/ParseRelation.js +11 -68
- package/lib/node/ParseRole.js +10 -64
- package/lib/node/ParseSchema.js +46 -229
- package/lib/node/ParseSession.js +8 -57
- package/lib/node/ParseUser.js +107 -583
- package/lib/node/Push.js +4 -44
- package/lib/node/RESTController.js +18 -127
- package/lib/node/SingleInstanceStateController.js +17 -137
- package/lib/node/Socket.weapp.js +0 -7
- package/lib/node/Storage.js +10 -90
- package/lib/node/StorageController.browser.js +4 -30
- package/lib/node/StorageController.default.js +5 -28
- package/lib/node/StorageController.react-native.js +6 -47
- package/lib/node/StorageController.weapp.js +6 -28
- package/lib/node/TaskQueue.js +1 -24
- package/lib/node/UniqueInstanceStateController.js +16 -140
- package/lib/node/Xhr.weapp.js +0 -15
- package/lib/node/arrayContainsObject.js +1 -19
- package/lib/node/canBeSerialized.js +2 -35
- package/lib/node/decode.js +1 -33
- package/lib/node/encode.js +3 -61
- package/lib/node/equals.js +0 -27
- package/lib/node/escape.js +1 -13
- package/lib/node/isRevocableSession.js +1 -12
- package/lib/node/parseDate.js +1 -14
- package/lib/node/promiseUtils.js +2 -14
- package/lib/node/unique.js +1 -18
- package/lib/node/unsavedChildren.js +2 -45
- 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 +2 -6
- package/lib/react-native/CryptoController.js +0 -2
- package/lib/react-native/EventEmitter.js +0 -2
- package/lib/react-native/EventuallyQueue.js +156 -711
- 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 +46 -157
- package/lib/react-native/LiveQuerySubscription.js +3 -27
- package/lib/react-native/LocalDatastore.js +281 -948
- package/lib/react-native/LocalDatastoreController.js +71 -552
- package/lib/react-native/LocalDatastoreController.react-native.js +91 -526
- package/lib/react-native/LocalDatastoreUtils.js +0 -1
- package/lib/react-native/ObjectStateMutations.js +2 -65
- package/lib/react-native/OfflineQuery.js +25 -196
- package/lib/react-native/Parse.js +0 -65
- package/lib/react-native/ParseACL.js +0 -44
- package/lib/react-native/ParseCLP.js +23 -161
- package/lib/react-native/ParseConfig.js +0 -42
- package/lib/react-native/ParseError.js +1 -21
- package/lib/react-native/ParseFile.js +55 -529
- 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 +55 -472
- package/lib/react-native/ParseObject.js +245 -1246
- package/lib/react-native/ParseOp.js +1 -138
- package/lib/react-native/ParsePolygon.js +0 -24
- package/lib/react-native/ParseQuery.js +182 -874
- package/lib/react-native/ParseRelation.js +0 -25
- package/lib/react-native/ParseRole.js +1 -36
- package/lib/react-native/ParseSchema.js +3 -54
- package/lib/react-native/ParseSession.js +1 -40
- package/lib/react-native/ParseUser.js +95 -773
- package/lib/react-native/Push.js +0 -16
- package/lib/react-native/RESTController.js +12 -109
- package/lib/react-native/SingleInstanceStateController.js +0 -44
- package/lib/react-native/Socket.weapp.js +0 -10
- 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 -27
- package/lib/weapp/AnonymousUtils.js +6 -42
- package/lib/weapp/Cloud.js +12 -77
- package/lib/weapp/CloudCode.js +0 -3
- package/lib/weapp/CoreManager.js +46 -191
- package/lib/weapp/CryptoController.js +2 -16
- package/lib/weapp/EventEmitter.js +1 -8
- package/lib/weapp/EventuallyQueue.js +277 -824
- package/lib/weapp/FacebookUtils.js +6 -42
- package/lib/weapp/IndexedDBStorageController.js +3 -14
- package/lib/weapp/InstallationController.js +2 -20
- package/lib/weapp/LiveQueryClient.js +105 -213
- 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 -19
- package/lib/weapp/ObjectStateMutations.js +18 -121
- package/lib/weapp/OfflineQuery.js +61 -222
- package/lib/weapp/Parse.js +12 -115
- package/lib/weapp/ParseACL.js +33 -148
- package/lib/weapp/ParseCLP.js +96 -314
- package/lib/weapp/ParseConfig.js +18 -95
- package/lib/weapp/ParseError.js +63 -99
- package/lib/weapp/ParseFile.js +129 -686
- package/lib/weapp/ParseGeoPoint.js +23 -89
- 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 +665 -1845
- package/lib/weapp/ParseOp.js +41 -287
- package/lib/weapp/ParsePolygon.js +13 -70
- package/lib/weapp/ParseQuery.js +403 -1504
- package/lib/weapp/ParseRelation.js +12 -68
- package/lib/weapp/ParseRole.js +13 -75
- package/lib/weapp/ParseSchema.js +49 -208
- package/lib/weapp/ParseSession.js +11 -69
- package/lib/weapp/ParseUser.js +274 -1127
- package/lib/weapp/Push.js +7 -50
- package/lib/weapp/RESTController.js +28 -157
- package/lib/weapp/SingleInstanceStateController.js +19 -144
- package/lib/weapp/Socket.weapp.js +0 -10
- package/lib/weapp/Storage.js +10 -80
- package/lib/weapp/StorageController.browser.js +4 -24
- package/lib/weapp/StorageController.default.js +4 -24
- package/lib/weapp/StorageController.react-native.js +6 -40
- package/lib/weapp/StorageController.weapp.js +5 -23
- package/lib/weapp/TaskQueue.js +1 -29
- package/lib/weapp/UniqueInstanceStateController.js +19 -149
- package/lib/weapp/Xhr.weapp.js +0 -17
- package/lib/weapp/arrayContainsObject.js +2 -23
- package/lib/weapp/canBeSerialized.js +3 -40
- package/lib/weapp/decode.js +3 -40
- package/lib/weapp/encode.js +9 -77
- package/lib/weapp/equals.js +2 -34
- package/lib/weapp/escape.js +1 -15
- package/lib/weapp/isRevocableSession.js +2 -18
- package/lib/weapp/parseDate.js +2 -20
- package/lib/weapp/promiseUtils.js +3 -21
- package/lib/weapp/unique.js +3 -24
- package/lib/weapp/unsavedChildren.js +6 -57
- package/lib/weapp/uuid.js +1 -6
- package/package.json +35 -31
- package/PATENTS +0 -37
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
14
|
-
|
|
15
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
16
|
-
|
|
17
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
18
|
-
|
|
19
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
20
|
-
|
|
21
13
|
var _ParseOp = require("./ParseOp");
|
|
22
|
-
|
|
23
14
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
24
|
-
|
|
25
15
|
var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
26
16
|
/**
|
|
27
|
-
* Copyright (c) 2015-present, Parse, LLC.
|
|
28
|
-
* All rights reserved.
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the BSD-style license found in the
|
|
31
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
32
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
33
|
-
*
|
|
34
17
|
* @flow
|
|
35
18
|
*/
|
|
36
|
-
|
|
37
19
|
/**
|
|
38
20
|
* Creates a new Relation for the given parent object and key. This
|
|
39
21
|
* constructor should rarely be used directly, but rather created by
|
|
@@ -47,18 +29,12 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
|
|
|
47
29
|
*
|
|
48
30
|
* @alias Parse.Relation
|
|
49
31
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
32
|
var ParseRelation = /*#__PURE__*/function () {
|
|
53
33
|
/**
|
|
54
34
|
* @param {Parse.Object} parent The parent of this relation.
|
|
55
35
|
* @param {string} key The key for this relation on the parent.
|
|
56
36
|
*/
|
|
57
|
-
function ParseRelation(parent
|
|
58
|
-
/*: ?ParseObject*/
|
|
59
|
-
, key
|
|
60
|
-
/*: ?string*/
|
|
61
|
-
) {
|
|
37
|
+
function ParseRelation(parent /*: ?ParseObject*/, key /*: ?string*/) {
|
|
62
38
|
(0, _classCallCheck2.default)(this, ParseRelation);
|
|
63
39
|
(0, _defineProperty2.default)(this, "parent", void 0);
|
|
64
40
|
(0, _defineProperty2.default)(this, "key", void 0);
|
|
@@ -67,29 +43,21 @@ var ParseRelation = /*#__PURE__*/function () {
|
|
|
67
43
|
this.key = key;
|
|
68
44
|
this.targetClassName = null;
|
|
69
45
|
}
|
|
46
|
+
|
|
70
47
|
/*
|
|
71
48
|
* Makes sure that this relation has the right parent and key.
|
|
72
49
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
50
|
(0, _createClass2.default)(ParseRelation, [{
|
|
76
51
|
key: "_ensureParentAndKey",
|
|
77
|
-
value: function (parent
|
|
78
|
-
/*: ParseObject*/
|
|
79
|
-
, key
|
|
80
|
-
/*: string*/
|
|
81
|
-
) {
|
|
52
|
+
value: function (parent /*: ParseObject*/, key /*: string*/) {
|
|
82
53
|
this.key = this.key || key;
|
|
83
|
-
|
|
84
54
|
if (this.key !== key) {
|
|
85
55
|
throw new Error('Internal Error. Relation retrieved from two different keys.');
|
|
86
56
|
}
|
|
87
|
-
|
|
88
57
|
if (this.parent) {
|
|
89
58
|
if (this.parent.className !== parent.className) {
|
|
90
59
|
throw new Error('Internal Error. Relation retrieved from two different Objects.');
|
|
91
60
|
}
|
|
92
|
-
|
|
93
61
|
if (this.parent.id) {
|
|
94
62
|
if (this.parent.id !== parent.id) {
|
|
95
63
|
throw new Error('Internal Error. Relation retrieved from two different Objects.');
|
|
@@ -101,122 +69,98 @@ var ParseRelation = /*#__PURE__*/function () {
|
|
|
101
69
|
this.parent = parent;
|
|
102
70
|
}
|
|
103
71
|
}
|
|
72
|
+
|
|
104
73
|
/**
|
|
105
74
|
* Adds a Parse.Object or an array of Parse.Objects to the relation.
|
|
106
75
|
*
|
|
107
76
|
* @param {(Parse.Object|Array)} objects The item or items to add.
|
|
108
77
|
* @returns {Parse.Object} The parent of the relation.
|
|
109
78
|
*/
|
|
110
|
-
|
|
111
79
|
}, {
|
|
112
80
|
key: "add",
|
|
113
|
-
value: function (objects
|
|
114
|
-
/*: ParseObject | Array<ParseObject | string>*/
|
|
115
|
-
)
|
|
116
|
-
/*: ParseObject*/
|
|
117
|
-
{
|
|
81
|
+
value: function (objects /*: ParseObject | Array<ParseObject | string>*/) /*: ParseObject*/{
|
|
118
82
|
if (!(0, _isArray.default)(objects)) {
|
|
119
83
|
objects = [objects];
|
|
120
84
|
}
|
|
121
|
-
|
|
122
85
|
var change = new _ParseOp.RelationOp(objects, []);
|
|
123
86
|
var parent = this.parent;
|
|
124
|
-
|
|
125
87
|
if (!parent) {
|
|
126
88
|
throw new Error('Cannot add to a Relation without a parent');
|
|
127
89
|
}
|
|
128
|
-
|
|
129
90
|
if (objects.length === 0) {
|
|
130
91
|
return parent;
|
|
131
92
|
}
|
|
132
|
-
|
|
133
93
|
parent.set(this.key, change);
|
|
134
94
|
this.targetClassName = change._targetClassName;
|
|
135
95
|
return parent;
|
|
136
96
|
}
|
|
97
|
+
|
|
137
98
|
/**
|
|
138
99
|
* Removes a Parse.Object or an array of Parse.Objects from this relation.
|
|
139
100
|
*
|
|
140
101
|
* @param {(Parse.Object|Array)} objects The item or items to remove.
|
|
141
102
|
*/
|
|
142
|
-
|
|
143
103
|
}, {
|
|
144
104
|
key: "remove",
|
|
145
|
-
value: function (objects
|
|
146
|
-
/*: ParseObject | Array<ParseObject | string>*/
|
|
147
|
-
) {
|
|
105
|
+
value: function (objects /*: ParseObject | Array<ParseObject | string>*/) {
|
|
148
106
|
if (!(0, _isArray.default)(objects)) {
|
|
149
107
|
objects = [objects];
|
|
150
108
|
}
|
|
151
|
-
|
|
152
109
|
var change = new _ParseOp.RelationOp([], objects);
|
|
153
|
-
|
|
154
110
|
if (!this.parent) {
|
|
155
111
|
throw new Error('Cannot remove from a Relation without a parent');
|
|
156
112
|
}
|
|
157
|
-
|
|
158
113
|
if (objects.length === 0) {
|
|
159
114
|
return;
|
|
160
115
|
}
|
|
161
|
-
|
|
162
116
|
this.parent.set(this.key, change);
|
|
163
117
|
this.targetClassName = change._targetClassName;
|
|
164
118
|
}
|
|
119
|
+
|
|
165
120
|
/**
|
|
166
121
|
* Returns a JSON version of the object suitable for saving to disk.
|
|
167
122
|
*
|
|
168
123
|
* @returns {object} JSON representation of Relation
|
|
169
124
|
*/
|
|
170
|
-
|
|
171
125
|
}, {
|
|
172
126
|
key: "toJSON",
|
|
173
|
-
value: function ()
|
|
174
|
-
/*: { __type: 'Relation', className: ?string }*/
|
|
175
|
-
{
|
|
127
|
+
value: function () /*: { __type: 'Relation', className: ?string }*/{
|
|
176
128
|
return {
|
|
177
129
|
__type: 'Relation',
|
|
178
130
|
className: this.targetClassName
|
|
179
131
|
};
|
|
180
132
|
}
|
|
133
|
+
|
|
181
134
|
/**
|
|
182
135
|
* Returns a Parse.Query that is limited to objects in this
|
|
183
136
|
* relation.
|
|
184
137
|
*
|
|
185
138
|
* @returns {Parse.Query} Relation Query
|
|
186
139
|
*/
|
|
187
|
-
|
|
188
140
|
}, {
|
|
189
141
|
key: "query",
|
|
190
|
-
value: function query()
|
|
191
|
-
/*: ParseQuery*/
|
|
192
|
-
{
|
|
142
|
+
value: function query() /*: ParseQuery*/{
|
|
193
143
|
var query;
|
|
194
144
|
var parent = this.parent;
|
|
195
|
-
|
|
196
145
|
if (!parent) {
|
|
197
146
|
throw new Error('Cannot construct a query for a Relation without a parent');
|
|
198
147
|
}
|
|
199
|
-
|
|
200
148
|
if (!this.targetClassName) {
|
|
201
149
|
query = new _ParseQuery.default(parent.className);
|
|
202
150
|
query._extraOptions.redirectClassNameForKey = this.key;
|
|
203
151
|
} else {
|
|
204
152
|
query = new _ParseQuery.default(this.targetClassName);
|
|
205
153
|
}
|
|
206
|
-
|
|
207
154
|
query._addCondition('$relatedTo', 'object', {
|
|
208
155
|
__type: 'Pointer',
|
|
209
156
|
className: parent.className,
|
|
210
157
|
objectId: parent.id
|
|
211
158
|
});
|
|
212
|
-
|
|
213
159
|
query._addCondition('$relatedTo', 'key', this.key);
|
|
214
|
-
|
|
215
160
|
return query;
|
|
216
161
|
}
|
|
217
162
|
}]);
|
|
218
163
|
return ParseRelation;
|
|
219
164
|
}();
|
|
220
|
-
|
|
221
165
|
var _default = ParseRelation;
|
|
222
166
|
exports.default = _default;
|
package/lib/browser/ParseRole.js
CHANGED
|
@@ -1,58 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
3
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
8
|
-
|
|
4
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
9
6
|
_Object$defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
|
-
|
|
13
9
|
exports.default = void 0;
|
|
14
|
-
|
|
15
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
16
|
-
|
|
17
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
18
|
-
|
|
19
12
|
var _get2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/get"));
|
|
20
|
-
|
|
21
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
22
|
-
|
|
23
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
24
|
-
|
|
25
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
26
|
-
|
|
27
16
|
var _ParseACL = _interopRequireDefault(require("./ParseACL"));
|
|
28
|
-
|
|
29
17
|
var _ParseError = _interopRequireDefault(require("./ParseError"));
|
|
30
|
-
|
|
31
18
|
var _ParseObject2 = _interopRequireDefault(require("./ParseObject"));
|
|
32
|
-
|
|
33
19
|
function _createSuper(Derived) {
|
|
34
20
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
35
|
-
|
|
36
21
|
return function () {
|
|
37
22
|
var Super = (0, _getPrototypeOf2.default)(Derived),
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
result;
|
|
40
24
|
if (hasNativeReflectConstruct) {
|
|
41
25
|
var NewTarget = (0, _getPrototypeOf2.default)(this).constructor;
|
|
42
26
|
result = _Reflect$construct(Super, arguments, NewTarget);
|
|
43
27
|
} else {
|
|
44
28
|
result = Super.apply(this, arguments);
|
|
45
29
|
}
|
|
46
|
-
|
|
47
30
|
return (0, _possibleConstructorReturn2.default)(this, result);
|
|
48
31
|
};
|
|
49
32
|
}
|
|
50
|
-
|
|
51
33
|
function _isNativeReflectConstruct() {
|
|
52
34
|
if (typeof Reflect === "undefined" || !_Reflect$construct) return false;
|
|
53
35
|
if (_Reflect$construct.sham) return false;
|
|
54
36
|
if (typeof Proxy === "function") return true;
|
|
55
|
-
|
|
56
37
|
try {
|
|
57
38
|
Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));
|
|
58
39
|
return true;
|
|
@@ -73,11 +54,8 @@ function _isNativeReflectConstruct() {
|
|
|
73
54
|
* @alias Parse.Role
|
|
74
55
|
* @augments Parse.Object
|
|
75
56
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
57
|
var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
79
58
|
(0, _inherits2.default)(ParseRole, _ParseObject);
|
|
80
|
-
|
|
81
59
|
var _super = _createSuper(ParseRole);
|
|
82
60
|
/**
|
|
83
61
|
* @param {string} name The name of the Role to create.
|
|
@@ -85,46 +63,32 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
85
63
|
* A Parse.Role is a local representation of a role persisted to the Parse
|
|
86
64
|
* cloud.
|
|
87
65
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function ParseRole(name
|
|
91
|
-
/*: string*/
|
|
92
|
-
, acl
|
|
93
|
-
/*: ParseACL*/
|
|
94
|
-
) {
|
|
66
|
+
function ParseRole(name /*: string*/, acl /*: ParseACL*/) {
|
|
95
67
|
var _this;
|
|
96
|
-
|
|
97
68
|
(0, _classCallCheck2.default)(this, ParseRole);
|
|
98
69
|
_this = _super.call(this, '_Role');
|
|
99
|
-
|
|
100
70
|
if (typeof name === 'string' && acl instanceof _ParseACL.default) {
|
|
101
71
|
_this.setName(name);
|
|
102
|
-
|
|
103
72
|
_this.setACL(acl);
|
|
104
73
|
}
|
|
105
|
-
|
|
106
74
|
return _this;
|
|
107
75
|
}
|
|
76
|
+
|
|
108
77
|
/**
|
|
109
78
|
* Gets the name of the role. You can alternatively call role.get("name")
|
|
110
79
|
*
|
|
111
80
|
* @returns {string} the name of the role.
|
|
112
81
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
82
|
(0, _createClass2.default)(ParseRole, [{
|
|
116
83
|
key: "getName",
|
|
117
|
-
value: function ()
|
|
118
|
-
/*: ?string*/
|
|
119
|
-
{
|
|
84
|
+
value: function () /*: ?string*/{
|
|
120
85
|
var name = this.get('name');
|
|
121
|
-
|
|
122
86
|
if (name == null || typeof name === 'string') {
|
|
123
87
|
return name;
|
|
124
88
|
}
|
|
125
|
-
|
|
126
89
|
return '';
|
|
127
90
|
}
|
|
91
|
+
|
|
128
92
|
/**
|
|
129
93
|
* Sets the name for a role. This value must be set before the role has
|
|
130
94
|
* been saved to the server, and cannot be set once the role has been
|
|
@@ -142,20 +106,13 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
142
106
|
* callbacks.
|
|
143
107
|
* @returns {(ParseObject|boolean)} true if the set succeeded.
|
|
144
108
|
*/
|
|
145
|
-
|
|
146
109
|
}, {
|
|
147
110
|
key: "setName",
|
|
148
|
-
value: function (name
|
|
149
|
-
/*: string*/
|
|
150
|
-
, options
|
|
151
|
-
/*:: ?: mixed*/
|
|
152
|
-
)
|
|
153
|
-
/*: ParseObject | boolean*/
|
|
154
|
-
{
|
|
111
|
+
value: function (name /*: string*/, options /*:: ?: mixed*/) /*: ParseObject | boolean*/{
|
|
155
112
|
this._validateName(name);
|
|
156
|
-
|
|
157
113
|
return this.set('name', name, options);
|
|
158
114
|
}
|
|
115
|
+
|
|
159
116
|
/**
|
|
160
117
|
* Gets the Parse.Relation for the Parse.Users that are direct
|
|
161
118
|
* children of this role. These users are granted any privileges that this
|
|
@@ -167,14 +124,12 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
167
124
|
* @returns {Parse.Relation} the relation for the users belonging to this
|
|
168
125
|
* role.
|
|
169
126
|
*/
|
|
170
|
-
|
|
171
127
|
}, {
|
|
172
128
|
key: "getUsers",
|
|
173
|
-
value: function ()
|
|
174
|
-
/*: ParseRelation*/
|
|
175
|
-
{
|
|
129
|
+
value: function () /*: ParseRelation*/{
|
|
176
130
|
return this.relation('users');
|
|
177
131
|
}
|
|
132
|
+
|
|
178
133
|
/**
|
|
179
134
|
* Gets the Parse.Relation for the Parse.Roles that are direct
|
|
180
135
|
* children of this role. These roles' users are granted any privileges that
|
|
@@ -186,12 +141,9 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
186
141
|
* @returns {Parse.Relation} the relation for the roles belonging to this
|
|
187
142
|
* role.
|
|
188
143
|
*/
|
|
189
|
-
|
|
190
144
|
}, {
|
|
191
145
|
key: "getRoles",
|
|
192
|
-
value: function ()
|
|
193
|
-
/*: ParseRelation*/
|
|
194
|
-
{
|
|
146
|
+
value: function () /*: ParseRelation*/{
|
|
195
147
|
return this.relation('roles');
|
|
196
148
|
}
|
|
197
149
|
}, {
|
|
@@ -200,50 +152,36 @@ var ParseRole = /*#__PURE__*/function (_ParseObject) {
|
|
|
200
152
|
if (typeof newName !== 'string') {
|
|
201
153
|
throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name must be a String.");
|
|
202
154
|
}
|
|
203
|
-
|
|
204
155
|
if (!/^[0-9a-zA-Z\-_ ]+$/.test(newName)) {
|
|
205
156
|
throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can be only contain alphanumeric characters, _, " + '-, and spaces.');
|
|
206
157
|
}
|
|
207
158
|
}
|
|
208
159
|
}, {
|
|
209
160
|
key: "validate",
|
|
210
|
-
value: function (attrs
|
|
211
|
-
/*: AttributeMap*/
|
|
212
|
-
, options
|
|
213
|
-
/*:: ?: mixed*/
|
|
214
|
-
)
|
|
215
|
-
/*: ParseError | boolean*/
|
|
216
|
-
{
|
|
161
|
+
value: function (attrs /*: AttributeMap*/, options /*:: ?: mixed*/) /*: ParseError | boolean*/{
|
|
217
162
|
var isInvalid = (0, _get2.default)((0, _getPrototypeOf2.default)(ParseRole.prototype), "validate", this).call(this, attrs, options);
|
|
218
|
-
|
|
219
163
|
if (isInvalid) {
|
|
220
164
|
return isInvalid;
|
|
221
165
|
}
|
|
222
|
-
|
|
223
166
|
if ('name' in attrs && attrs.name !== this.getName()) {
|
|
224
167
|
var newName = attrs.name;
|
|
225
|
-
|
|
226
168
|
if (this.id && this.id !== attrs.objectId) {
|
|
227
169
|
// Check to see if the objectId being set matches this.id
|
|
228
170
|
// This happens during a fetch -- the id is set before calling fetch
|
|
229
171
|
// Let the name be set in this case
|
|
230
172
|
return new _ParseError.default(_ParseError.default.OTHER_CAUSE, "A role's name can only be set before it has been saved.");
|
|
231
173
|
}
|
|
232
|
-
|
|
233
174
|
try {
|
|
234
175
|
this._validateName(newName);
|
|
235
176
|
} catch (e) {
|
|
236
177
|
return e;
|
|
237
178
|
}
|
|
238
179
|
}
|
|
239
|
-
|
|
240
180
|
return false;
|
|
241
181
|
}
|
|
242
182
|
}]);
|
|
243
183
|
return ParseRole;
|
|
244
184
|
}(_ParseObject2.default);
|
|
245
|
-
|
|
246
185
|
_ParseObject2.default.registerSubclass('_Role', ParseRole);
|
|
247
|
-
|
|
248
186
|
var _default = ParseRole;
|
|
249
187
|
exports.default = _default;
|