parse 4.1.0 → 4.2.0-alpha.1

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 (87) hide show
  1. package/dist/parse.js +253 -58
  2. package/dist/parse.min.js +2 -2
  3. package/dist/parse.weapp.js +253 -58
  4. package/dist/parse.weapp.min.js +2 -2
  5. package/lib/browser/AnonymousUtils.js +1 -1
  6. package/lib/browser/Cloud.js +1 -2
  7. package/lib/browser/CoreManager.js +1 -1
  8. package/lib/browser/EventuallyQueue.js +13 -1
  9. package/lib/browser/LiveQueryClient.js +8 -4
  10. package/lib/browser/LocalDatastore.js +3 -1
  11. package/lib/browser/LocalDatastoreController.js +3 -1
  12. package/lib/browser/ObjectStateMutations.js +14 -1
  13. package/lib/browser/ParseACL.js +2 -1
  14. package/lib/browser/ParseCLP.js +6 -1
  15. package/lib/browser/ParseConfig.js +1 -0
  16. package/lib/browser/ParseFile.js +5 -1
  17. package/lib/browser/ParseInstallation.js +4 -1
  18. package/lib/browser/ParseObject.js +10 -7
  19. package/lib/browser/ParseOp.js +3 -1
  20. package/lib/browser/ParseQuery.js +79 -24
  21. package/lib/browser/ParseRole.js +5 -1
  22. package/lib/browser/ParseSchema.js +1 -1
  23. package/lib/browser/ParseSession.js +5 -1
  24. package/lib/browser/ParseUser.js +42 -1
  25. package/lib/browser/Push.js +8 -2
  26. package/lib/browser/RESTController.js +20 -0
  27. package/lib/browser/SingleInstanceStateController.js +6 -1
  28. package/lib/browser/TaskQueue.js +4 -0
  29. package/lib/browser/UniqueInstanceStateController.js +3 -1
  30. package/lib/browser/unsavedChildren.js +4 -1
  31. package/lib/node/AnonymousUtils.js +1 -1
  32. package/lib/node/Cloud.js +1 -2
  33. package/lib/node/CoreManager.js +1 -1
  34. package/lib/node/EventuallyQueue.js +13 -1
  35. package/lib/node/LiveQueryClient.js +5 -2
  36. package/lib/node/LocalDatastore.js +1 -1
  37. package/lib/node/ObjectStateMutations.js +11 -1
  38. package/lib/node/ParseACL.js +2 -1
  39. package/lib/node/ParseCLP.js +3 -1
  40. package/lib/node/ParseConfig.js +1 -2
  41. package/lib/node/ParseFile.js +2 -1
  42. package/lib/node/ParseInstallation.js +1 -1
  43. package/lib/node/ParseObject.js +2 -1
  44. package/lib/node/ParseQuery.js +50 -1
  45. package/lib/node/ParseRole.js +2 -1
  46. package/lib/node/ParseSchema.js +1 -1
  47. package/lib/node/ParseSession.js +2 -1
  48. package/lib/node/ParseUser.js +37 -1
  49. package/lib/node/Push.js +8 -2
  50. package/lib/node/RESTController.js +20 -0
  51. package/lib/node/SingleInstanceStateController.js +6 -1
  52. package/lib/node/TaskQueue.js +4 -1
  53. package/lib/node/UniqueInstanceStateController.js +3 -1
  54. package/lib/node/unsavedChildren.js +4 -1
  55. package/lib/react-native/CoreManager.js +1 -1
  56. package/lib/react-native/LiveQueryClient.js +7 -3
  57. package/lib/react-native/ParseCLP.js +2 -2
  58. package/lib/react-native/ParseFile.js +1 -0
  59. package/lib/react-native/ParseQuery.js +34 -11
  60. package/lib/react-native/ParseUser.js +25 -0
  61. package/lib/weapp/AnonymousUtils.js +1 -1
  62. package/lib/weapp/Cloud.js +1 -2
  63. package/lib/weapp/CoreManager.js +1 -1
  64. package/lib/weapp/EventuallyQueue.js +13 -1
  65. package/lib/weapp/LiveQueryClient.js +8 -4
  66. package/lib/weapp/LocalDatastore.js +3 -1
  67. package/lib/weapp/LocalDatastoreController.js +3 -1
  68. package/lib/weapp/ObjectStateMutations.js +14 -1
  69. package/lib/weapp/ParseACL.js +2 -1
  70. package/lib/weapp/ParseCLP.js +6 -1
  71. package/lib/weapp/ParseConfig.js +1 -0
  72. package/lib/weapp/ParseFile.js +5 -1
  73. package/lib/weapp/ParseInstallation.js +4 -1
  74. package/lib/weapp/ParseObject.js +10 -7
  75. package/lib/weapp/ParseOp.js +3 -1
  76. package/lib/weapp/ParseQuery.js +79 -24
  77. package/lib/weapp/ParseRole.js +5 -1
  78. package/lib/weapp/ParseSchema.js +1 -1
  79. package/lib/weapp/ParseSession.js +5 -1
  80. package/lib/weapp/ParseUser.js +42 -1
  81. package/lib/weapp/Push.js +8 -2
  82. package/lib/weapp/RESTController.js +20 -0
  83. package/lib/weapp/SingleInstanceStateController.js +6 -1
  84. package/lib/weapp/TaskQueue.js +4 -0
  85. package/lib/weapp/UniqueInstanceStateController.js +3 -1
  86. package/lib/weapp/unsavedChildren.js +4 -1
  87. package/package.json +18 -18
@@ -49,7 +49,12 @@ function _isNativeReflectConstruct() {
49
49
  } catch (e) {
50
50
  return false;
51
51
  }
52
- }
52
+ } /**
53
+ * @flow
54
+ */
55
+ /*:: import type { AttributeMap } from './ObjectStateMutations';*/
56
+ /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
57
+ /*:: export type AuthData = ?{ [key: string]: mixed };*/
53
58
  var CURRENT_USER_KEY = 'currentUser';
54
59
  var canUseCurrentUser = !_CoreManager.default.get('IS_NODE');
55
60
  var currentUserCacheMatchesDisk = false;
@@ -875,6 +880,27 @@ var ParseUser = /*#__PURE__*/function (_ParseObject) {
875
880
  return user.logIn(options);
876
881
  }
877
882
 
883
+ /**
884
+ * Logs in a user with an objectId. On success, this saves the session
885
+ * to disk, so you can retrieve the currently logged in user using
886
+ * <code>current</code>.
887
+ *
888
+ * @param {string} userId The objectId for the user.
889
+ * @static
890
+ * @returns {Promise} A promise that is fulfilled with the user when
891
+ * the login completes.
892
+ */
893
+ }, {
894
+ key: "loginAs",
895
+ value: function (userId /*: string*/) {
896
+ if (!userId) {
897
+ throw new _ParseError.default(_ParseError.default.USERNAME_MISSING, 'Cannot log in as user with an empty user id');
898
+ }
899
+ var controller = _CoreManager.default.getUserController();
900
+ var user = new this();
901
+ return controller.loginAs(user, userId);
902
+ }
903
+
878
904
  /**
879
905
  * Logs in a user with a session token. On success, this saves the session
880
906
  * to disk, so you can retrieve the currently logged in user using
@@ -1319,6 +1345,21 @@ var DefaultController = {
1319
1345
  return DefaultController.setCurrentUser(user);
1320
1346
  });
1321
1347
  },
1348
+ loginAs: function (user /*: ParseUser*/, userId /*: string*/) /*: Promise<ParseUser>*/{
1349
+ var RESTController = _CoreManager.default.getRESTController();
1350
+ return RESTController.request('POST', 'loginAs', {
1351
+ userId: userId
1352
+ }, {
1353
+ useMasterKey: true
1354
+ }).then(function (response) {
1355
+ user._finishFetch(response);
1356
+ user._setExisted(true);
1357
+ if (!canUseCurrentUser) {
1358
+ return _promise.default.resolve(user);
1359
+ }
1360
+ return DefaultController.setCurrentUser(user);
1361
+ });
1362
+ },
1322
1363
  become: function (user /*: ParseUser*/, options /*: RequestOptions*/) /*: Promise<ParseUser>*/{
1323
1364
  var RESTController = _CoreManager.default.getRESTController();
1324
1365
  return RESTController.request('GET', 'users/me', {}, options).then(function (response) {
package/lib/weapp/Push.js CHANGED
@@ -13,7 +13,14 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
13
13
  /**
14
14
  * @flow
15
15
  */
16
-
16
+ /*:: import type { WhereClause } from './ParseQuery';*/
17
+ /*:: import type { FullOptions } from './RESTController';*/
18
+ /*:: export type PushData = {
19
+ where?: WhereClause | ParseQuery,
20
+ push_time?: Date | string,
21
+ expiration_time?: Date | string,
22
+ expiration_interval?: number,
23
+ };*/
17
24
  /**
18
25
  * Contains functions to deal with Push in Parse.
19
26
  *
@@ -21,7 +28,6 @@ var _ParseQuery = _interopRequireDefault(require("./ParseQuery"));
21
28
  * @static
22
29
  * @hideconstructor
23
30
  */
24
-
25
31
  /**
26
32
  * Sends a push notification.
27
33
  * **Available in Cloud Code only.**
@@ -45,6 +45,26 @@ function _objectSpread(target) {
45
45
  */
46
46
  /* global XMLHttpRequest, XDomainRequest */
47
47
  var uuidv4 = require('./uuid');
48
+ /*:: export type RequestOptions = {
49
+ useMasterKey?: boolean,
50
+ sessionToken?: string,
51
+ installationId?: string,
52
+ returnStatus?: boolean,
53
+ batchSize?: number,
54
+ include?: any,
55
+ progress?: any,
56
+ context?: any,
57
+ usePost?: boolean,
58
+ };*/
59
+ /*:: export type FullOptions = {
60
+ success?: any,
61
+ error?: any,
62
+ useMasterKey?: boolean,
63
+ sessionToken?: string,
64
+ installationId?: string,
65
+ progress?: any,
66
+ usePost?: boolean,
67
+ };*/
48
68
  var XHR = null;
49
69
  if (typeof XMLHttpRequest !== 'undefined') {
50
70
  XHR = XMLHttpRequest;
@@ -66,7 +66,12 @@ function _interopRequireWildcard(obj, nodeInterop) {
66
66
  /**
67
67
  * @flow
68
68
  */
69
-
69
+ /*:: import type { Op } from './ParseOp';*/
70
+ /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
71
+ /*:: type ObjectIdentifier = {
72
+ className: string,
73
+ id: string,
74
+ };*/
70
75
  var objectState
71
76
  /*: {
72
77
  [className: string]: {
@@ -8,6 +8,10 @@ var _promiseUtils = require("./promiseUtils");
8
8
  /**
9
9
  * @flow
10
10
  */
11
+ /*:: type Task = {
12
+ task: () => Promise,
13
+ _completion: Promise,
14
+ };*/
11
15
  var TaskQueue = /*#__PURE__*/function () {
12
16
  function TaskQueue() {
13
17
  (0, _classCallCheck2.default)(this, TaskQueue);
@@ -69,7 +69,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
69
69
  /**
70
70
  * @flow
71
71
  */
72
-
72
+ /*:: import type { Op } from './ParseOp';*/
73
+ /*:: import type ParseObject from './ParseObject';*/
74
+ /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
73
75
  var objectState = new _weakMap.default();
74
76
  function getState(obj /*: ParseObject*/) /*: ?State*/{
75
77
  var classData = objectState.get(obj);
@@ -17,7 +17,10 @@ var _ParseRelation = _interopRequireDefault(require("./ParseRelation"));
17
17
  /**
18
18
  * @flow
19
19
  */
20
-
20
+ /*:: type EncounterMap = {
21
+ objects: { [identifier: string]: ParseObject | boolean },
22
+ files: Array<ParseFile>,
23
+ };*/
21
24
  /**
22
25
  * Return an array of unsaved children, which are either Parse Objects or Files.
23
26
  * If it encounters any dirty Objects without Ids, it will throw an exception.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "4.1.0",
3
+ "version": "4.2.0-alpha.1",
4
4
  "description": "Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org",
6
6
  "keywords": [
@@ -33,37 +33,37 @@
33
33
  "idb-keyval": "6.2.0",
34
34
  "react-native-crypto-js": "1.0.0",
35
35
  "uuid": "9.0.0",
36
- "ws": "8.12.0",
36
+ "ws": "8.13.0",
37
37
  "xmlhttprequest": "1.8.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@babel/core": "7.21.0",
41
- "@babel/eslint-parser": "7.19.1",
40
+ "@babel/core": "7.21.5",
41
+ "@babel/eslint-parser": "7.21.3",
42
42
  "@babel/plugin-proposal-class-properties": "7.18.6",
43
43
  "@babel/plugin-transform-flow-comments": "7.21.0",
44
44
  "@babel/plugin-transform-flow-strip-types": "7.21.0",
45
- "@babel/plugin-transform-runtime": "7.21.0",
46
- "@babel/preset-env": "7.20.2",
45
+ "@babel/plugin-transform-runtime": "7.21.4",
46
+ "@babel/preset-env": "7.21.4",
47
47
  "@babel/preset-react": "7.18.6",
48
48
  "@parse/minami": "1.0.0",
49
49
  "@saithodev/semantic-release-backmerge": "2.1.3",
50
- "@semantic-release/changelog": "6.0.2",
50
+ "@semantic-release/changelog": "6.0.3",
51
51
  "@semantic-release/commit-analyzer": "9.0.2",
52
52
  "@semantic-release/git": "10.0.1",
53
53
  "@semantic-release/github": "8.0.7",
54
54
  "@semantic-release/npm": "9.0.2",
55
55
  "@semantic-release/release-notes-generator": "10.0.3",
56
- "babel-jest": "29.4.3",
56
+ "babel-jest": "29.5.0",
57
57
  "babel-plugin-inline-package-json": "2.0.0",
58
58
  "babel-plugin-minify-dead-code-elimination": "0.5.2",
59
59
  "babel-plugin-transform-inline-environment-variables": "0.4.4",
60
60
  "browserify": "17.0.0",
61
61
  "codecov": "3.8.3",
62
- "core-js": "3.29.0",
62
+ "core-js": "3.30.1",
63
63
  "cross-env": "7.0.2",
64
- "eslint": "8.35.0",
64
+ "eslint": "8.39.0",
65
65
  "eslint-plugin-flowtype": "8.0.3",
66
- "eslint-plugin-jsdoc": "40.0.0",
66
+ "eslint-plugin-jsdoc": "43.0.7",
67
67
  "express": "4.18.2",
68
68
  "gulp": "4.0.2",
69
69
  "gulp-babel": "8.0.0",
@@ -73,19 +73,19 @@
73
73
  "gulp-uglify": "3.0.2",
74
74
  "gulp-watch": "5.0.1",
75
75
  "husky": "8.0.3",
76
- "jasmine": "4.5.0",
76
+ "jasmine": "4.6.0",
77
77
  "jasmine-reporters": "2.5.2",
78
78
  "jasmine-spec-reporter": "7.0.0",
79
- "jest": "29.4.3",
80
- "jest-environment-jsdom": "29.4.3",
79
+ "jest": "29.5.0",
80
+ "jest-environment-jsdom": "29.5.0",
81
81
  "jsdoc": "4.0.2",
82
82
  "jsdoc-babel": "0.5.0",
83
- "lint-staged": "13.1.2",
84
- "metro-react-native-babel-preset": "0.75.1",
83
+ "lint-staged": "13.2.2",
84
+ "metro-react-native-babel-preset": "0.76.3",
85
85
  "mongodb-runner": "4.10.0",
86
86
  "parse-server": "git+https://github.com/parse-community/parse-server#alpha",
87
- "prettier": "2.8.4",
88
- "puppeteer": "19.7.2",
87
+ "prettier": "2.8.8",
88
+ "puppeteer": "19.11.1",
89
89
  "regenerator-runtime": "0.13.11",
90
90
  "semantic-release": "19.0.5",
91
91
  "vinyl-source-stream": "2.0.0"