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
package/lib/weapp/ParseSchema.js
CHANGED
|
@@ -1,46 +1,27 @@
|
|
|
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 _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
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 _CoreManager = _interopRequireDefault(require("./CoreManager"));
|
|
22
|
-
|
|
23
14
|
var _ParseObject = _interopRequireDefault(require("./ParseObject"));
|
|
24
|
-
|
|
25
15
|
var _ParseCLP = _interopRequireDefault(require("./ParseCLP"));
|
|
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
19
|
|
|
37
|
-
|
|
38
20
|
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];
|
|
39
21
|
/*:: type FieldOptions = {
|
|
40
22
|
required: boolean,
|
|
41
23
|
defaultValue: mixed,
|
|
42
24
|
};*/
|
|
43
|
-
|
|
44
25
|
/**
|
|
45
26
|
* A Parse.Schema object is for handling schema data from Parse.
|
|
46
27
|
* <p>All the schemas methods require MasterKey.
|
|
@@ -58,20 +39,16 @@ var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'P
|
|
|
58
39
|
*
|
|
59
40
|
* @alias Parse.Schema
|
|
60
41
|
*/
|
|
61
|
-
|
|
62
42
|
var ParseSchema = /*#__PURE__*/function () {
|
|
63
43
|
/**
|
|
64
44
|
* @param {string} className Parse Class string.
|
|
65
45
|
*/
|
|
66
|
-
function ParseSchema(className
|
|
67
|
-
/*: string*/
|
|
68
|
-
) {
|
|
46
|
+
function ParseSchema(className /*: string*/) {
|
|
69
47
|
(0, _classCallCheck2.default)(this, ParseSchema);
|
|
70
48
|
(0, _defineProperty2.default)(this, "className", void 0);
|
|
71
49
|
(0, _defineProperty2.default)(this, "_fields", void 0);
|
|
72
50
|
(0, _defineProperty2.default)(this, "_indexes", void 0);
|
|
73
51
|
(0, _defineProperty2.default)(this, "_clp", void 0);
|
|
74
|
-
|
|
75
52
|
if (typeof className === 'string') {
|
|
76
53
|
if (className === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
|
|
77
54
|
this.className = '_User';
|
|
@@ -79,18 +56,16 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
79
56
|
this.className = className;
|
|
80
57
|
}
|
|
81
58
|
}
|
|
82
|
-
|
|
83
59
|
this._fields = {};
|
|
84
60
|
this._indexes = {};
|
|
85
61
|
}
|
|
62
|
+
|
|
86
63
|
/**
|
|
87
64
|
* Static method to get all schemas
|
|
88
65
|
*
|
|
89
66
|
* @returns {Promise} A promise that is resolved with the result when
|
|
90
67
|
* the query completes.
|
|
91
68
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
69
|
(0, _createClass2.default)(ParseSchema, [{
|
|
95
70
|
key: "get",
|
|
96
71
|
value:
|
|
@@ -102,31 +77,26 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
102
77
|
*/
|
|
103
78
|
function () {
|
|
104
79
|
this.assertClassName();
|
|
105
|
-
|
|
106
80
|
var controller = _CoreManager.default.getSchemaController();
|
|
107
|
-
|
|
108
81
|
return controller.get(this.className).then(function (response) {
|
|
109
82
|
if (!response) {
|
|
110
83
|
throw new Error('Schema not found.');
|
|
111
84
|
}
|
|
112
|
-
|
|
113
85
|
return response;
|
|
114
86
|
});
|
|
115
87
|
}
|
|
88
|
+
|
|
116
89
|
/**
|
|
117
90
|
* Create a new Schema on Parse
|
|
118
91
|
*
|
|
119
92
|
* @returns {Promise} A promise that is resolved with the result when
|
|
120
93
|
* the query completes.
|
|
121
94
|
*/
|
|
122
|
-
|
|
123
95
|
}, {
|
|
124
96
|
key: "save",
|
|
125
97
|
value: function () {
|
|
126
98
|
this.assertClassName();
|
|
127
|
-
|
|
128
99
|
var controller = _CoreManager.default.getSchemaController();
|
|
129
|
-
|
|
130
100
|
var params = {
|
|
131
101
|
className: this.className,
|
|
132
102
|
fields: this._fields,
|
|
@@ -135,20 +105,18 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
135
105
|
};
|
|
136
106
|
return controller.create(this.className, params);
|
|
137
107
|
}
|
|
108
|
+
|
|
138
109
|
/**
|
|
139
110
|
* Update a Schema on Parse
|
|
140
111
|
*
|
|
141
112
|
* @returns {Promise} A promise that is resolved with the result when
|
|
142
113
|
* the query completes.
|
|
143
114
|
*/
|
|
144
|
-
|
|
145
115
|
}, {
|
|
146
116
|
key: "update",
|
|
147
117
|
value: function () {
|
|
148
118
|
this.assertClassName();
|
|
149
|
-
|
|
150
119
|
var controller = _CoreManager.default.getSchemaController();
|
|
151
|
-
|
|
152
120
|
var params = {
|
|
153
121
|
className: this.className,
|
|
154
122
|
fields: this._fields,
|
|
@@ -159,6 +127,7 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
159
127
|
this._indexes = {};
|
|
160
128
|
return controller.update(this.className, params);
|
|
161
129
|
}
|
|
130
|
+
|
|
162
131
|
/**
|
|
163
132
|
* Removing a Schema from Parse
|
|
164
133
|
* Can only be used on Schema without objects
|
|
@@ -166,16 +135,14 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
166
135
|
* @returns {Promise} A promise that is resolved with the result when
|
|
167
136
|
* the query completes.
|
|
168
137
|
*/
|
|
169
|
-
|
|
170
138
|
}, {
|
|
171
139
|
key: "delete",
|
|
172
140
|
value: function () {
|
|
173
141
|
this.assertClassName();
|
|
174
|
-
|
|
175
142
|
var controller = _CoreManager.default.getSchemaController();
|
|
176
|
-
|
|
177
143
|
return controller.delete(this.className);
|
|
178
144
|
}
|
|
145
|
+
|
|
179
146
|
/**
|
|
180
147
|
* Removes all objects from a Schema (class) in Parse.
|
|
181
148
|
* EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
|
|
@@ -183,22 +150,19 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
183
150
|
* @returns {Promise} A promise that is resolved with the result when
|
|
184
151
|
* the query completes.
|
|
185
152
|
*/
|
|
186
|
-
|
|
187
153
|
}, {
|
|
188
154
|
key: "purge",
|
|
189
155
|
value: function () {
|
|
190
156
|
this.assertClassName();
|
|
191
|
-
|
|
192
157
|
var controller = _CoreManager.default.getSchemaController();
|
|
193
|
-
|
|
194
158
|
return controller.purge(this.className);
|
|
195
159
|
}
|
|
160
|
+
|
|
196
161
|
/**
|
|
197
162
|
* Assert if ClassName has been filled
|
|
198
163
|
*
|
|
199
164
|
* @private
|
|
200
165
|
*/
|
|
201
|
-
|
|
202
166
|
}, {
|
|
203
167
|
key: "assertClassName",
|
|
204
168
|
value: function () {
|
|
@@ -206,6 +170,7 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
206
170
|
throw new Error('You must set a Class Name before making any request.');
|
|
207
171
|
}
|
|
208
172
|
}
|
|
173
|
+
|
|
209
174
|
/**
|
|
210
175
|
* Sets Class Level Permissions when creating / updating a Schema.
|
|
211
176
|
* EXERCISE CAUTION, running this may override CLP for this schema and cannot be reversed
|
|
@@ -213,20 +178,17 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
213
178
|
* @param {object | Parse.CLP} clp Class Level Permissions
|
|
214
179
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
215
180
|
*/
|
|
216
|
-
|
|
217
181
|
}, {
|
|
218
182
|
key: "setCLP",
|
|
219
|
-
value: function (clp
|
|
220
|
-
/*: PermissionsMap | ParseCLP*/
|
|
221
|
-
) {
|
|
183
|
+
value: function (clp /*: PermissionsMap | ParseCLP*/) {
|
|
222
184
|
if (clp instanceof _ParseCLP.default) {
|
|
223
185
|
this._clp = clp.toJSON();
|
|
224
186
|
} else {
|
|
225
187
|
this._clp = clp;
|
|
226
188
|
}
|
|
227
|
-
|
|
228
189
|
return this;
|
|
229
190
|
}
|
|
191
|
+
|
|
230
192
|
/**
|
|
231
193
|
* Adding a Field to Create / Update a Schema
|
|
232
194
|
*
|
|
@@ -240,47 +202,32 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
240
202
|
* </ul>
|
|
241
203
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
242
204
|
*/
|
|
243
|
-
|
|
244
205
|
}, {
|
|
245
206
|
key: "addField",
|
|
246
|
-
value: function (name
|
|
247
|
-
|
|
248
|
-
, type
|
|
249
|
-
/*: string*/
|
|
250
|
-
) {
|
|
251
|
-
var options
|
|
252
|
-
/*: FieldOptions*/
|
|
253
|
-
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
207
|
+
value: function (name /*: string*/, type /*: string*/) {
|
|
208
|
+
var options /*: FieldOptions*/ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
254
209
|
type = type || 'String';
|
|
255
|
-
|
|
256
210
|
if (!name) {
|
|
257
211
|
throw new Error('field name may not be null.');
|
|
258
212
|
}
|
|
259
|
-
|
|
260
213
|
if ((0, _indexOf.default)(FIELD_TYPES).call(FIELD_TYPES, type) === -1) {
|
|
261
214
|
throw new Error("".concat(type, " is not a valid type."));
|
|
262
215
|
}
|
|
263
|
-
|
|
264
216
|
if (type === 'Pointer') {
|
|
265
217
|
return this.addPointer(name, options.targetClass, options);
|
|
266
218
|
}
|
|
267
|
-
|
|
268
219
|
if (type === 'Relation') {
|
|
269
220
|
return this.addRelation(name, options.targetClass, options);
|
|
270
221
|
}
|
|
271
|
-
|
|
272
222
|
var fieldOptions = {
|
|
273
223
|
type: type
|
|
274
224
|
};
|
|
275
|
-
|
|
276
225
|
if (typeof options.required === 'boolean') {
|
|
277
226
|
fieldOptions.required = options.required;
|
|
278
227
|
}
|
|
279
|
-
|
|
280
228
|
if (options.defaultValue !== undefined) {
|
|
281
229
|
fieldOptions.defaultValue = options.defaultValue;
|
|
282
230
|
}
|
|
283
|
-
|
|
284
231
|
if (type === 'Date') {
|
|
285
232
|
if (options && options.defaultValue) {
|
|
286
233
|
fieldOptions.defaultValue = {
|
|
@@ -289,10 +236,10 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
289
236
|
};
|
|
290
237
|
}
|
|
291
238
|
}
|
|
292
|
-
|
|
293
239
|
this._fields[name] = fieldOptions;
|
|
294
240
|
return this;
|
|
295
241
|
}
|
|
242
|
+
|
|
296
243
|
/**
|
|
297
244
|
* Adding an Index to Create / Update a Schema
|
|
298
245
|
*
|
|
@@ -304,25 +251,19 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
304
251
|
* schema.addIndex('index_name', { 'field': 1 });
|
|
305
252
|
* </pre>
|
|
306
253
|
*/
|
|
307
|
-
|
|
308
254
|
}, {
|
|
309
255
|
key: "addIndex",
|
|
310
|
-
value: function (name
|
|
311
|
-
/*: string*/
|
|
312
|
-
, index
|
|
313
|
-
/*: any*/
|
|
314
|
-
) {
|
|
256
|
+
value: function (name /*: string*/, index /*: any*/) {
|
|
315
257
|
if (!name) {
|
|
316
258
|
throw new Error('index name may not be null.');
|
|
317
259
|
}
|
|
318
|
-
|
|
319
260
|
if (!index) {
|
|
320
261
|
throw new Error('index may not be null.');
|
|
321
262
|
}
|
|
322
|
-
|
|
323
263
|
this._indexes[name] = index;
|
|
324
264
|
return this;
|
|
325
265
|
}
|
|
266
|
+
|
|
326
267
|
/**
|
|
327
268
|
* Adding String Field
|
|
328
269
|
*
|
|
@@ -330,16 +271,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
330
271
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
331
272
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
332
273
|
*/
|
|
333
|
-
|
|
334
274
|
}, {
|
|
335
275
|
key: "addString",
|
|
336
|
-
value: function (name
|
|
337
|
-
/*: string*/
|
|
338
|
-
, options
|
|
339
|
-
/*: FieldOptions*/
|
|
340
|
-
) {
|
|
276
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
341
277
|
return this.addField(name, 'String', options);
|
|
342
278
|
}
|
|
279
|
+
|
|
343
280
|
/**
|
|
344
281
|
* Adding Number Field
|
|
345
282
|
*
|
|
@@ -347,16 +284,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
347
284
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
348
285
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
349
286
|
*/
|
|
350
|
-
|
|
351
287
|
}, {
|
|
352
288
|
key: "addNumber",
|
|
353
|
-
value: function (name
|
|
354
|
-
/*: string*/
|
|
355
|
-
, options
|
|
356
|
-
/*: FieldOptions*/
|
|
357
|
-
) {
|
|
289
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
358
290
|
return this.addField(name, 'Number', options);
|
|
359
291
|
}
|
|
292
|
+
|
|
360
293
|
/**
|
|
361
294
|
* Adding Boolean Field
|
|
362
295
|
*
|
|
@@ -364,16 +297,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
364
297
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
365
298
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
366
299
|
*/
|
|
367
|
-
|
|
368
300
|
}, {
|
|
369
301
|
key: "addBoolean",
|
|
370
|
-
value: function (name
|
|
371
|
-
/*: string*/
|
|
372
|
-
, options
|
|
373
|
-
/*: FieldOptions*/
|
|
374
|
-
) {
|
|
302
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
375
303
|
return this.addField(name, 'Boolean', options);
|
|
376
304
|
}
|
|
305
|
+
|
|
377
306
|
/**
|
|
378
307
|
* Adding Date Field
|
|
379
308
|
*
|
|
@@ -381,16 +310,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
381
310
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
382
311
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
383
312
|
*/
|
|
384
|
-
|
|
385
313
|
}, {
|
|
386
314
|
key: "addDate",
|
|
387
|
-
value: function (name
|
|
388
|
-
/*: string*/
|
|
389
|
-
, options
|
|
390
|
-
/*: FieldOptions*/
|
|
391
|
-
) {
|
|
315
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
392
316
|
return this.addField(name, 'Date', options);
|
|
393
317
|
}
|
|
318
|
+
|
|
394
319
|
/**
|
|
395
320
|
* Adding File Field
|
|
396
321
|
*
|
|
@@ -398,16 +323,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
398
323
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
399
324
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
400
325
|
*/
|
|
401
|
-
|
|
402
326
|
}, {
|
|
403
327
|
key: "addFile",
|
|
404
|
-
value: function (name
|
|
405
|
-
/*: string*/
|
|
406
|
-
, options
|
|
407
|
-
/*: FieldOptions*/
|
|
408
|
-
) {
|
|
328
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
409
329
|
return this.addField(name, 'File', options);
|
|
410
330
|
}
|
|
331
|
+
|
|
411
332
|
/**
|
|
412
333
|
* Adding GeoPoint Field
|
|
413
334
|
*
|
|
@@ -415,16 +336,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
415
336
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
416
337
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
417
338
|
*/
|
|
418
|
-
|
|
419
339
|
}, {
|
|
420
340
|
key: "addGeoPoint",
|
|
421
|
-
value: function (name
|
|
422
|
-
/*: string*/
|
|
423
|
-
, options
|
|
424
|
-
/*: FieldOptions*/
|
|
425
|
-
) {
|
|
341
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
426
342
|
return this.addField(name, 'GeoPoint', options);
|
|
427
343
|
}
|
|
344
|
+
|
|
428
345
|
/**
|
|
429
346
|
* Adding Polygon Field
|
|
430
347
|
*
|
|
@@ -432,16 +349,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
432
349
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
433
350
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
434
351
|
*/
|
|
435
|
-
|
|
436
352
|
}, {
|
|
437
353
|
key: "addPolygon",
|
|
438
|
-
value: function (name
|
|
439
|
-
/*: string*/
|
|
440
|
-
, options
|
|
441
|
-
/*: FieldOptions*/
|
|
442
|
-
) {
|
|
354
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
443
355
|
return this.addField(name, 'Polygon', options);
|
|
444
356
|
}
|
|
357
|
+
|
|
445
358
|
/**
|
|
446
359
|
* Adding Array Field
|
|
447
360
|
*
|
|
@@ -449,16 +362,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
449
362
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
450
363
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
451
364
|
*/
|
|
452
|
-
|
|
453
365
|
}, {
|
|
454
366
|
key: "addArray",
|
|
455
|
-
value: function (name
|
|
456
|
-
/*: string*/
|
|
457
|
-
, options
|
|
458
|
-
/*: FieldOptions*/
|
|
459
|
-
) {
|
|
367
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
460
368
|
return this.addField(name, 'Array', options);
|
|
461
369
|
}
|
|
370
|
+
|
|
462
371
|
/**
|
|
463
372
|
* Adding Object Field
|
|
464
373
|
*
|
|
@@ -466,16 +375,12 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
466
375
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
467
376
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
468
377
|
*/
|
|
469
|
-
|
|
470
378
|
}, {
|
|
471
379
|
key: "addObject",
|
|
472
|
-
value: function (name
|
|
473
|
-
/*: string*/
|
|
474
|
-
, options
|
|
475
|
-
/*: FieldOptions*/
|
|
476
|
-
) {
|
|
380
|
+
value: function (name /*: string*/, options /*: FieldOptions*/) {
|
|
477
381
|
return this.addField(name, 'Object', options);
|
|
478
382
|
}
|
|
383
|
+
|
|
479
384
|
/**
|
|
480
385
|
* Adding Pointer Field
|
|
481
386
|
*
|
|
@@ -484,46 +389,33 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
484
389
|
* @param {object} options See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Schema.html#addField addField}
|
|
485
390
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
486
391
|
*/
|
|
487
|
-
|
|
488
392
|
}, {
|
|
489
393
|
key: "addPointer",
|
|
490
|
-
value: function (name
|
|
491
|
-
|
|
492
|
-
, targetClass
|
|
493
|
-
/*: string*/
|
|
494
|
-
) {
|
|
495
|
-
var options
|
|
496
|
-
/*: FieldOptions*/
|
|
497
|
-
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
498
|
-
|
|
394
|
+
value: function (name /*: string*/, targetClass /*: string*/) {
|
|
395
|
+
var options /*: FieldOptions*/ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
499
396
|
if (!name) {
|
|
500
397
|
throw new Error('field name may not be null.');
|
|
501
398
|
}
|
|
502
|
-
|
|
503
399
|
if (!targetClass) {
|
|
504
400
|
throw new Error('You need to set the targetClass of the Pointer.');
|
|
505
401
|
}
|
|
506
|
-
|
|
507
402
|
var fieldOptions = {
|
|
508
403
|
type: 'Pointer',
|
|
509
404
|
targetClass: targetClass
|
|
510
405
|
};
|
|
511
|
-
|
|
512
406
|
if (typeof options.required === 'boolean') {
|
|
513
407
|
fieldOptions.required = options.required;
|
|
514
408
|
}
|
|
515
|
-
|
|
516
409
|
if (options.defaultValue !== undefined) {
|
|
517
410
|
fieldOptions.defaultValue = options.defaultValue;
|
|
518
|
-
|
|
519
411
|
if (options.defaultValue instanceof _ParseObject.default) {
|
|
520
412
|
fieldOptions.defaultValue = options.defaultValue.toPointer();
|
|
521
413
|
}
|
|
522
414
|
}
|
|
523
|
-
|
|
524
415
|
this._fields[name] = fieldOptions;
|
|
525
416
|
return this;
|
|
526
417
|
}
|
|
418
|
+
|
|
527
419
|
/**
|
|
528
420
|
* Adding Relation Field
|
|
529
421
|
*
|
|
@@ -531,57 +423,46 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
531
423
|
* @param {string} targetClass Name of the target Pointer Class
|
|
532
424
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
533
425
|
*/
|
|
534
|
-
|
|
535
426
|
}, {
|
|
536
427
|
key: "addRelation",
|
|
537
|
-
value: function (name
|
|
538
|
-
/*: string*/
|
|
539
|
-
, targetClass
|
|
540
|
-
/*: string*/
|
|
541
|
-
) {
|
|
428
|
+
value: function (name /*: string*/, targetClass /*: string*/) {
|
|
542
429
|
if (!name) {
|
|
543
430
|
throw new Error('field name may not be null.');
|
|
544
431
|
}
|
|
545
|
-
|
|
546
432
|
if (!targetClass) {
|
|
547
433
|
throw new Error('You need to set the targetClass of the Relation.');
|
|
548
434
|
}
|
|
549
|
-
|
|
550
435
|
this._fields[name] = {
|
|
551
436
|
type: 'Relation',
|
|
552
437
|
targetClass: targetClass
|
|
553
438
|
};
|
|
554
439
|
return this;
|
|
555
440
|
}
|
|
441
|
+
|
|
556
442
|
/**
|
|
557
443
|
* Deleting a Field to Update on a Schema
|
|
558
444
|
*
|
|
559
445
|
* @param {string} name Name of the field
|
|
560
446
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
561
447
|
*/
|
|
562
|
-
|
|
563
448
|
}, {
|
|
564
449
|
key: "deleteField",
|
|
565
|
-
value: function (name
|
|
566
|
-
/*: string*/
|
|
567
|
-
) {
|
|
450
|
+
value: function (name /*: string*/) {
|
|
568
451
|
this._fields[name] = {
|
|
569
452
|
__op: 'Delete'
|
|
570
453
|
};
|
|
571
454
|
return this;
|
|
572
455
|
}
|
|
456
|
+
|
|
573
457
|
/**
|
|
574
458
|
* Deleting an Index to Update on a Schema
|
|
575
459
|
*
|
|
576
460
|
* @param {string} name Name of the field
|
|
577
461
|
* @returns {Parse.Schema} Returns the schema, so you can chain this call.
|
|
578
462
|
*/
|
|
579
|
-
|
|
580
463
|
}, {
|
|
581
464
|
key: "deleteIndex",
|
|
582
|
-
value: function (name
|
|
583
|
-
/*: string*/
|
|
584
|
-
) {
|
|
465
|
+
value: function (name /*: string*/) {
|
|
585
466
|
this._indexes[name] = {
|
|
586
467
|
__op: 'Delete'
|
|
587
468
|
};
|
|
@@ -591,83 +472,43 @@ var ParseSchema = /*#__PURE__*/function () {
|
|
|
591
472
|
key: "all",
|
|
592
473
|
value: function () {
|
|
593
474
|
var controller = _CoreManager.default.getSchemaController();
|
|
594
|
-
|
|
595
475
|
return controller.get('').then(function (response) {
|
|
596
476
|
if (response.results.length === 0) {
|
|
597
477
|
throw new Error('Schema not found.');
|
|
598
478
|
}
|
|
599
|
-
|
|
600
479
|
return response.results;
|
|
601
480
|
});
|
|
602
481
|
}
|
|
603
482
|
}]);
|
|
604
483
|
return ParseSchema;
|
|
605
484
|
}();
|
|
606
|
-
|
|
607
485
|
var DefaultController = {
|
|
608
|
-
send: function (className
|
|
609
|
-
|
|
610
|
-
, method
|
|
611
|
-
/*: string*/
|
|
612
|
-
)
|
|
613
|
-
/*: Promise*/
|
|
614
|
-
{
|
|
615
|
-
var params
|
|
616
|
-
/*: any*/
|
|
617
|
-
= arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
618
|
-
|
|
486
|
+
send: function (className /*: string*/, method /*: string*/) /*: Promise*/{
|
|
487
|
+
var params /*: any*/ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
619
488
|
var RESTController = _CoreManager.default.getRESTController();
|
|
620
|
-
|
|
621
489
|
return RESTController.request(method, "schemas/".concat(className), params, {
|
|
622
490
|
useMasterKey: true
|
|
623
491
|
});
|
|
624
492
|
},
|
|
625
|
-
get: function (className
|
|
626
|
-
/*: string*/
|
|
627
|
-
)
|
|
628
|
-
/*: Promise*/
|
|
629
|
-
{
|
|
493
|
+
get: function (className /*: string*/) /*: Promise*/{
|
|
630
494
|
return this.send(className, 'GET');
|
|
631
495
|
},
|
|
632
|
-
create: function (className
|
|
633
|
-
/*: string*/
|
|
634
|
-
, params
|
|
635
|
-
/*: any*/
|
|
636
|
-
)
|
|
637
|
-
/*: Promise*/
|
|
638
|
-
{
|
|
496
|
+
create: function (className /*: string*/, params /*: any*/) /*: Promise*/{
|
|
639
497
|
return this.send(className, 'POST', params);
|
|
640
498
|
},
|
|
641
|
-
update: function (className
|
|
642
|
-
/*: string*/
|
|
643
|
-
, params
|
|
644
|
-
/*: any*/
|
|
645
|
-
)
|
|
646
|
-
/*: Promise*/
|
|
647
|
-
{
|
|
499
|
+
update: function (className /*: string*/, params /*: any*/) /*: Promise*/{
|
|
648
500
|
return this.send(className, 'PUT', params);
|
|
649
501
|
},
|
|
650
|
-
delete: function (className
|
|
651
|
-
/*: string*/
|
|
652
|
-
)
|
|
653
|
-
/*: Promise*/
|
|
654
|
-
{
|
|
502
|
+
delete: function (className /*: string*/) /*: Promise*/{
|
|
655
503
|
return this.send(className, 'DELETE');
|
|
656
504
|
},
|
|
657
|
-
purge: function (className
|
|
658
|
-
/*: string*/
|
|
659
|
-
)
|
|
660
|
-
/*: Promise*/
|
|
661
|
-
{
|
|
505
|
+
purge: function (className /*: string*/) /*: Promise*/{
|
|
662
506
|
var RESTController = _CoreManager.default.getRESTController();
|
|
663
|
-
|
|
664
507
|
return RESTController.request('DELETE', "purge/".concat(className), {}, {
|
|
665
508
|
useMasterKey: true
|
|
666
509
|
});
|
|
667
510
|
}
|
|
668
511
|
};
|
|
669
|
-
|
|
670
512
|
_CoreManager.default.setSchemaController(DefaultController);
|
|
671
|
-
|
|
672
513
|
var _default = ParseSchema;
|
|
673
514
|
exports.default = _default;
|