parse 6.1.0-alpha.1 → 6.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/README.md +0 -8
  2. package/dist/parse.js +93 -105
  3. package/dist/parse.min.js +2 -2
  4. package/dist/parse.weapp.js +93 -105
  5. package/dist/parse.weapp.min.js +2 -2
  6. package/lib/browser/Cloud.js +1 -0
  7. package/lib/browser/CoreManager.js +2 -2
  8. package/lib/browser/CryptoController.js +0 -1
  9. package/lib/browser/EventEmitter.js +0 -1
  10. package/lib/browser/EventuallyQueue.js +6 -10
  11. package/lib/browser/IndexedDBStorageController.js +0 -1
  12. package/lib/browser/InstallationController.js +0 -1
  13. package/lib/browser/LiveQuerySubscription.js +4 -4
  14. package/lib/browser/LocalDatastore.js +0 -1
  15. package/lib/browser/LocalDatastoreController.default.js +0 -1
  16. package/lib/browser/LocalDatastoreController.js +0 -1
  17. package/lib/browser/LocalDatastoreController.react-native.js +0 -1
  18. package/lib/browser/OfflineQuery.js +0 -1
  19. package/lib/browser/Parse.js +12 -1
  20. package/lib/browser/ParseACL.js +1 -1
  21. package/lib/browser/ParseConfig.js +2 -4
  22. package/lib/browser/ParseInstallation.js +0 -1
  23. package/lib/browser/ParseLiveQuery.js +2 -2
  24. package/lib/browser/ParseObject.js +10 -10
  25. package/lib/browser/ParseQuery.js +26 -25
  26. package/lib/browser/ParseRole.js +1 -1
  27. package/lib/browser/ParseSchema.js +6 -6
  28. package/lib/browser/ParseUser.js +10 -12
  29. package/lib/browser/RESTController.js +7 -3
  30. package/lib/browser/Socket.weapp.js +0 -1
  31. package/lib/browser/Storage.js +0 -1
  32. package/lib/browser/StorageController.browser.js +0 -1
  33. package/lib/browser/StorageController.default.js +0 -1
  34. package/lib/browser/StorageController.js +0 -1
  35. package/lib/browser/StorageController.react-native.js +0 -1
  36. package/lib/browser/StorageController.weapp.js +0 -1
  37. package/lib/browser/TaskQueue.js +0 -1
  38. package/lib/browser/WebSocketController.js +0 -1
  39. package/lib/browser/Xhr.weapp.js +0 -1
  40. package/lib/browser/uuid.js +0 -1
  41. package/lib/node/Cloud.js +1 -0
  42. package/lib/node/CoreManager.js +2 -2
  43. package/lib/node/CryptoController.js +0 -1
  44. package/lib/node/EventEmitter.js +0 -1
  45. package/lib/node/EventuallyQueue.js +6 -7
  46. package/lib/node/IndexedDBStorageController.js +0 -1
  47. package/lib/node/InstallationController.js +0 -1
  48. package/lib/node/LiveQuerySubscription.js +4 -4
  49. package/lib/node/LocalDatastore.js +0 -1
  50. package/lib/node/LocalDatastoreController.default.js +0 -1
  51. package/lib/node/LocalDatastoreController.js +0 -1
  52. package/lib/node/LocalDatastoreController.react-native.js +0 -1
  53. package/lib/node/OfflineQuery.js +0 -1
  54. package/lib/node/Parse.js +12 -1
  55. package/lib/node/ParseACL.js +1 -1
  56. package/lib/node/ParseConfig.js +2 -2
  57. package/lib/node/ParseInstallation.js +0 -1
  58. package/lib/node/ParseLiveQuery.js +2 -2
  59. package/lib/node/ParseObject.js +10 -7
  60. package/lib/node/ParseQuery.js +7 -7
  61. package/lib/node/ParseRole.js +1 -1
  62. package/lib/node/ParseSchema.js +6 -4
  63. package/lib/node/ParseUser.js +10 -10
  64. package/lib/node/RESTController.js +3 -1
  65. package/lib/node/Socket.weapp.js +0 -1
  66. package/lib/node/Storage.js +0 -1
  67. package/lib/node/StorageController.browser.js +0 -1
  68. package/lib/node/StorageController.default.js +0 -1
  69. package/lib/node/StorageController.js +0 -1
  70. package/lib/node/StorageController.react-native.js +0 -1
  71. package/lib/node/StorageController.weapp.js +0 -1
  72. package/lib/node/TaskQueue.js +0 -1
  73. package/lib/node/WebSocketController.js +0 -1
  74. package/lib/node/Xhr.weapp.js +0 -1
  75. package/lib/node/uuid.js +0 -1
  76. package/lib/react-native/CoreManager.js +2 -2
  77. package/lib/react-native/CryptoController.js +0 -1
  78. package/lib/react-native/EventEmitter.js +0 -1
  79. package/lib/react-native/EventuallyQueue.js +5 -9
  80. package/lib/react-native/IndexedDBStorageController.js +0 -1
  81. package/lib/react-native/InstallationController.js +0 -1
  82. package/lib/react-native/LiveQuerySubscription.js +7 -7
  83. package/lib/react-native/LocalDatastore.js +0 -1
  84. package/lib/react-native/LocalDatastoreController.default.js +0 -1
  85. package/lib/react-native/LocalDatastoreController.js +0 -1
  86. package/lib/react-native/LocalDatastoreController.react-native.js +0 -1
  87. package/lib/react-native/OfflineQuery.js +0 -1
  88. package/lib/react-native/Parse.js +8 -1
  89. package/lib/react-native/ParseConfig.js +2 -4
  90. package/lib/react-native/ParseInstallation.js +0 -1
  91. package/lib/react-native/ParseLiveQuery.js +2 -2
  92. package/lib/react-native/ParseObject.js +16 -18
  93. package/lib/react-native/ParseQuery.js +5 -6
  94. package/lib/react-native/ParseSchema.js +5 -6
  95. package/lib/react-native/ParseUser.js +3 -5
  96. package/lib/react-native/RESTController.js +3 -1
  97. package/lib/react-native/Socket.weapp.js +0 -1
  98. package/lib/react-native/Storage.js +0 -1
  99. package/lib/react-native/StorageController.browser.js +0 -1
  100. package/lib/react-native/StorageController.default.js +0 -1
  101. package/lib/react-native/StorageController.js +0 -1
  102. package/lib/react-native/StorageController.react-native.js +0 -1
  103. package/lib/react-native/StorageController.weapp.js +0 -1
  104. package/lib/react-native/TaskQueue.js +0 -1
  105. package/lib/react-native/WebSocketController.js +0 -1
  106. package/lib/react-native/Xhr.weapp.js +0 -1
  107. package/lib/react-native/uuid.js +0 -1
  108. package/lib/weapp/Cloud.js +1 -0
  109. package/lib/weapp/CoreManager.js +2 -2
  110. package/lib/weapp/CryptoController.js +0 -1
  111. package/lib/weapp/EventEmitter.js +0 -1
  112. package/lib/weapp/EventuallyQueue.js +6 -10
  113. package/lib/weapp/IndexedDBStorageController.js +0 -1
  114. package/lib/weapp/InstallationController.js +0 -1
  115. package/lib/weapp/LiveQuerySubscription.js +4 -4
  116. package/lib/weapp/LocalDatastore.js +0 -1
  117. package/lib/weapp/LocalDatastoreController.default.js +0 -1
  118. package/lib/weapp/LocalDatastoreController.js +0 -1
  119. package/lib/weapp/LocalDatastoreController.react-native.js +0 -1
  120. package/lib/weapp/OfflineQuery.js +0 -1
  121. package/lib/weapp/Parse.js +12 -1
  122. package/lib/weapp/ParseACL.js +1 -1
  123. package/lib/weapp/ParseConfig.js +2 -4
  124. package/lib/weapp/ParseInstallation.js +0 -1
  125. package/lib/weapp/ParseLiveQuery.js +2 -2
  126. package/lib/weapp/ParseObject.js +10 -10
  127. package/lib/weapp/ParseQuery.js +26 -25
  128. package/lib/weapp/ParseRole.js +1 -1
  129. package/lib/weapp/ParseSchema.js +6 -6
  130. package/lib/weapp/ParseUser.js +10 -12
  131. package/lib/weapp/RESTController.js +7 -3
  132. package/lib/weapp/Socket.weapp.js +0 -1
  133. package/lib/weapp/Storage.js +0 -1
  134. package/lib/weapp/StorageController.browser.js +0 -1
  135. package/lib/weapp/StorageController.default.js +0 -1
  136. package/lib/weapp/StorageController.js +0 -1
  137. package/lib/weapp/StorageController.react-native.js +0 -1
  138. package/lib/weapp/StorageController.weapp.js +0 -1
  139. package/lib/weapp/TaskQueue.js +0 -1
  140. package/lib/weapp/WebSocketController.js +0 -1
  141. package/lib/weapp/Xhr.weapp.js +0 -1
  142. package/lib/weapp/uuid.js +0 -1
  143. package/package.json +15 -12
  144. package/types/Analytics.d.ts +42 -0
  145. package/types/AnonymousUtils.d.ts +84 -0
  146. package/types/Cloud.d.ts +65 -0
  147. package/types/CloudCode.d.ts +307 -0
  148. package/types/CoreManager.d.ts +325 -0
  149. package/types/CryptoController.d.ts +5 -0
  150. package/types/EventEmitter.d.ts +5 -0
  151. package/types/EventuallyQueue.d.ts +168 -0
  152. package/types/FacebookUtils.d.ts +107 -0
  153. package/types/IndexedDBStorageController.d.ts +2 -0
  154. package/types/InstallationController.d.ts +10 -0
  155. package/types/LiveQueryClient.d.ts +128 -0
  156. package/types/LiveQuerySubscription.d.ts +103 -0
  157. package/types/LocalDatastore.d.ts +56 -0
  158. package/types/LocalDatastoreController.d.ts +2 -0
  159. package/types/LocalDatastoreController.default.d.ts +9 -0
  160. package/types/LocalDatastoreController.react-native.d.ts +9 -0
  161. package/types/LocalDatastoreUtils.d.ts +5 -0
  162. package/types/ObjectStateMutations.d.ts +28 -0
  163. package/types/OfflineQuery.d.ts +20 -0
  164. package/types/Parse.d.ts +633 -0
  165. package/types/ParseACL.d.ts +141 -0
  166. package/types/ParseCLP.d.ts +293 -0
  167. package/types/ParseConfig.d.ts +77 -0
  168. package/types/ParseError.d.ts +476 -0
  169. package/types/ParseFile.d.ts +192 -0
  170. package/types/ParseGeoPoint.d.ts +104 -0
  171. package/types/ParseHooks.d.ts +27 -0
  172. package/types/ParseInstallation.d.ts +179 -0
  173. package/types/ParseLiveQuery.d.ts +48 -0
  174. package/types/ParseObject.d.ts +1072 -0
  175. package/types/ParseOp.d.ts +78 -0
  176. package/types/ParsePolygon.d.ts +69 -0
  177. package/types/ParseQuery.d.ts +961 -0
  178. package/types/ParseRelation.d.ts +56 -0
  179. package/types/ParseRole.d.ts +79 -0
  180. package/types/ParseSchema.d.ts +286 -0
  181. package/types/ParseSession.d.ts +45 -0
  182. package/types/ParseUser.d.ts +517 -0
  183. package/types/Push.d.ts +62 -0
  184. package/types/RESTController.d.ts +35 -0
  185. package/types/SingleInstanceStateController.d.ts +24 -0
  186. package/types/Socket.weapp.d.ts +10 -0
  187. package/types/Storage.d.ts +14 -0
  188. package/types/StorageController.browser.d.ts +9 -0
  189. package/types/StorageController.d.ts +2 -0
  190. package/types/StorageController.default.d.ts +9 -0
  191. package/types/StorageController.react-native.d.ts +11 -0
  192. package/types/StorageController.weapp.d.ts +9 -0
  193. package/types/TaskQueue.d.ts +11 -0
  194. package/types/UniqueInstanceStateController.d.ts +20 -0
  195. package/types/WebSocketController.d.ts +2 -0
  196. package/types/Xhr.weapp.d.ts +29 -0
  197. package/types/arrayContainsObject.d.ts +2 -0
  198. package/types/canBeSerialized.d.ts +2 -0
  199. package/types/decode.d.ts +1 -0
  200. package/types/encode.d.ts +1 -0
  201. package/types/equals.d.ts +1 -0
  202. package/types/escape.d.ts +1 -0
  203. package/types/index.d.ts +66 -0
  204. package/types/isRevocableSession.d.ts +1 -0
  205. package/types/node.d.ts +3 -0
  206. package/types/parseDate.d.ts +1 -0
  207. package/types/promiseUtils.d.ts +9 -0
  208. package/types/react-native.d.ts +3 -0
  209. package/types/tests.ts +2256 -0
  210. package/types/tsconfig.json +25 -0
  211. package/types/unique.d.ts +1 -0
  212. package/types/unsavedChildren.d.ts +11 -0
  213. package/types/uuid.d.ts +2 -0
@@ -0,0 +1,141 @@
1
+ import type ParseRole from './ParseRole';
2
+ import type ParseUser from './ParseUser';
3
+ type PermissionsMap = {
4
+ [permission: string]: boolean;
5
+ };
6
+ type ByIdMap = {
7
+ [userId: string]: PermissionsMap;
8
+ };
9
+ /**
10
+ * Creates a new ACL.
11
+ * If no argument is given, the ACL has no permissions for anyone.
12
+ * If the argument is a Parse.User, the ACL will have read and write
13
+ * permission for only that user.
14
+ * If the argument is any other JSON object, that object will be interpretted
15
+ * as a serialized ACL created with toJSON().
16
+ *
17
+ * <p>An ACL, or Access Control List can be added to any
18
+ * <code>Parse.Object</code> to restrict access to only a subset of users
19
+ * of your application.</p>
20
+ *
21
+ * @alias Parse.ACL
22
+ */
23
+ declare class ParseACL {
24
+ permissionsById: ByIdMap;
25
+ /**
26
+ * @param {(Parse.User | object | null)} arg1 The user to initialize the ACL for
27
+ */
28
+ constructor(arg1?: ParseUser | ByIdMap | null);
29
+ /**
30
+ * Returns a JSON-encoded version of the ACL.
31
+ *
32
+ * @returns {object}
33
+ */
34
+ toJSON(): ByIdMap;
35
+ /**
36
+ * Returns whether this ACL is equal to another object
37
+ *
38
+ * @param {ParseACL} other The other object's ACL to compare to
39
+ * @returns {boolean}
40
+ */
41
+ equals(other: ParseACL): boolean;
42
+ _setAccess(accessType: string, userId: ParseUser | ParseRole | string, allowed: boolean): void;
43
+ _getAccess(accessType: string, userId: ParseUser | ParseRole | string): boolean;
44
+ /**
45
+ * Sets whether the given user is allowed to read this object.
46
+ *
47
+ * @param userId An instance of Parse.User or its objectId.
48
+ * @param {boolean} allowed Whether that user should have read access.
49
+ */
50
+ setReadAccess(userId: ParseUser | ParseRole | string, allowed: boolean): void;
51
+ /**
52
+ * Get whether the given user id is *explicitly* allowed to read this object.
53
+ * Even if this returns false, the user may still be able to access it if
54
+ * getPublicReadAccess returns true or a role that the user belongs to has
55
+ * write access.
56
+ *
57
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
58
+ * @returns {boolean}
59
+ */
60
+ getReadAccess(userId: ParseUser | ParseRole | string): boolean;
61
+ /**
62
+ * Sets whether the given user id is allowed to write this object.
63
+ *
64
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
65
+ * @param {boolean} allowed Whether that user should have write access.
66
+ */
67
+ setWriteAccess(userId: ParseUser | ParseRole | string, allowed: boolean): void;
68
+ /**
69
+ * Gets whether the given user id is *explicitly* allowed to write this object.
70
+ * Even if this returns false, the user may still be able to write it if
71
+ * getPublicWriteAccess returns true or a role that the user belongs to has
72
+ * write access.
73
+ *
74
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
75
+ * @returns {boolean}
76
+ */
77
+ getWriteAccess(userId: ParseUser | ParseRole | string): boolean;
78
+ /**
79
+ * Sets whether the public is allowed to read this object.
80
+ *
81
+ * @param {boolean} allowed
82
+ */
83
+ setPublicReadAccess(allowed: boolean): void;
84
+ /**
85
+ * Gets whether the public is allowed to read this object.
86
+ *
87
+ * @returns {boolean}
88
+ */
89
+ getPublicReadAccess(): boolean;
90
+ /**
91
+ * Sets whether the public is allowed to write this object.
92
+ *
93
+ * @param {boolean} allowed
94
+ */
95
+ setPublicWriteAccess(allowed: boolean): void;
96
+ /**
97
+ * Gets whether the public is allowed to write this object.
98
+ *
99
+ * @returns {boolean}
100
+ */
101
+ getPublicWriteAccess(): boolean;
102
+ /**
103
+ * Gets whether users belonging to the given role are allowed
104
+ * to read this object. Even if this returns false, the role may
105
+ * still be able to write it if a parent role has read access.
106
+ *
107
+ * @param role The name of the role, or a Parse.Role object.
108
+ * @returns {boolean} true if the role has read access. false otherwise.
109
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
110
+ */
111
+ getRoleReadAccess(role: ParseRole | string): boolean;
112
+ /**
113
+ * Gets whether users belonging to the given role are allowed
114
+ * to write this object. Even if this returns false, the role may
115
+ * still be able to write it if a parent role has write access.
116
+ *
117
+ * @param role The name of the role, or a Parse.Role object.
118
+ * @returns {boolean} true if the role has write access. false otherwise.
119
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
120
+ */
121
+ getRoleWriteAccess(role: ParseRole | string): boolean;
122
+ /**
123
+ * Sets whether users belonging to the given role are allowed
124
+ * to read this object.
125
+ *
126
+ * @param role The name of the role, or a Parse.Role object.
127
+ * @param {boolean} allowed Whether the given role can read this object.
128
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
129
+ */
130
+ setRoleReadAccess(role: ParseRole | string, allowed: boolean): void;
131
+ /**
132
+ * Sets whether users belonging to the given role are allowed
133
+ * to write this object.
134
+ *
135
+ * @param role The name of the role, or a Parse.Role object.
136
+ * @param {boolean} allowed Whether the given role can write this object.
137
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
138
+ */
139
+ setRoleWriteAccess(role: ParseRole | string, allowed: boolean): void;
140
+ }
141
+ export default ParseACL;
@@ -0,0 +1,293 @@
1
+ import ParseRole from './ParseRole';
2
+ import ParseUser from './ParseUser';
3
+ type Entity = ParseUser | ParseRole | string;
4
+ type UsersMap = {
5
+ [userId: string]: boolean | any;
6
+ };
7
+ export type PermissionsMap = {
8
+ writeUserFields?: string[];
9
+ readUserFields?: string[];
10
+ } & {
11
+ [permission: string]: UsersMap;
12
+ };
13
+ /**
14
+ * Creates a new CLP.
15
+ * If no argument is given, the CLP has no permissions for anyone.
16
+ * If the argument is a Parse.User or Parse.Role, the CLP will have read and write
17
+ * permission for only that user or role.
18
+ * If the argument is any other JSON object, that object will be interpretted
19
+ * as a serialized CLP created with toJSON().
20
+ *
21
+ * <p>A CLP, or Class Level Permissions can be added to any
22
+ * <code>Parse.Schema</code> to restrict access to only a subset of users
23
+ * of your application.</p>
24
+ *
25
+ * <p>
26
+ * For get/count/find/create/update/delete/addField using the following functions:
27
+ *
28
+ * Entity is type Parse.User or Parse.Role or string
29
+ * Role is type Parse.Role or Name of Parse.Role
30
+ *
31
+ * getGetRequiresAuthentication()
32
+ * setGetRequiresAuthentication(allowed: boolean)
33
+ * getGetPointerFields()
34
+ * setGetPointerFields(pointerFields: string[])
35
+ * getGetAccess(entity: Entity)
36
+ * setGetAccess(entity: Entity, allowed: boolean)
37
+ * getPublicGetAccess()
38
+ * setPublicGetAccess(allowed: boolean)
39
+ * getRoleGetAccess(role: Role)
40
+ * setRoleGetAccess(role: Role, allowed: boolean)
41
+ * getFindRequiresAuthentication()
42
+ * setFindRequiresAuthentication(allowed: boolean)
43
+ * getFindPointerFields()
44
+ * setFindPointerFields(pointerFields: string[])
45
+ * getFindAccess(entity: Entity)
46
+ * setFindAccess(entity: Entity, allowed: boolean)
47
+ * getPublicFindAccess()
48
+ * setPublicFindAccess(allowed: boolean)
49
+ * getRoleFindAccess(role: Role)
50
+ * setRoleFindAccess(role: Role, allowed: boolean)
51
+ * getCountRequiresAuthentication()
52
+ * setCountRequiresAuthentication(allowed: boolean)
53
+ * getCountPointerFields()
54
+ * setCountPointerFields(pointerFields: string[])
55
+ * getCountAccess(entity: Entity)
56
+ * setCountAccess(entity: Entity, allowed: boolean)
57
+ * getPublicCountAccess()
58
+ * setPublicCountAccess(allowed: boolean)
59
+ * getRoleCountAccess(role: Role)
60
+ * setRoleCountAccess(role: Role, allowed: boolean)
61
+ * getCreateRequiresAuthentication()
62
+ * setCreateRequiresAuthentication(allowed: boolean)
63
+ * getCreatePointerFields()
64
+ * setCreatePointerFields(pointerFields: string[])
65
+ * getCreateAccess(entity: Entity)
66
+ * setCreateAccess(entity: Entity, allowed: boolean)
67
+ * getPublicCreateAccess()
68
+ * setPublicCreateAccess(allowed: Boolean)
69
+ * getRoleCreateAccess(role: Role)
70
+ * setRoleCreateAccess(role: Role, allowed: boolean)
71
+ * getUpdateRequiresAuthentication()
72
+ * setUpdateRequiresAuthentication(allowed: boolean)
73
+ * getUpdatePointerFields()
74
+ * setUpdatePointerFields(pointerFields: string[])
75
+ * getUpdateAccess(entity: Entity)
76
+ * setUpdateAccess(entity: Entity, allowed: boolean)
77
+ * getPublicUpdateAccess()
78
+ * setPublicUpdateAccess(allowed: boolean)
79
+ * getRoleUpdateAccess(role: Role)
80
+ * setRoleUpdateAccess(role: Role, allowed: boolean)
81
+ * getDeleteRequiresAuthentication()
82
+ * setDeleteRequiresAuthentication(allowed: boolean)
83
+ * getDeletePointerFields()
84
+ * setDeletePointerFields(pointerFields: string[])
85
+ * getDeleteAccess(entity: Entity)
86
+ * setDeleteAccess(entity: Entity, allowed: boolean)
87
+ * getPublicDeleteAccess()
88
+ * setPublicDeleteAccess(allowed: boolean)
89
+ * getRoleDeleteAccess(role: Role)
90
+ * setRoleDeleteAccess(role: Role, allowed: boolean)
91
+ * getAddFieldRequiresAuthentication()
92
+ * setAddFieldRequiresAuthentication(allowed: boolean)
93
+ * getAddFieldPointerFields()
94
+ * setAddFieldPointerFields(pointerFields: string[])
95
+ * getAddFieldAccess(entity: Entity)
96
+ * setAddFieldAccess(entity: Entity, allowed: boolean)
97
+ * getPublicAddFieldAccess()
98
+ * setPublicAddFieldAccess(allowed: boolean)
99
+ * getRoleAddFieldAccess(role: Role)
100
+ * setRoleAddFieldAccess(role: Role, allowed: boolean)
101
+ * </p>
102
+ *
103
+ * @alias Parse.CLP
104
+ */
105
+ declare class ParseCLP {
106
+ permissionsMap: PermissionsMap;
107
+ /**
108
+ * @param {(Parse.User | Parse.Role | object)} userId The user to initialize the CLP for
109
+ */
110
+ constructor(userId: ParseUser | ParseRole | PermissionsMap);
111
+ /**
112
+ * Returns a JSON-encoded version of the CLP.
113
+ *
114
+ * @returns {object}
115
+ */
116
+ toJSON(): PermissionsMap;
117
+ /**
118
+ * Returns whether this CLP is equal to another object
119
+ *
120
+ * @param other The other object to compare to
121
+ * @returns {boolean}
122
+ */
123
+ equals(other: ParseCLP): boolean;
124
+ _getRoleName(role: ParseRole | string): string;
125
+ _parseEntity(entity: Entity): string;
126
+ _setAccess(permission: string, userId: Entity, allowed: boolean): void;
127
+ _getAccess(permission: string, userId: Entity, returnBoolean?: boolean): boolean | string[];
128
+ _setArrayAccess(permission: string, userId: Entity, fields: string[]): void;
129
+ _setGroupPointerPermission(operation: string, pointerFields: string[]): void;
130
+ _getGroupPointerPermissions(operation: 'readUserFields' | 'writeUserFields'): string[];
131
+ /**
132
+ * Sets user pointer fields to allow permission for get/count/find operations.
133
+ *
134
+ * @param {string[]} pointerFields User pointer fields
135
+ */
136
+ setReadUserFields(pointerFields: string[]): void;
137
+ /**
138
+ * @returns {string[]} User pointer fields
139
+ */
140
+ getReadUserFields(): string[];
141
+ /**
142
+ * Sets user pointer fields to allow permission for create/delete/update/addField operations
143
+ *
144
+ * @param {string[]} pointerFields User pointer fields
145
+ */
146
+ setWriteUserFields(pointerFields: string[]): void;
147
+ /**
148
+ * @returns {string[]} User pointer fields
149
+ */
150
+ getWriteUserFields(): string[];
151
+ /**
152
+ * Sets whether the given user is allowed to retrieve fields from this class.
153
+ *
154
+ * @param userId An instance of Parse.User or its objectId.
155
+ * @param {string[]} fields fields to be protected
156
+ */
157
+ setProtectedFields(userId: Entity, fields: string[]): void;
158
+ /**
159
+ * Returns array of fields are accessable to this user.
160
+ *
161
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
162
+ * @returns {string[]}
163
+ */
164
+ getProtectedFields(userId: Entity): string[];
165
+ /**
166
+ * Sets whether the given user is allowed to read from this class.
167
+ *
168
+ * @param userId An instance of Parse.User or its objectId.
169
+ * @param {boolean} allowed whether that user should have read access.
170
+ */
171
+ setReadAccess(userId: Entity, allowed: boolean): void;
172
+ /**
173
+ * Get whether the given user id is *explicitly* allowed to read from this class.
174
+ * Even if this returns false, the user may still be able to access it if
175
+ * getPublicReadAccess returns true or a role that the user belongs to has
176
+ * write access.
177
+ *
178
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
179
+ * @returns {boolean}
180
+ */
181
+ getReadAccess(userId: Entity): boolean;
182
+ /**
183
+ * Sets whether the given user id is allowed to write to this class.
184
+ *
185
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role..
186
+ * @param {boolean} allowed Whether that user should have write access.
187
+ */
188
+ setWriteAccess(userId: Entity, allowed: boolean): void;
189
+ /**
190
+ * Gets whether the given user id is *explicitly* allowed to write to this class.
191
+ * Even if this returns false, the user may still be able to write it if
192
+ * getPublicWriteAccess returns true or a role that the user belongs to has
193
+ * write access.
194
+ *
195
+ * @param userId An instance of Parse.User or its objectId, or a Parse.Role.
196
+ * @returns {boolean}
197
+ */
198
+ getWriteAccess(userId: Entity): boolean;
199
+ /**
200
+ * Sets whether the public is allowed to read from this class.
201
+ *
202
+ * @param {boolean} allowed
203
+ */
204
+ setPublicReadAccess(allowed: boolean): void;
205
+ /**
206
+ * Gets whether the public is allowed to read from this class.
207
+ *
208
+ * @returns {boolean}
209
+ */
210
+ getPublicReadAccess(): boolean;
211
+ /**
212
+ * Sets whether the public is allowed to write to this class.
213
+ *
214
+ * @param {boolean} allowed
215
+ */
216
+ setPublicWriteAccess(allowed: boolean): void;
217
+ /**
218
+ * Gets whether the public is allowed to write to this class.
219
+ *
220
+ * @returns {boolean}
221
+ */
222
+ getPublicWriteAccess(): boolean;
223
+ /**
224
+ * Sets whether the public is allowed to protect fields in this class.
225
+ *
226
+ * @param {string[]} fields
227
+ */
228
+ setPublicProtectedFields(fields: string[]): void;
229
+ /**
230
+ * Gets whether the public is allowed to read fields from this class.
231
+ *
232
+ * @returns {string[]}
233
+ */
234
+ getPublicProtectedFields(): string[];
235
+ /**
236
+ * Gets whether users belonging to the given role are allowed
237
+ * to read from this class. Even if this returns false, the role may
238
+ * still be able to write it if a parent role has read access.
239
+ *
240
+ * @param role The name of the role, or a Parse.Role object.
241
+ * @returns {boolean} true if the role has read access. false otherwise.
242
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
243
+ */
244
+ getRoleReadAccess(role: ParseRole | string): boolean;
245
+ /**
246
+ * Gets whether users belonging to the given role are allowed
247
+ * to write to this user. Even if this returns false, the role may
248
+ * still be able to write it if a parent role has write access.
249
+ *
250
+ * @param role The name of the role, or a Parse.Role object.
251
+ * @returns {boolean} true if the role has write access. false otherwise.
252
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
253
+ */
254
+ getRoleWriteAccess(role: ParseRole | string): boolean;
255
+ /**
256
+ * Sets whether users belonging to the given role are allowed
257
+ * to read from this class.
258
+ *
259
+ * @param role The name of the role, or a Parse.Role object.
260
+ * @param {boolean} allowed Whether the given role can read this object.
261
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
262
+ */
263
+ setRoleReadAccess(role: ParseRole | string, allowed: boolean): void;
264
+ /**
265
+ * Sets whether users belonging to the given role are allowed
266
+ * to write to this class.
267
+ *
268
+ * @param role The name of the role, or a Parse.Role object.
269
+ * @param {boolean} allowed Whether the given role can write this object.
270
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
271
+ */
272
+ setRoleWriteAccess(role: ParseRole | string, allowed: boolean): void;
273
+ /**
274
+ * Gets whether users belonging to the given role are allowed
275
+ * to count to this user. Even if this returns false, the role may
276
+ * still be able to count it if a parent role has count access.
277
+ *
278
+ * @param role The name of the role, or a Parse.Role object.
279
+ * @returns {string[]}
280
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
281
+ */
282
+ getRoleProtectedFields(role: ParseRole | string): string[];
283
+ /**
284
+ * Sets whether users belonging to the given role are allowed
285
+ * to set access field in this class.
286
+ *
287
+ * @param role The name of the role, or a Parse.Role object.
288
+ * @param {string[]} fields Fields to be protected by Role.
289
+ * @throws {TypeError} If role is neither a Parse.Role nor a String.
290
+ */
291
+ setRoleProtectedFields(role: ParseRole | string, fields: string[]): void;
292
+ }
293
+ export default ParseCLP;
@@ -0,0 +1,77 @@
1
+ import type { RequestOptions } from './RESTController';
2
+ /**
3
+ * Parse.Config is a local representation of configuration data that
4
+ * can be set from the Parse dashboard.
5
+ *
6
+ * @alias Parse.Config
7
+ */
8
+ declare class ParseConfig {
9
+ attributes: {
10
+ [key: string]: any;
11
+ };
12
+ _escapedAttributes: {
13
+ [key: string]: any;
14
+ };
15
+ constructor();
16
+ /**
17
+ * Gets the value of an attribute.
18
+ *
19
+ * @param {string} attr The name of an attribute.
20
+ * @returns {*}
21
+ */
22
+ get(attr: string): any;
23
+ /**
24
+ * Gets the HTML-escaped value of an attribute.
25
+ *
26
+ * @param {string} attr The name of an attribute.
27
+ * @returns {string}
28
+ */
29
+ escape(attr: string): string;
30
+ /**
31
+ * Retrieves the most recently-fetched configuration object, either from
32
+ * memory or from local storage if necessary.
33
+ *
34
+ * @static
35
+ * @returns {Parse.Config} The most recently-fetched Parse.Config if it
36
+ * exists, else an empty Parse.Config.
37
+ */
38
+ static current(): ParseConfig | Promise<ParseConfig>;
39
+ /**
40
+ * Gets a new configuration object from the server.
41
+ *
42
+ * @static
43
+ * @param {object} options
44
+ * Valid options are:<ul>
45
+ * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
46
+ * be used for this request.
47
+ * </ul>
48
+ * @returns {Promise} A promise that is resolved with a newly-created
49
+ * configuration object when the get completes.
50
+ */
51
+ static get(options?: RequestOptions): Promise<ParseConfig>;
52
+ /**
53
+ * Save value keys to the server.
54
+ *
55
+ * @static
56
+ * @param {object} attrs The config parameters and values.
57
+ * @param {object} masterKeyOnlyFlags The flags that define whether config parameters listed
58
+ * in `attrs` should be retrievable only by using the master key.
59
+ * For example: `param1: true` makes `param1` only retrievable by using the master key.
60
+ * If a parameter is not provided or set to `false`, it can be retrieved without
61
+ * using the master key.
62
+ * @returns {Promise} A promise that is resolved with a newly-created
63
+ * configuration object or with the current with the update.
64
+ */
65
+ static save(attrs: {
66
+ [key: string]: any;
67
+ }, masterKeyOnlyFlags: {
68
+ [key: string]: any;
69
+ }): Promise<ParseConfig>;
70
+ /**
71
+ * Used for testing
72
+ *
73
+ * @private
74
+ */
75
+ static _clearCache(): void;
76
+ }
77
+ export default ParseConfig;